Przemysław Sztoch Posted August 21, 2019 Posted August 21, 2019 In my opinion ntp should be replaced by chrony. Benefits of Chrony include: 1. Faster synchronization requiring only minutes instead of hours to minimize the time and frequency error, which is useful on desktops or systems not running 24 hours a day. 2. Better response to rapid changes in the clock frequency, which is useful for virtual machines that have unstable clocks or for power-saving technologies that don’t keep the clock frequency constant. 3. After the initial synchronization, it never steps the clock so as not to affect applications needing system time to be monotonic. 4. Better stability when dealing with temporary asymmetric delays, for example when the link is saturated by a large download. 5. Periodic polling of servers is not required, so systems with intermittent network connections can still quickly synchronize clocks. I can prepare patch and pull request, but I need initial confirmation.
John Hasler Posted August 21, 2019 Posted August 21, 2019 I second this suggestion. I've been using Chrony for years (I was the initial maintainer of the Debian Chrony package and also made upstream contributions). It's much better suited for these sorts of boards.
John Hasler Posted August 21, 2019 Posted August 21, 2019 I have Chrony running right now on an Espressobin V7 running Armbian. Works out of the box.
sfx2000 Posted August 22, 2019 Posted August 22, 2019 Should be in the upstream repo's... So use apt to purge ntp, and install chrony... chrony is a good solution. Folks might also want to look at ntpsec packages... sfx
Przemysław Sztoch Posted August 22, 2019 Author Posted August 22, 2019 Igor: Can I replace ntp by chrony? Old systems have been untouched. In new system users should use new config in /etc/chrony.
sfx2000 Posted August 25, 2019 Posted August 25, 2019 On 8/22/2019 at 8:07 AM, Przemysław Sztoch said: Can I replace ntp by chrony? See above - yes, you can... Be mindful of systemd-timesyncd - you might want to disable that one if one is running chrony, ntpd, or ntpsec.
Igor Posted August 26, 2019 Posted August 26, 2019 7 hours ago, sfx2000 said: systemd-timesyncd Is disabled by default: [Time] #NTP= #FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org #RootDistanceMaxSec=5 #PollIntervalMinSec=32 #PollIntervalMaxSec=2048
Igor Posted August 26, 2019 Posted August 26, 2019 7 hours ago, sfx2000 said: systemd-timesyncd Is disabled by default: [Time] #NTP= #FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org #RootDistanceMaxSec=5 #PollIntervalMinSec=32 #PollIntervalMaxSec=2048 But chrony starts at boot, sync time and then dies. Is that normal?
sfx2000 Posted August 27, 2019 Posted August 27, 2019 21 hours ago, Igor said: But chrony starts at boot, sync time and then dies. Is that normal? There was something else in systemd that was stepping on ntpd (and likely chrony), ran into this actually on amd64 - look at journalctl....
guidol Posted August 27, 2019 Posted August 27, 2019 On 8/26/2019 at 8:35 AM, Igor said: But chrony starts at boot, sync time and then dies. Is that normal? Hmm here on a NPi Neo2 with armbian stretch 5.2.5-sunxi64 #5.92 chronyd is running after reboot and isnt dying: root@npi-neo2-22(192.168.6.22):~# ps -ef|grep chrony _chrony 864 1 0 19:44 ? 00:00:00 /usr/sbin/chronyd I did "apt purge ntp" /" apt autoremove" / "apt install chrony" and "reboot" I changed my ntp-servers in /etc/chrony/chrony.conf: Spoiler # Welcome to the chrony configuration file. See chrony.conf(5) for more # information about usuable directives. # pool 2.debian.pool.ntp.org iburst # german DCF77 servers in Braunschweig server ptbtime3.ptb.de iburst server ptbtime2.ptb.de iburst server ptbtime1.ptb.de iburst # This directive specify the location of the file containing ID/key pairs for # NTP authentication. keyfile /etc/chrony/chrony.keys # This directive specify the file into which chronyd will store the rate # information. driftfile /var/lib/chrony/chrony.drift # Uncomment the following line to turn logging on. #log tracking measurements statistics # Log files location. logdir /var/log/chrony # Stop bad estimates upsetting machine clock. maxupdateskew 100.0 # This directive tells 'chronyd' to parse the 'adjtime' file to find out if the # real-time clock keeps local time or UTC. It overrides the 'rtconutc' directive. hwclockfile /etc/adjtime # This directive enables kernel synchronisation (every 11 minutes) of the # real-time clock. Note that it can’t be used along with the 'rtcfile' directive. rtcsync # Step the system clock instead of slewing it if the adjustment is larger than # one second, but only in the first three clock updates. makestep 1 3 chronyd should only quit with the -q (quit-option): # chronyd -q 'pool pool.ntp.org iburst'https://chrony.tuxfamily.org/faq.html https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html
gprovost Posted May 7, 2020 Posted May 7, 2020 Actually any reason we didn't just rely on systemd-timesyncd ? I know it only implements SNTP, but should be more than enough for SBC use case. I have nothing against chrony. I was just curious why we didn't consider systemd-timesyncd ;-)
RussianNeuroMancer Posted May 11, 2020 Posted May 11, 2020 I deployed Armbian to NanoPi-M1 couple of weeks ago and noticed that chrony fail to start for some reason, so clocks remain not syncronized. Replacing chrony with systemd-timesyncd solved this.
Tido Posted May 11, 2020 Posted May 11, 2020 3 hours ago, RussianNeuroMancer said: for some reason, did you take a look a the logs?
RussianNeuroMancer Posted May 11, 2020 Posted May 11, 2020 14 hours ago, Tido said: did you take a look a the logs? Sure, tried to good this error too, but didn't found anything useful. Anyway, this error is either reproducible on every other supported board (in this case you can reproduce it easily) or specific to NanoPi-M1 (not supported anymore, so I guess there is no point to dig further?) There is also possibility that error is specific to H3-based or Allwinner-based SBCs, but I can't verify this as I don't have other Allwinner-based boards.
Tido Posted May 12, 2020 Posted May 12, 2020 8 hours ago, RussianNeuroMancer said: didn't found anything useful. So, it didn't even start at boot? What is if, you start Chrony from the command line, does it run stable then?
RussianNeuroMancer Posted May 13, 2020 Posted May 13, 2020 20 hours ago, Tido said: So, it didn't even start at boot? I checked this issue once again today - it start on boot on bionic image, but no longer works after upgrade to focal. Focal image doesn't even boot (no uboot on HDMI, solid green led; I didn't checked serial). Log: May 13 03:04:42 nanopim1 systemd[1]: Starting chrony, an NTP client/server... May 13 03:04:42 nanopim1 chronyd[8395]: chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG) May 13 03:04:42 nanopim1 chronyd[8395]: Frequency 20.659 +/- 0.346 ppm read from /var/lib/chrony/chrony.drift May 13 03:04:43 nanopim1 systemd[1]: chrony.service: New main PID 8395 does not exist or is a zombie. May 13 03:04:43 nanopim1 systemd[1]: chrony.service: Failed with result 'protocol'. May 13 03:04:43 nanopim1 systemd[1]: Failed to start chrony, an NTP client/server. However, manual launch via /usr/lib/systemd/scripts/chronyd-starter.sh (found it in /lib/systemd/system/chrony.service) indeed works fine - chrony start and synchronize time.
Werner Posted May 13, 2020 Posted May 13, 2020 Is there any further output available via journalctl -xe or something?
RussianNeuroMancer Posted May 14, 2020 Posted May 14, 2020 23 hours ago, Werner said: Is there any further output available via journalctl -xe or something? Two lines appear in journalctl -xe after every attempt to start chrony.service: May 14 03:15:58 nanopim1 chronyd[1334]: chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG) May 14 03:15:58 nanopim1 chronyd[1334]: Frequency 25.014 +/- 0.137 ppm read from /var/lib/chrony/chrony.drift Nothing else besides that and service log chrony.service log I posted yesterday. btw, I noticed that Ubuntu Server 19.10 and 20.04 (I tested generic aarch64 build of Ubuntu Server) ship systemd-timesynd by default, and it sync with ntp.ubuntu.com with default config.
Igor Posted May 14, 2020 Posted May 14, 2020 6 hours ago, RussianNeuroMancer said: I noticed that Ubuntu Server 19.10 and 20.04 (I tested generic aarch64 build of Ubuntu Server) ship systemd-timesynd by default, and it sync with ntp.ubuntu.com with default config. It's good to have a backup but for maintaining reasons we better keep consistency over targets for basic services such as this. Its better to fix chrony than changing it only for Ubuntu 20.04 where it suppose to breaks. 19.10 is EOL so that's not relevant, but we should check this on Debian Sid / Bullseye.
guidol Posted May 14, 2020 Posted May 14, 2020 On 5/12/2020 at 10:19 AM, Tido said: So, it didn't even start at boot? What is if, you start Chrony from the command line, does it run stable then? @RussianNeuroMancer you could try to use the following commands (YES - chronyc - which seems to be chrony-controller):chronyc sources andchronyc tracking see alsohttps://chrony.tuxfamily.org/doc/3.5/chronyc.html chronyc sources MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^- 213.251.52.185 2 6 377 24 -10ms[ -10ms] +/- 98ms ^+ ntp2.home4u.ch 1 6 377 23 -3301us[-3301us] +/- 46ms ^+ 195.21.59.161 2 6 377 21 +6102us[+6102us] +/- 63ms ^* time.cloudflare.com 3 6 377 59 +5630us[+5961us] +/- 33ms chronyc tracking Reference ID : A29FC801 (time.cloudflare.com) Stratum : 4 Ref time (UTC) : Thu May 14 13:21:40 2020 System time : 0.002209240 seconds fast of NTP time Last offset : +0.001954204 seconds RMS offset : 0.007558232 seconds Frequency : 38.654 ppm fast Residual freq : +2.103 ppm Skew : 21.641 ppm Root delay : 0.063654371 seconds Root dispersion : 0.001272534 seconds Update interval : 64.8 seconds Leap status : Normal if that works chronyd(aemon) is running. I did had the problem - here on my FOX G20 Retro system that only v1.25 of chrony(c/d) was available to wheezy And the v1.25 seem to hang because chronyc could not talk to the daemon chronyd So I did download the source from https://github.com/mlichvar/chrony and compiled it via ./configure / make / make install (Didnt work in the first try, because I didnt got a system-time BUT a ntpdate -4 -v ptbtime3.ptb.de did help and afterwards I could compile without an error) Now I call my chronyd from crontab via: @reboot /usr/local/sbin/chronyd chronyd -v shows no real version: chronyd (chrony) version DEVELOPMENT (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER -SIGND +ASYNCDNS -NTS -SECHASH +IPV6 -DEBUG) my NanoPI Neo2 shows under bulleye: chronyd (chrony) version 3.5 (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)[EDIT] Now I have found the "official" git for chrony (the other is a mirror of the author) athttps://git.tuxfamily.org/chrony/chrony.git/ Now I compiled also the v3.5 on my FOX G20https://git.tuxfamily.org/chrony/chrony.git/snapshot/chrony-3.5.tar.gz and got the same version output as on my NanoPi Neo2 with ambian bullseye: chronyd (chrony) version 3.5 (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER -SIGND +ASYNCDNS -SECHASH +IPV6 -DEBUG)
RussianNeuroMancer Posted May 15, 2020 Posted May 15, 2020 13 hours ago, guidol said: @RussianNeuroMancer you could try to use the following commands To achieve what specifically? As you can see in this post launching chrony manually works, what doesn't work is automatic start via systemd service.
Recommended Posts