注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Package:Chrony

From Funtoo
Revision as of 02:05, May 30, 2015 by Threesixes (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Chrony

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Accurate System Time (NTP)

It's important that your Funtoo Linux system has an accurate clock. NTP (network time protocol) can ensure your clock is accurate at all time.

The recommended NTP client/server is net-misc/chrony.

root # emerge chrony
   Important

Chrony requires you set an upstream ntp server.

For broadband users:

root # echo "server pool.ntp.org iburst" >> /etc/chrony/chrony.conf

For dial up or slow connections:

root # echo "server pool.ntp.org offline" >> /etc/chrony/chrony.conf

Use something like the following for your /etc/chrony/chrony.conf:

server time.apple.com
maxupdateskew 100
driftfile /etc/chrony/chrony.drift
keyfile /etc/chrony/chrony.keys
commandkey 1
dumponexit
dumpdir /var/log/chrony
initstepslew 10 time.apple.com
logdir /var/log/chrony
log measurements statistics tracking
logchange 0.5
mailonchange me@emailprovider.com 0.5
rtcfile /etc/chrony/chrony.rtc
rtconutc
sched_priority 1
lock_all

Chronyd can then be started immediately by running rc to start all new services:

Set Time

To test chronyd, set the time immediately, & exit:

root # chronyd -q

Service

To start the chronyd service:

root # rc-update add chronyd default
root # rc

Because Funtoo Linux starts network daemons without waiting for an Internet connection to become available, and because chrony will attempt to synchronize the clock over the Internet when it first starts, you must manually configure chronyd to be dependent on whatever method you use to enable your outbound network connectivity. For example, if using dhcpcd, add the following to /etc/conf.d/chronyd:

rc_need=dhcpcd

You should notice a marked improvement in your system clock's accuracy. If your system time was off by a significant amount, chronyd will gradually correct your clock while the system runs.

Hardware Clock

To write your NTP sync time to the hardware at shutdown, and read hw clock at start.

root # echo 'clock_hctosys="YES"' >> /etc/conf.d/hwclock
root # echo 'clock_systohc="YES"' >> /etc/conf.d/hwclock
root # rc-service hwclock restart
root # rc-update add hwclock boot