You are not logged in.

#1 2018-04-27 17:29:23

rg_arc
Member
Registered: 2011-03-20
Posts: 507

[SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

Typically I haven't had any issues with getting timesyncd to work with ntp but recently I realized my time was off by 30 seconds. So I checked the time difference between my laptop and desktop and realized that timesyncd was working on my laptop and not on my desktop which is why the time was off by 30 seconds.

What makes this a difficult issue is both computers have the exact same network configuration. I use systemd-networkd to connect on both machines and they both haven't had any issues in that regard before.

When I restart the service it will actually connect and sync as expected which is a temporary solution to the problem, however, it doesn't fix the actual issue with it not working upon boot.

I checked the status upon boot and I waited to see if it would eventually connect to the ntp server but it never did and only says "Daemon is running."

I'd like to provide more information but I'm not sure what I need to troubleshoot first to solve the problem.

I'd appreciate any help with this issue.

Last edited by rg_arc (2018-04-28 14:26:15)

Offline

#2 2018-04-27 22:10:42

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 658

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

I found this problem initially on my Raspberry PIs (running Arch ARM) after the recent upgrade of systemd 238.51-1 -> 238.76-1. It is most noticeable on a Raspberry Pi because it does not have a realtime clock (RTC). I raised a systemd bug about it which has since been fixed but the fix is not yet in the Arch packages. See https://github.com/systemd/systemd/issues/8719. Note when I raised that bug I thought the bug only affected systems without a RTC but I later discovered the same problem on an old server of mine (running Arch32 but same 238.76-1 version).

Note the fix for this is a trivial single-file systemd source patch so possibly the Arch devs may want to consider advancing this into the Arch package.

Last edited by bulletmark (2018-04-27 22:23:04)

Offline

#3 2018-04-27 22:35:24

rg_arc
Member
Registered: 2011-03-20
Posts: 507

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

Ah yeah this is useful information but what I don't understand is why this is happening on a normal computer that hasn't had this problem before? It makes sense for other systems.

Offline

#4 2018-04-27 22:58:03

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 658

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

The problem is a bug introduced in the Arch package upgrade of systemd from version 238.51-1 to version 238.76-1 which occurred around 12-April.

Offline

#5 2018-04-27 23:07:18

loqs
Member
Registered: 2014-03-06
Posts: 17,440

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

https://github.com/systemd/systemd-stab … 5dcc81adb5 introduced the issue
you could open a bug report asking for https://github.com/systemd/systemd/comm … a36697530a to be cherry-picked until v239 or it is added to systemd-stable.

Offline

#6 2018-04-28 14:25:48

rg_arc
Member
Registered: 2011-03-20
Posts: 507

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

I can confirm that after installing the git version of systemd this issue is gone. So I believe whenever systemd is updated in the stable repos this bug will be gone.

Offline

#7 2018-04-30 09:42:49

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

I didn't want to compile systemd from the AUR git package, so as a work-around waiting for the next systemd release,
I use a timer to start systemd-timesyncd.service 1min after boot:
cat /etc/systemd/system/systemd-timesyncd.timer

[Unit]
Description=Start time synchronisation (workaround)

[Timer]
OnBootSec=1min

[Install]
WantedBy=timers.target

then:
# systemctl disable systemd-timesyncd.service
# systemctl daemon-reload
# systemctl enable systemd-timesyncd.timer

Last edited by berbae (2018-04-30 09:43:20)

Offline

#8 2018-04-30 09:49:49

ua4000
Member
Registered: 2015-10-14
Posts: 421

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

Maybe you have a look at chrony, in some use-cases it's better than ntp (and the super lightweight systemd-timesyncd of course)

https://wiki.archlinux.org/index.php/Chrony

https://chrony.tuxfamily.org/comparison.html

Offline

#9 2018-04-30 12:11:02

rg_arc
Member
Registered: 2011-03-20
Posts: 507

Re: [SOLVED] Systemd-timesyncd doesn't sync immediately upon boot/reboot

Well I've just decided to deal with it for now, no reason to make exceptions for one bug that can be fixed just by issuing systemctl restart systemd-timesyncd.service whenever needed

Offline

Board footer

Powered by FluxBB