Re: Restarting the chrony service brakes chrony

Jan Mikkelsen <janm-lSjQ/[email protected]>
Newsgroups gmane.comp.time.chrony.user
Message-ID <[email protected]>
Hi,

I have tested stopping chronyd using SIGTERM and then restarting many times. There has never been a need to do anything other than start chronyd.

Differences: chronyd 4.2 on FreeBSD, with daemontools supervise as the process monitor.

I wonder if removing the “-r” option to chronyd makes a difference.

Regards,

Jan M.


> On 6 Apr 2022, at 13:31, Uwe Fechner <[email protected]> wrote:
> 
> Dear all,
> a colleague of mine found a fix. I changed the start stop script to look like this:
> 
> #!/bin/sh
> #
> # Start chrony
> 
> [ -r /etc/default/chrony ] && . /etc/default/chrony
> 
> case "$1" in
>   start)
>         printf "Starting chrony: "
>         chronyd $CHRONY_ARGS && echo "OK" || echo "FAIL"
>         printf "Setting chrony online: "
>         chronyc online
>         ;;
>   stop)
>         printf "Stopping chrony: "
>         killall chronyd && echo "OK" || echo "FAIL"
>         ;;
>   restart|reload)
>         "$0" stop
>          sleep 1
>         "$0" start
>          ;;
>   *)
>         echo "Usage: $0 {start|stop|restart}"
>         exit 1
> esac
> 
> exit $?
> 
> I would still consider this to be a bug. At least the command "chronyc sources" should print a hint if no source is available like:
> "Did you try: sudo chronyc online"... But OK, you could say its a bug in the start stop script provided by buildroot.
> From: Uwe Fechner <[email protected] <mailto:[email protected]>>
> Sent: Wednesday, April 6, 2022 12:04 PM
> To: [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
> Subject: [chrony-users] Re: Restarting the chrony service brakes chrony
>  
> This email originated from outside of your organization. Please do not click on links or open attachments unless you recognize the sender and know the content is safe.
> 
> This is my configuration:
> 
> Start script:
> 
> [/etc/init.d]$ cat chrony
> #!/bin/sh
> #
> # Start chrony
> 
> [ -r /etc/default/chrony ] && . /etc/default/chrony
> 
> case "$1" in
>   start)
>         printf "Starting chrony: "
>         chronyd $CHRONY_ARGS && echo "OK" || echo "FAIL"
>         ;;
>   stop)
>         printf "Stopping chrony: "
>         killall chronyd && echo "OK" || echo "FAIL"
>         ;;
>   restart|reload)
>         "$0" stop
>          sleep 1
>         "$0" start
>          ;;
>   *)
>         echo "Usage: $0 {start|stop|restart}"
>         exit 1
> esac
> 
> exit $?
> 
> The file /etc/default/chrony:
> [/etc/default]$ cat chrony
> CHRONY_ARGS="-s -r -f /home/user/etc/chrony.conf"
> 
> The file /home/user/etc/chrony.conf:
> [~/etc]$ cat chrony.conf
> pool pool.ntp.org <http://pool.ntp.org/> iburst offline maxdelayratio 2
> 
> driftfile /var/lib/chrony/drift
> makestep 1.0 3
> rtcfile /var/lib/chrony/rtc
> rtconutc
> rtcautotrim 30
> 
> dumpdir /var/run/chrony
> 
> Is it allowed to stop chronyd with "killall chronyd" or is there a better way?
> 
> The system is running on 32 bit ARM and was created with buildroot.
> 
> Any help would be greatly appreciated!
> From: Uwe Fechner
> Sent: Tuesday, April 5, 2022 5:16 PM
> To: [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
> Subject: Restarting the chrony service brakes chrony
>  
> I have a strange problem: When chrony is started after boot all works fine.
> 
> chronyc --version
> chronyc (chrony) version 4.1 (-READLINE +SECHASH +IPV6 -DEBUG)
> 
> After 5 min:
> chronyc sources
> MS Name/IP address         Stratum Poll Reach LastRx Last sample              
> ===============================================================================
> ^- excalibur.prolixium.com <http://excalibur.prolixium.com/>       2   6   377    13  +5513us[+4097us] +/-   98ms
> ^+ gowest.hojmark.net <http://gowest.hojmark.net/>            2   6   371    13  -4181us[-5596us] +/-   59ms
> ^* ntp0.bgwlan.nl <http://ntp0.bgwlan.nl/>                1   6   327    12   -138us[-1553us] +/-   26ms
> ^? cloud.discloud.biz <http://cloud.discloud.biz/>            2   6     3    13  +2145us[ +729us] +/-   26ms
> 
> Now I restart chrony
> sudo service chrony restart
> and I get after 1 min:
> MS Name/IP address         Stratum Poll Reach LastRx Last sample              
> ===============================================================================
> ^? ntp18.kashra-server.com <http://ntp18.kashra-server.com/>       0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? dns02.wsrs.net <http://dns02.wsrs.net/>                0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? time.cloudflare.com <http://time.cloudflare.com/>           0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? ntp1.trans-ix.nl <http://ntp1.trans-ix.nl/>              0   6     0     -     +0ns[   +0ns] +/-    0ns
> 
> And after 2min
> [bmterra@armxl ~]$ chronyc sources
> MS Name/IP address         Stratum Poll Reach LastRx Last sample              
> ===============================================================================
> ^? nts1.time.nl <http://nts1.time.nl/>                  0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? ntp18.kashra-server.com <http://ntp18.kashra-server.com/>       0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? dns02.wsrs.net <http://dns02.wsrs.net/>                0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? time.cloudflare.com <http://time.cloudflare.com/>           0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? docker01.rondie.nl <http://docker01.rondie.nl/>            0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? ntp1.trans-ix.nl <http://ntp1.trans-ix.nl/>              0   6     0     -     +0ns[   +0ns] +/-    0ns
> ^? aardbei.vanderzwet.net <http://aardbei.vanderzwet.net/>        0   6     0     -     +0ns[   +0ns] +/-    0ns
> 
> I mean, I can ping the time servers:
> ping nts1.time.nl <http://nts1.time.nl/>
> PING nts1.time.nl <http://nts1.time.nl/>(nts1.time.nl <http://nts1.time.nl/> (2a00:d78:0:712:94:198:159:11)) 56 data bytes
> 64 bytes from nts1.time.nl <http://nts1.time.nl/> (2a00:d78:0:712:94:198:159:11): icmp_seq=1 ttl=56 time=53.5 ms
> 64 bytes from nts1.time.nl <http://nts1.time.nl/> (2a00:d78:0:712:94:198:159:11): icmp_seq=2 ttl=56 time=36.6 ms
> 64 bytes from nts1.time.nl <http://nts1.time.nl/> (2a00:d78:0:712:94:198:159:11): icmp_seq=3 ttl=56 time=34.8 ms
> 
> --- nts1.time.nl <http://nts1.time.nl/> ping statistics ---
> 3 packets transmitted, 3 received, 0% packet loss, time 5ms
> rtt min/avg/max/mdev = 34.818/41.657/53.519/8.423 ms
> 
> ping ntp18.kashra-server.com <http://ntp18.kashra-server.com/>
> PING ntp18.kashra-server.com <http://ntp18.kashra-server.com/> (188.165.11.86) 56(84) bytes of data.
> 64 bytes from ntp18.kashra-server.com <http://ntp18.kashra-server.com/> (188.165.11.86): icmp_seq=1 ttl=51 time=91.1 ms
> 64 bytes from ntp18.kashra-server.com <http://ntp18.kashra-server.com/> (188.165.11.86): icmp_seq=2 ttl=51 time=76.7 ms
> 
> --- ntp18.kashra-server.com <http://ntp18.kashra-server.com/> ping statistics ---
> 3 packets transmitted, 2 received, 33.3333% packet loss, time 5ms
> rtt min/avg/max/mdev = 76.662/83.883/91.104/7.221 ms
> 
> Any idea why chrony stops to work after a restart of the service?
> 
> Or how to debug that further?
> 
> Uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.