You are not logged in.

#1 2014-06-09 07:25:48

Kotrfa
Member
Registered: 2012-10-25
Posts: 171

[SOLVED]systemd-timesyncd is not syncing time

Quick solution:
1) Check that systemd-networkd is running (if not, start it)
2) If it is running and timesyncd is not syncing, just restart systemd-networkd

more on this in the last post.


Hello,
I tried to replace ntp with systemd-timesyncd. I disabled ntpd, enabled systemd-timesyncd, enabled and set systemd-networkd (I found that it might help) over netctl (which I could uninstall then). It somehow worked for few reboots, but then it stopped. Of course there must be a reason why, but I can't figure out what it could be. Everything looks fine to me, but time is just not syncing and I'm 30 minutes in the past (compared with realtime). It loads saved time (as fake-hwclock does), but then there is no sync.

Here are my logs:

~ $ systemctl status systemd-networkd systemd-timedated systemd-timesyncd

* systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled)
   Active: active (running) since Sun 2014-06-08 16:48:36 CEST; 15h ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 149 (systemd-network)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-networkd.service
           `-149 /usr/lib/systemd/systemd-networkd

Jun 08 16:48:36 smecpi systemd[1]: Starting Network Service...
Jun 08 16:48:36 smecpi systemd-networkd[149]:             eth0: link configured
Jun 08 16:48:36 smecpi systemd[1]: Started Network Service.
Jun 08 16:48:37 smecpi systemd-networkd[149]:             eth0: gained carrier

* systemd-timedated.service - Time & Date Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-timedated.service; static)
   Active: active (running) since Mon 2014-06-09 08:14:05 CEST; 11min ago
     Docs: man:systemd-timedated.service(8)
           man:localtime(5)
           http://www.freedesktop.org/wiki/Software/systemd/timedated
 Main PID: 4520 (systemd-timedat)
   CGroup: /system.slice/systemd-timedated.service
           `-4520 /usr/lib/systemd/systemd-timedated

Jun 09 08:14:05 smecpi systemd[1]: Started Time & Date Service.

* systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
   Active: active (running) since Sun 2014-06-08 16:48:35 CEST; 15h ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 125 (systemd-timesyn)
   CGroup: /system.slice/systemd-timesyncd.service
           `-125 /usr/lib/systemd/systemd-timesyncd

Jan 01 01:00:06 smecpi systemd-timesyncd[125]: System clock time unset or jumped backwards, restoring from recorded timestamp: Sun 2014-06-08 16:48:35 CEST
Jun 08 16:48:35 smecpi systemd[1]: Started Network Time Synchronization.

~ $ timedatectl

      Local time: Mon 2014-06-09 08:29:51 CEST
  Universal time: Mon 2014-06-09 06:29:51 UTC
        RTC time: n/a
       Time zone: Europe/Prague (CEST, +0200)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2014-03-30 01:59:59 CET
                  Sun 2014-03-30 03:00:00 CEST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2014-10-26 02:59:59 CEST
                  Sun 2014-10-26 02:00:00 CET

Any ideas?

Last edited by Kotrfa (2014-06-11 16:30:15)

Offline

#2 2014-06-09 10:27:54

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: [SOLVED]systemd-timesyncd is not syncing time

timesyncd uses networkd to wait for the network to come up; it looks like timesyncd is still waiting for networkd to indicate the network is up.

Do you have IPv6 disabled? Is your network link up (check your journal log)?

Offline

#3 2014-06-09 11:40:55

Kotrfa
Member
Registered: 2012-10-25
Posts: 171

Re: [SOLVED]systemd-timesyncd is not syncing time

I have ipv6 disabled  (ipv6.disable=1 at kernel line).

And if "network link up" means "to be connected", then I am. This device is working as headless server and besides this issue is eveyrthing working fine (I can ssh, ping out/in, get to websites...). And there is nothing interesting in journalctl about network (as far I can grep). I'm using this unit for networkd and it connects fine:

~ $ cat /etc/systemd/network/ethernet_static.network

[Match]
Name=eth0

[Network]
Address=192.168.0.111/24
Gateway=192.168.0.1

When I install ntp and run ntpd -q, it correctly sets the time.

Edit: By the way, after some time, timesyncd shows "idle" without any work done.

* systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
   Active: active (running) since Sun 2014-06-08 16:56:38 CEST; 1min 16s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 494 (systemd-timesyn)
   Status: "Idle."
   CGroup: /system.slice/systemd-timesyncd.service
           `-494 /usr/lib/systemd/systemd-timesyncd

Jun 08 16:56:38 smecpi systemd[1]: Started Network Time Synchronization.

Last edited by Kotrfa (2014-06-09 12:18:32)

Offline

#4 2014-06-09 12:33:28

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: [SOLVED]systemd-timesyncd is not syncing time

That's the exact behaviour I saw when I had IPv6 disabled (which is why I asked).
Running with IPv6 enabled fixed the issue for me.

Offline

#5 2014-06-09 14:53:43

Kotrfa
Member
Registered: 2012-10-25
Posts: 171

Re: [SOLVED]systemd-timesyncd is not syncing time

So I deleted ipv6.disable=1 from kernel line and added ipv6 to /etc/modules. When I run lsmod, I can see that ipv6 is loaded and according to this http://www.cyberciti.biz/faq/check-for- … ux-kernel/ I'm "ipv6 ready". Nevertheless, still same problem - time is not synced. What exactly did you do?

 systemctl status systemd-timesyncd systemd-networkd systemd-timedated.service 
* systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
   Active: active (running) since Sun 2014-06-08 16:48:35 CEST; 4min 38s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 126 (systemd-timesyn)
   CGroup: /system.slice/systemd-timesyncd.service
           `-126 /usr/lib/systemd/systemd-timesyncd

Jan 01 01:00:06 smecpi systemd-timesyncd[126]: System clock time unset or jumped backwards, restoring from recorded timestamp: Sun 2014-06-08 16:48:35 CEST
Jun 08 16:48:35 smecpi systemd[1]: Started Network Time Synchronization.

* systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled)
   Active: active (running) since Sun 2014-06-08 16:48:36 CEST; 4min 37s ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 150 (systemd-network)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-networkd.service
           `-150 /usr/lib/systemd/systemd-networkd

Jun 08 16:48:36 smecpi systemd[1]: Starting Network Service...
Jun 08 16:48:36 smecpi systemd[1]: Started Network Service.
Jun 08 16:48:36 smecpi systemd-networkd[150]:             eth0: link configured
Jun 08 16:48:37 smecpi systemd-networkd[150]:             eth0: gained carrier

* systemd-timedated.service - Time & Date Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-timedated.service; static)
   Active: active (running) since Sun 2014-06-08 16:49:20 CEST; 3min 53s ago
     Docs: man:systemd-timedated.service(8)
           man:localtime(5)
           http://www.freedesktop.org/wiki/Software/systemd/timedated
 Main PID: 240 (systemd-timedat)
   CGroup: /system.slice/systemd-timedated.service
           `-240 /usr/lib/systemd/systemd-timedated

Jun 08 16:49:20 smecpi systemd[1]: Started Time & Date Service.

Last edited by Kotrfa (2014-06-09 14:55:15)

Offline

#6 2014-06-09 17:35:40

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 994

Re: [SOLVED]systemd-timesyncd is not syncing time

Kotrfa wrote:

So I deleted ipv6.disable=1 from kernel line and added ipv6 to /etc/modules. When I run lsmod, I can see that ipv6 is loaded and according to this http://www.cyberciti.biz/faq/check-for- … ux-kernel/ I'm "ipv6 ready". Nevertheless, still same problem - time is not synced. What exactly did you do?

*-ARCH kernels have ipv6 stack compiled-in, so there is no ipv6 module.

If you don't need ipv6, then you did the right thing disabling it via the kernel cmdline. If any general piece of software (systemd included) refuses to work because of this -- it's a bug which needs to be reported and fixed, not worked around.

So, I suggest you bring this up at systemd-devel mailing list.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#7 2014-06-09 17:58:38

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: [SOLVED]systemd-timesyncd is not syncing time

I was disabling IPv6 via sysctl.d; rather than comment out the entries I just removed the file I'd placed in there and rebooted. That's all I needed to do to make timesyncd work.

Offline

#8 2014-06-09 18:18:18

Kotrfa
Member
Registered: 2012-10-25
Posts: 171

Re: [SOLVED]systemd-timesyncd is not syncing time

Ok, thank you for your help. I signed a bug here: https://bugs.freedesktop.org/show_bug.cgi?id=79836 .

Edit:
So here is a little help. timesyncd just waits for "network configuration change". I guess that (somehow) timesyncd is runned after networkd and then waits for change. All you have to do is

systemctl restart systemd-networkd

Here is example and steps to reproduce (after boot up, both networkd and timesyncd are enabled):

~ $ systemctl status systemd-timesyncd systemd-networkd

* systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
   Active: active (running) since Wed 2014-06-11 17:55:50 CEST; 24min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 126 (systemd-timesyn)
   CGroup: /system.slice/systemd-timesyncd.service
           `-126 /usr/lib/systemd/systemd-timesyncd

Jun 01 01:00:06 locsmxp systemd-timesyncd[126]: System clock time unset or jumped backwards, restoring from recorded timestamp:...0 CEST
Jun 11 17:55:50 locsmxp systemd[1]: Started Network Time Synchronization.

* systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled)
   Active: active (running) since Wed 2014-06-11 17:55:51 CEST; 24min ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 150 (systemd-network)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-networkd.service
           `-150 /usr/lib/systemd/systemd-networkd

Jun 11 17:55:51 locsmxp systemd[1]: Started Network Service.
Jun 11 17:55:51 locsmxp systemd-networkd[150]:             eth0: link configured
Jun 11 17:55:52 locsmxp systemd-networkd[150]:             eth0: gained carrier
Hint: Some lines were ellipsized, use -l to show in full.

now restart networkd:

 ~ $ systemctl restart systemd-networkd

and result:
~ $ systemctl status systemd-timesyncd systemd-networkd

* systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
   Active: active (running) since Wed 2014-06-11 17:55:50 CEST; 25min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 126 (systemd-timesyn)
   Status: "Using Time Server 216.239.32.15:123 (time2.google.com)."
   CGroup: /system.slice/systemd-timesyncd.service
           `-126 /usr/lib/systemd/systemd-timesyncd

Jun 01 01:00:06 locsmxp systemd-timesyncd[126]: System clock time unset or jumped backwards, restoring from recorded timestamp:...0 CEST
Jun 11 17:55:50 locsmxp systemd[1]: Started Network Time Synchronization.
Jun 11 18:20:48 locsmxp systemd-timesyncd[126]: Network configuration changed, trying to establish connection.
Jun 11 18:20:48 locsmxp systemd-timesyncd[126]: Network configuration changed, trying to establish connection.
Jun 11 18:20:48 locsmxp systemd-timesyncd[126]: Using NTP server 216.239.32.15:123 (time2.google.com).
Jun 11 18:20:49 locsmxp systemd-timesyncd[126]: interval/delta/delay/jitter/drift 64s/+0.000s/0.000s/0.000s/+0ppm

* systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled)
   Active: active (running) since Wed 2014-06-11 18:20:48 CEST; 5s ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 1129 (systemd-network)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-networkd.service
           `-1129 /usr/lib/systemd/systemd-networkd

Jun 11 18:20:48 locsmxp systemd-networkd[1129]:             eth0: gained carrier
Jun 11 18:20:48 locsmxp systemd[1]: Started Network Service.
Jun 11 18:20:48 locsmxp systemd-networkd[1129]:             eth0: link configured
Hint: Some lines were ellipsized, use -l to show in full.

I solved this issue by adding new service (guide here: https://wiki.archlinux.org/index.php/Sy … rocess.3F) which runs this simple script

#!/usr/bin/bash

sleep 15
systemctl restart systemd-networkd

So workaround...

Last edited by Kotrfa (2014-06-11 16:46:06)

Offline

Board footer

Powered by FluxBB