0
Przemysław Sztoch

Replace ntp with chrony

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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....

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0