Gentoo Archives: gentoo-user

From: Bill Kenworthy <billk@×××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Getting a valid /etc/adjtime while using ntpd ?
Date: Thu, 17 Mar 2016 21:59:49
Message-Id: 56EB28AC.8060900@iinet.net.au
In Reply to: Re: [gentoo-user] Getting a valid /etc/adjtime while using ntpd ? by Alan McKinnon
1 On 18/03/16 05:14, Alan McKinnon wrote:
2 > On 17/03/2016 22:02, Håkon Alstadheim wrote:
3 >> On 03/17/2016 02:03 PM, Bill Kenworthy wrote:
4 >>> On 17/03/16 20:26, Alan McKinnon wrote:
5 >>>> On 17/03/2016 08:50, Håkon Alstadheim wrote:
6 >>>>> I have a server SUPPOSED to be running 24/7, but every once in a while
7 >>>>> during a prolonged absence the box will go down. The Real Time Clock
8 >>>>> will drift, and in the rush to get the box up again I let everything
9 >>>>> boot up automatically and get both wrong time on the main systems, and
10 >>>>> different times on the various systems.
11 >>>>>
12 >>>>> My setup has a main server which does NTP, but with no direct link to
13 >>>>> the outside. Router&firewall /have/ to be booted booted later (dumb
14 >>>>> setup, don't ask), after which I can finally get correct time from NTP.
15 >>>>>
16 >>>>> NTP initiates "11 minute mode", which makes /etc/adjtime useless as far
17 >>>>> as I understand. Anybody have a /correct/ way to account for RTC drift
18 >>>>> on a box running ntpd? Right now I have a ---file in
19 >>>>> /etc/cron.d/time-bad like so:
20 >>>>> * * * * * root adjtimex -S 5 >/dev/null 2>&1 </dev/null
21 >>>>> ---
22 >>>>>
23 >>>>> Combined with an old-fashioned setup for hwclock during boot and
24 >>>>> shutdown. This feels really wrong, and I have no idea what I am doing.
25 >>>>>
26 >>>>> TLDR: Anybody have a /correct/ way to account for RTC drift on a box
27 >>>>> running ntpd?
28 >>>>>
29 >>>>>
30 >>>>
31
32 Have you looked at adjtimex ... its in portage
33
34
35 From the man page ...
36 "For a standalone or intermittently connected machine, where it’s not
37 ossible to run ntpd, you may use adjtimex instead to correct the sys-tem
38 clock for systematic drift.
39
40 There are several ways to estimate the drift rate. If your
41 computer can be connected to the net, you might run ntpd for at least
42 several hours and run "adjtimex --print" to learn what values of tick
43 and freq it settled on. Alternately, you could estimate values using as
44 a reference the CMOS clock (see the --compare and --adjust switches),
45 another host (see --host and --review), or some other source of time
46 (see --watch and --review). You could then add a line to rc.local
47 invoking adjtimex, or configure /etc/init.d/adjtimex or
48 /etc/default/adjtimex, to set those parameters each time you reboot."
49
50 Used it at one time for dialup which approximates your condition.
51
52 BillK

Replies

Subject Author
Re: [gentoo-user] Getting a valid /etc/adjtime while using ntpd ? Bill Kenworthy <billk@×××××××××.au>
Re: [gentoo-user] Getting a valid /etc/adjtime while using ntpd ? "Håkon Alstadheim" <hakon@×××××××××××××××.no>