Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED BUG]: ntpd startup fails after update today (Read 227 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED BUG]: ntpd startup fails after update today

I updated everything on an x86_64 machine today. After restart I find one daemon fails to start properly.

I use runit and ntp-runit looks like
Code: [Select]
#!/bin/sh
# Thanks to replabrobin for the network check!
[ "$(ip route | awk '/^default/{print ($3!="")+($5!="")}')" = "2" ] || exit 1
exec ntpd -g -u ntp:ntp -n >/dev/null 2>&1

It seems like I have new behaviour from the network check.  If I have both eth0 and wlan0 connected then the route awk combo gives two lines of output and the check fails. I suspect that previously a timing difference allowed the guard to succeed ie perhaps eth0 was faster. To accommodate multiple default routes I changed my run command to
Code: [Select]
#!/bin/sh
# Thanks to replabrobin for the network check!
[ "$(ip route | awk '/^default/{if(($3!="")+($5!="")==2){print "2";exit 0;}}')" = "2" ] || exit 1
exec ntpd -g -u ntp:ntp -n >/dev/null 2>&1

the guard exits after the first default that is good.

 

Re: ntpd startup fails after update today

Reply #1
I changed the network check again to be slightly simpler so /etc/runit/sv/ntpd/run now looks like

Code: [Select]
#!/bin/sh
# Thanks to replabrobin for the network check
ip route | awk '/^default/{if($3!=""&&$5!=""){v=1;exit 0}}END{exit v!=1}' || exit 1
exec ntpd -g -u ntp:ntp -n >/dev/null 2>&1