You are not logged in.

#1 2012-09-11 10:19:20

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,240

Systemd and time synchronisation? [SOLVED]

Recently I changed permanently to systemd - however I have noticed
that the system clock is out by some minutes just after I have booted
up and see for example:

[mike@lapmike3 ~]$ chronyc tracking
Reference ID    : 178.32.55.58 (gateway.omega.org.uk)
Stratum         : 3
Ref time (UTC)  : Tue Sep 11 10:03:20 2012
System time     : 158.888610840 seconds fast of NTP time
Frequency       : 5.454 ppm fast
Residual freq   : -1.577 ppm
Skew            : 13.260 ppm
Root delay      : 0.062475 seconds
Root dispersion : 0.029119 seconds

I would not mind a second or two out - but 158 seconds is not
acceptable - and if I reboot then the clock is immediately out by the
same amount until it eventually re-syncs after quite a long time (10s
of minutes!)

I thought I would check the hardware clock but :

[root@lapmike3 ~]# hwclock -r
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for
an access method.

I had originally set up chrony which does eventually after some time
get the system clock back in sync - I do have dumponexit in my
/etc/chrony.conf but presume somewhere along the way in the transition
from iniscripts there is a configuration error?

I have in my /etc/adjtime:

0.000000 0 0.000000
0
UTC


I am running KDE - and until the system clock is re-synced it is quite
a bit off - this presumable also means that mail time stamps will be
wrong until the clock resets properly -

I have looked at the chrony and systemd arch wiki entries but I can't
find a way to get this sorted out - can anyone help out?

Thanks

Last edited by mcloaked (2012-09-12 08:51:58)


Mike C

Offline

#2 2012-09-11 10:37:22

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: Systemd and time synchronisation? [SOLVED]

I use the ntp package with systemd and it works well.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#3 2012-09-11 11:57:16

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Systemd and time synchronisation? [SOLVED]

mcloaked wrote:

hwclock: Cannot access the Hardware Clock via any known method.

Don't you have /dev/rtc?

$ ll /dev/rtc*
lrwxrwxrwx 1 root root      4 Sep 11 11:44 /dev/rtc -> rtc0
crw-r--r-- 1 root root 254, 0 Sep 11 11:44 /dev/rtc0

Haven't you tried the --debug option, as hwclock stated to you?

Also worth trying:

strace -e trace=file hwclock -r

Offline

#4 2012-09-11 12:51:20

SS4
Member
From: !Rochford, Essex
Registered: 2010-12-05
Posts: 699

Re: Systemd and time synchronisation? [SOLVED]

I use ntp without any problems too. Even when it's 4.5 years out lol (BIOS issues)


Rauchen verboten

Offline

#5 2012-09-12 08:51:13

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,240

Re: Systemd and time synchronisation? [SOLVED]

brebs wrote:
mcloaked wrote:

hwclock: Cannot access the Hardware Clock via any known method.

Don't you have /dev/rtc?

$ ll /dev/rtc*
lrwxrwxrwx 1 root root      4 Sep 11 11:44 /dev/rtc -> rtc0
crw-r--r-- 1 root root 254, 0 Sep 11 11:44 /dev/rtc0

Haven't you tried the --debug option, as hwclock stated to you?

Also worth trying:

strace -e trace=file hwclock -r

OK I did a lot on this last night - firstly when chronyd is running then hwclock -r won't work - BUT if "systemctl stop chrony" then "hwclock -r" will work fine and if necessary the hardware clock can be set or rewritten using standard cli commands.

Secondly it "is" possible to reset the hardware clock whilst chronyd is running by using chronyc from the command line - once started, then from the chronyc prompt you can reset the hardware clock, but first the chrony password must be given - (i.e. the password, say "mypass" as set into the chrony keys file by using the command "password mypass") then within the chronyc prompt you can use the "trimrtc" command which will write the current system time into the RTC - if chronyd has been running for a while then it will have properly synced the system clock from the ntp servers.

Once this was done then on bootup the system clock was initially set to the (now near correct) hardware clock - and would then re-synchronise against the ntp servers within a few minutes.  I now see a difference of the system clock after synchronisation of around a tenth of a microsecond compared to ntp time - and chronyd should (in principle) periodically rest the hardware clock.

So this is solved.

Last edited by mcloaked (2012-09-12 09:04:08)


Mike C

Offline

#6 2012-09-12 10:05:07

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Systemd and time synchronisation? [SOLVED]

mcloaked wrote:

when chronyd is running then hwclock -r won't work

That's bizarre - works fine for me.

Since hwclock comes from util-linux, what version of util-linux are you running?

Offline

#7 2012-09-12 14:32:41

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,240

Re: Systemd and time synchronisation? [SOLVED]

brebs wrote:
mcloaked wrote:

when chronyd is running then hwclock -r won't work

That's bizarre - works fine for me.

Since hwclock comes from util-linux, what version of util-linux are you running?

Are you running initscripts or systemd?  Might be different in each case?


Mike C

Offline

Board footer

Powered by FluxBB