I am using BBB with a GPS to get system time into NTP using the NMEA string. I’ve done this a few times before.
I have no network connection for ntpd. (It works if I have a network connection but NOT with /dev/gps0 as the only time server)
I map /dev/ttyO1 to /dev/gps0 as a rule in /etc/udev/rules.d
systemd boots as usual and when ntpdate.service executes /dev/gps0 still isn’t ready so NTPd fails and hangs since it can’t find a time server.
I end up manually having to kill ntpd and restart the ntpdate service again
I have managed to force it to work by disabling ntpdate.service and ntpd.service in systemd and instead use CRON to call ntpd 30 seconds after boot with a ‘sleep 30’. A rubbish solution I know!
But it does highlight the fact that NTPd should not run before /dev/gps0 exists if NTP is to work properly.
My questions -
- How do I get ntpdate.service to only run when /dev/gps0 already exists? i.e. wait until /dev/gps0 is streaming NMEA data.
I have tried a number of ‘Before’ and ‘After’ commands in /lib/system/systemd/ntpdate.service with no apparent change.
- Why is the creation of /dev/gps0 taking so long? udev seems to be configuring this rule very slowly. It’s only a serial port mapping so why take 10’s of seconds?
Any help greatly appreciated!