Solved Included kodi.service starts before network is ready on Raspberry Pi 3B+/wireless
#1
Problem: When kodi.service is enabled at boot time, kodi starts before the network is up and thus cannot connect to mysql.
Work around: ssh into the RPi and manually stop kodi.service and manually start kodi.service after it boots.

Details: I want to use systemd-networkd and wpa_supplicant to manage the network.  I want to retain the option to plugin a physical cable to eth0 if I need to but generally, only wireless networking will be used unless something breaks and needs manual intervention.  As such, I created 2 files in /etc/systemd/network/ shown below.

Question: Is there a modification to kodi.service to cause it to wait for the wireless network to be ready ie via Requires= or Wants= for just the wireless network (see this reference)? When I add After=network-online.target andWants=network-online.target to kodi.service, kodi start up is delayed by 2 min (the default timeout I guess).

Is there a better configuration to systemd-networkd to prevent this?
Code:
% cat /etc/systemd/network/10-wire.network
[Match]
Name=eth0
[Network]
DHCP=ipv4
[DHCP]
RouteMetric=10
 
Code:
% cat /etc/systemd/network/20-wireless.network
[Match]
Name=wlan0
[Network]
DHCP=ipv4
[DHCP]
RouteMetric=20
Need help programming a Streamzap remote?
Reply
#2
Ah... I found systemd#5154.  Perhaps the solution is two fold:

1) Copy /usr/lib/systemd/system/kodi.service to /etc/systemd/system/ and modify it as follows:
Code:
-After=remote-fs.target
+After=remote-fs.target network-online.target
+Wants=network-online.target

2) Copy /usr/lib/systemd/system/systemd-networkd-wait-online.service to /etc/systemd/system/ and modify it as follows:
Code:
-ExecStart=/usr/lib/systemd/systemd-networkd-wait-online
+ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --ignore eth0

Seems kind of hackish... you guys have any other thoughts?  Thanks!
Need help programming a Streamzap remote?
Reply
#3
Which OS are you using on the RPi3B+ ?
Reply
#4
(2018-04-21, 16:12)Klojum Wrote: Which OS are you using on the RPi3B+ ?
 Sorry, should have mentioned: Arch ARM (armv7h).
Need help programming a Streamzap remote?
Reply
#5
Is this a dedicated Kodi device or are you using it for something else?
HTPCs: 2 x Chromecast with Google TV
Audio: Pioneer VSX-819HK & S-HS 100 5.1 Speakers
Server: HP Compaq Pro 6300, 4GB RAM, 8.75TB, Bodhi Linux 5.x, NFS, MySQL
Reply
#6
(2018-04-22, 01:20)speedwell68 Wrote: Is this a dedicated Kodi device or are you using it for something else?
 Dedicated.
Need help programming a Streamzap remote?
Reply
#7
Why not use LibreELEC?  You can set the time to wait for the network in the LibreELEC settings.  I had this issue with my Raspberry Pi Model Bs.
HTPCs: 2 x Chromecast with Google TV
Audio: Pioneer VSX-819HK & S-HS 100 5.1 Speakers
Server: HP Compaq Pro 6300, 4GB RAM, 8.75TB, Bodhi Linux 5.x, NFS, MySQL
Reply
#8
(2018-04-22, 15:32)speedwell68 Wrote: Why not use LibreELEC?  You can set the time to wait for the network in the LibreELEC settings.  I had this issue with my Raspberry Pi Model Bs.
 I prefer Arch ARM.  The solution I outlined above works as expected (updated arch wiki.  Just wondering if there is another way for users of systemd.
Need help programming a Streamzap remote?
Reply
#9
(2018-04-21, 16:05)graysky Wrote: Seems kind of hackish... you guys have any other thoughts?  Thanks! 
 I don't think this is hackish, this seems to be the proper systemd-way.
 I can't think of another way atm.
 I use the same approach but for wired eth (without changing systemd-networkd-wait-online.service) because I need the network and nfs os mount up and running before kodi starts
Reply
#10
The correct way is to use a systemd dropin.
This allows you to only override changes you need and therefore track changes upstream more easily
Reply
#11
(2018-04-22, 23:46)Sam.Nazarko Wrote: The correct way is to use a systemd dropin.
This allows you to only override changes you need and therefore track changes upstream more easily
 Example?
Need help programming a Streamzap remote?
Reply
#12
See https://github.com/osmc/osmc/blob/master...local.conf
Reply
#13
(2018-04-23, 18:51)Sam.Nazarko Wrote: See https://github.com/osmc/osmc/blob/master...local.conf
 Thank you for the link.  I read-up on 'systemd drop-in' files which I think is what you're describing.  Edited the wiki again.
Need help programming a Streamzap remote?
Reply

Logout Mark Read Team Forum Stats Members Help
Included kodi.service starts before network is ready on Raspberry Pi 3B+/wireless0