Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [SOLVED] What ntp/sntp client do people use?
Date: Wed, 11 Dec 2019 17:46:08
Message-Id: ab3ff569-6b51-69fc-f6e2-a6906d77a080@gmail.com
In Reply to: [gentoo-user] [SOLVED] What ntp/sntp client do people use? by Walter Dnes
1 Walter Dnes wrote:
2 > On Tue, Dec 10, 2019 at 11:14:48PM -0600, Dale wrote
3 >> Walter Dnes wrote:
4 >>
5 >>> =======================================================================
6 >>>
7 >>> strip: x86_64-pc-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version
8 >>> /usr/bin/chronyc
9 >>> /usr/sbin/chronyd
10 >>>
11 >> I have no idea what this part is doing.
12 > That is approaching the end of the "emerge chrony" process. I wanted
13 > to show that I've installed chrony.
14 >
15 >>>>>> Installing (1 of 1) net-misc/chrony-3.5-r2::gentoo
16 >>>>>> Recording net-misc/chrony in "world" favorites file...
17 >>>>>> Auto-cleaning packages...
18 >>>>>> No outdated packages were found on your system.
19 >>> * GNU info directory index is up-to-date.
20 >>> [i660][root][~] man chrony
21 >>> No manual entry for chrony
22 >>> [i660][root][~] info chrony
23 >>> info: No menu item 'chrony' in node '(dir)Top'
24 >>> [i660][root][~] emerge --unmerge chrony
25 >>>
26 >>> =======================================================================
27 >> I found the manual here. It was the first hit on google for me.
28 >>
29 >> https://chrony.tuxfamily.org/documentation.html
30 >> Hope that helps.
31 > Thanks. From that webpage...
32 >
33 >> 2.7. Does chronyd have an ntpdate mode?
34 >>
35 >> Yes. With the -q option chronyd will set the system clock once and
36 >> exit. With the -Q option it will print the measured offset without
37 >> setting the clock. If you don't want to use a configuration file,
38 >> NTP servers can be specified on the command line. For example:
39 >>
40 >> # chronyd -q 'pool pool.ntp.org iburst'
41 > So I ran a script 3 times...
42 >
43 > #!/bin/bash
44 > date
45 > chronyd -q 'pool ca.pool.ntp.org iburst'
46 > date
47 >
48 > ...and I got...
49 >
50 > [i660][root][~] ./settime
51 > Wed 11 Dec 2019 12:18:45 PM EST
52 > 2019-12-11T17:18:45Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP +SCFILTER -SIGND +ASYNCDNS -SECHASH -IPV6 -DEBUG)
53 > 2019-12-11T17:18:50Z System clock wrong by 0.574369 seconds (step)
54 > 2019-12-11T17:18:51Z chronyd exiting
55 > Wed 11 Dec 2019 12:18:51 PM EST
56 > [i660][root][~] ./settime
57 > Wed 11 Dec 2019 12:19:06 PM EST
58 > 2019-12-11T17:19:06Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP +SCFILTER -SIGND +ASYNCDNS -SECHASH -IPV6 -DEBUG)
59 > 2019-12-11T17:19:12Z System clock wrong by -0.000421 seconds (step)
60 > 2019-12-11T17:19:12Z chronyd exiting
61 > Wed 11 Dec 2019 12:19:12 PM EST
62 > [i660][root][~] ./settime
63 > Wed 11 Dec 2019 12:19:18 PM EST
64 > 2019-12-11T17:19:18Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP +SCFILTER -SIGND +ASYNCDNS -SECHASH -IPV6 -DEBUG)
65 > 2019-12-11T17:19:23Z System clock wrong by -0.000084 seconds (step)
66 > 2019-12-11T17:19:23Z chronyd exiting
67 > Wed 11 Dec 2019 12:19:23 PM EST
68 >
69 > I'm not totally happy that I have to run it 3 times, but I can do that
70 > in the script. I prefer openrdate's approach where it gets the exact
71 > time once. What's with this "step" fetish?
72 >
73
74
75 As Mick pointed out, it is really intended to be run as a service.  You
76 start it and over time it adjusts the time until it is accurate.  I
77 don't think it is intended to run as a command and then not run again
78 since most clocks drift which is why things like chrony and *date are
79 needed.  It adjusts the time in steps.  It's not a fetish, it's how it
80 works.  When I used ntpdate, it did the same way.  As far as I know, all
81 the programs that set the clocks and keep them from drifting off are
82 done in steps. 
83
84 I don't know how openrdate works but for chrony, set up the config file
85 and then /etc/init.d/chronyd start.  After a bit, you can check to see
86 how close it is.  If things are working well enough, don't forget to add
87 it to a runlevel so that it starts when you boot up.  This is what mine
88 shows and its been running as a service since my last reboot about 13
89 days ago. 
90
91
92 root@fireball / # chronyc sources -v
93 210 Number of sources = 6
94
95   .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
96  / .- Source state '*' = current synced, '+' = combined , '-' = not
97 combined,
98 | /   '?' = unreachable, 'x' = time may be in error, '~' = time too
99 variable.
100 ||                                                 .- xxxx [ yyyy ] +/- zzzz
101 ||      Reachability register (octal) -.           |  xxxx = adjusted
102 offset,
103 ||      Log2(Polling interval) --.      |          |  yyyy = measured
104 offset,
105 ||                                \     |          |  zzzz = estimated
106 error.
107 ||                                 |    |           \
108 MS Name/IP address         Stratum Poll Reach LastRx Last
109 sample              
110 ===============================================================================
111 ^+ triangle.kansas.net           3  10   251   64m    -36us[ -937us]
112 +/-  132ms
113 ^? B1-66ER.matrix.gs             0  10     0     -     +0ns[   +0ns]
114 +/-    0ns
115 ^? eris.kallisti.us              0  10     0     -     +0ns[   +0ns]
116 +/-    0ns
117 ^? 204-62-14-98.static.6syn>     0  10     0     -     +0ns[   +0ns]
118 +/-    0ns
119 ^? 69.50.219.51                  0  10     0     -     +0ns[   +0ns]
120 +/-    0ns
121 ^* bindcat.fhsu.edu              2  10   377   445   -433us[-1298us]
122 +/-   75ms
123 root@fireball / #
124
125
126 It appears that my clock is accurate somewhere between 75 and 132ms.  It
127 also seems I need to update my server list since some are not working. 
128
129 Dale
130
131 :-)  :-) 

Replies

Subject Author
Re: [gentoo-user] [SOLVED] What ntp/sntp client do people use? Walter Dnes <waltdnes@××××××××.org>