Search:  
Gentoo Wiki

Chrony

Contents

Introduction to Chrony

Chrony is a program that will keep your computer clock at the proper time. It uses the NTP (Network time protocol) network which is setup to synchronize computers and distribute time references across networks. But where other NTP clients (like xntpd) need a continuously Internet connection (to synchronize at predefined times) Chrony supports intermittent internet connections (like a modem or chello :P). Chrony also keeps track of the computers internal clock error compared to the NTP time to correct the time when the computer isn't connected to the internet (which is also handy even with a continuously connection).
If you want to read more about Chrony please visit the Chrony site or if you want to read a comparison between chrony and other NTP clients visit here. Then if you decided not to run Chrony but want the standard NTP client please visit here.

Installing Chrony

To install Chrony simply type

 emerge -av chrony

If chrony has been masked echo the propper keyword into your keywordlist

 flagedit net-misc/chrony -- +~amd64 #for amd64 architecture
 flagedit net-misc/chrony -- +~x86   #for X86 architecture

OR If you have not installed flagedit, use the manual way :

 echo ">=net-misc/chrony-1.21-r1 ~amd64" >> /etc/portage/package.keywords #for amd64 architecture
 echo ">=net-misc/chrony-1.21-r1 ~x86" >> /etc/portage/package.keywords   #for X86 architecture

Then run installation again

 emerge -av chrony

Configuring Chrony

First copy the example config file to the /etc/chrony directory

 bzcat /usr/share/doc/chrony-*/chrony.conf.example.bz2 > /etc/chrony/chrony.conf

Now open the config file and start reading (it should be self-explanatory... But if you need obscure options or need more info check Chrony site)

 nano -w /etc/chrony/chrony.conf

(Save and exit when done)

For editting the config file here are a few hints :

server pool.ntp.org minpoll 5 maxpoll 10 maxdelay 0.4 offline

Secondly copy the example key file to the /etc/chrony directory

 bzcat /usr/share/doc/chrony-*/chrony.keys.example.bz2 > /etc/chrony/chrony.keys

Now open the key file and add atleast 1 key

 nano -w /etc/chrony/chrony.keys  

(a file with 2 lines would suffice :
1 THIS_SHOULD_LOOK_LIKE_SOME_RANDOM_TYPING
commandkey 1
) (Save and exit when done)

Because there is a bug in the start/stop script open the /etc/init.d/chronyd

 nano -w /etc/init.d/chronyd

Look for the following line

 PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"`

(in the "checkconfig()" function in the "else" part) Replace this line with the following

 PIDFILE=/var/run/chronyd.pid

(Atleast if you didn't change it in the configuration (not very likely))
(Save and exit when done)

Then add chrony to the boot list

 rc-update add chronyd default

If you run a firewall (most likely) make sure the NTP Port (UDP 123) is open (atleast) for the NTP servers you want to connect to.

Starting Chrony

To start Chrony run:

 /etc/init.d/chronyd start

(Note if you have added chrony to the boot list this is an one time exercise)

Finishing Up

That is it ! Now your system should always have the proper time without anymore action from your part. You should check from time to time your log files to make sure it works ok (maybe you need to add or remove NTP servers etc). But for now ... sit back and relax your work is done :P
--DouweQuerty 11:41, 18 September 2006 (UTC)

Retrieved from "http://www.gentoo-wiki.info/Chrony"

Last modified: Sat, 13 Sep 2008 01:40:00 +0000 Hits: 5,409