Re: [chrony-users] Re: Restarting the chrony service brakes chrony

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


In you original script you told chrony to go offline. That means it does not
query anything. That is consistant with your experience where none of the
servers are queried. If you got rig of the "offline" it would probably work



William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____ unruh@xxxxxxxxxxxxxx
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/

On Wed, 6 Apr 2022, Uwe Fechner wrote:

[CAUTION: Non-UBC Email] 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 <uwe.fechner@xxxxxxxxxx>
Sent: Wednesday, April 6, 2022 12:04 PM
To: chrony-users@xxxxxxxxxxxxxxxxxxxx <chrony-users@xxxxxxxxxxxxxxxxxxxx>
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 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: chrony-users@xxxxxxxxxxxxxxxxxxxx <chrony-users@xxxxxxxxxxxxxxxxxxxx>
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       2   6   377    13  +5513us[+4097us] +/-   98ms
^+ gowest.hojmark.net            2   6   371    13  -4181us[-5596us] +/-   59ms
^* ntp0.bgwlan.nl                1   6   327    12   -138us[-1553us] +/-   26ms
^? 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       0   6     0     -     +0ns[   +0ns] +/-    0ns
^? dns02.wsrs.net                0   6     0     -     +0ns[   +0ns] +/-    0ns
^? time.cloudflare.com           0   6     0     -     +0ns[   +0ns] +/-    0ns
^? 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                  0   6     0     -     +0ns[   +0ns] +/-    0ns
^? ntp18.kashra-server.com       0   6     0     -     +0ns[   +0ns] +/-    0ns
^? dns02.wsrs.net                0   6     0     -     +0ns[   +0ns] +/-    0ns
^? time.cloudflare.com           0   6     0     -     +0ns[   +0ns] +/-    0ns
^? docker01.rondie.nl            0   6     0     -     +0ns[   +0ns] +/-    0ns
^? ntp1.trans-ix.nl              0   6     0     -     +0ns[   +0ns] +/-    0ns
^? aardbei.vanderzwet.net        0   6     0     -     +0ns[   +0ns] +/-    0ns

I mean, I can ping the time servers:
ping nts1.time.nl PING nts1.time.nl(nts1.time.nl (2a00:d78:0:712:94:198:159:11)) 56 data bytes
64 bytes from 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 (2a00:d78:0:712:94:198:159:11): icmp_seq=2 ttl=56 time=36.6 ms
64 bytes from nts1.time.nl (2a00:d78:0:712:94:198:159:11): icmp_seq=3 ttl=56 time=34.8 ms
--- 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
PING ntp18.kashra-server.com (188.165.11.86) 56(84) bytes of data.
64 bytes from ntp18.kashra-server.com (188.165.11.86): icmp_seq=1 ttl=51 time=91.1 ms
64 bytes from ntp18.kashra-server.com (188.165.11.86): icmp_seq=2 ttl=51 time=76.7 ms
--- 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



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/