[systemd-devel] systemd-timesyncd dies on one machine but runs okay on another
Manuel Wagesreither
ManWag at FastMail.FM
Tue Sep 4 09:24:00 UTC 2018
Am Mo, 3. Sep 2018, um 16:47, schrieb Mantas Mikulėnas:
> On Mon, Sep 3, 2018 at 3:41 PM Manuel Wagesreither
> <ManWag at fastmail.fm> wrote:>> Hallo all!
>>
>> I'm working on an embedded project consisting of an host and
>> numerous virtual machines and am facing problems related to time
>> management. systemd-timesyncd dies on one machine (HOST), but runs
>> okay on another (VM2) with identical config.>>
>> The project setup is as follows:
>>
>> HOST: Runs a (heavily) modified Debian with systemd, retrieves time
>> via NTP from VM1 using systemd-timesyncd.>> * VM1: Runs openwrt and serves time via NTP using chrony
>> * VM2: Runs a (heavily) modified Debian with SELINUX and systemd,
>> retrieves time via NTP from VM1 using systemd-timesyncd>> * VM3-?: Some other VMs which seem to run fine
>>
>> The symptoms are as follows:
>>
>> HOST: `systemd-timesyncd.service` is reported as inactive (dead). A
>> time update (adjusting the time by 2 days) took place. Then, after
>> 5min, the service died. (It always seems to die 5-15min after a time
>> update.)>> ```
>> root at HOST:/var/log# systemctl status systemd-timesyncd
>> ● systemd-timesyncd.service - Network Time Synchronization
>> Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service;
>> enabled; vendor preset: enabled)>> Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
>> └─disable-with-time-daemon.conf
>> Active: inactive (dead) since Wed 2018-09-05 07:30:02 CEST; 1 day
>> 17h left>> Docs: man:systemd-timesyncd.service(8)
>> Process: 4724 ExecStart=/lib/systemd/systemd-timesyncd
>> (code=exited, status=0/SUCCESS)>> Main PID: 4724 (code=exited, status=0/SUCCESS)
>> Status: "Idle."
>>
>> Sep 03 11:51:58 HOST systemd[1]: Starting Network Time
>> Synchronization...>> Sep 03 11:51:58 HOST systemd[1]: Started Network Time
>> Synchronization.>> Sep 05 07:25:31 HOST systemd-timesyncd[4724]: Synchronized to time
>> server 192.168.253.1:123 (192.168.253.1).>> Sep 05 07:30:02 HOST systemd[1]: Stopping Network Time
>> Synchronization...>> Sep 05 07:30:02 HOST systemd[1]: Stopped Network Time
>> Synchronization.>> ```
>
> Looks like a normal exit, though. What systemd version is this? For
> v217 or later I'd expect to see _Status: "Shutting down"_...>
> Try starting it with [Service] Environment="SYSTEMD_LOG_LEVEL=debug"
> to see more details.
With "normal exit" you mean `systemctl stop systemd-timesync`, I
suppose? Hmm... I did not invoke this command.
I am using systemd 232.
And, by the way, may I ask where the "Status" field of `systemctl status
systemd-timesyncd` is coming from? Is the content of this field returned
by the particular unit or from systemd?
I activated verbose logging as per your suggestion, but the output
doesn't yield any additional information:```
root at HOST:~# systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/run/systemd/system/systemd-timesyncd.service;
enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: inactive (dead) since Wed 2018-09-05 23:30:01 CEST; 8h ago
Docs: man:systemd-timesyncd.service(8)
Process: 15355 ExecStart=/lib/systemd/systemd-timesyncd (code=exited,
status=0/SUCCESS)Main PID: 15355 (code=exited, status=0/SUCCESS)
Status: "Idle."
Sep 05 23:29:57 HOST systemd-timesyncd[15355]: poll interval: 32
Sep 05 23:29:57 HOST systemd-timesyncd[15355]: adjust (jump): -
16.125 secSep 05 23:29:41 HOST systemd-timesyncd[15355]: status : 8192
syncSep 05 23:29:41 HOST systemd-timesyncd[15355]: time now :
1536182981.380Sep 05 23:29:41 HOST systemd-timesyncd[15355]: constant : 2
Sep 05 23:29:41 HOST systemd-timesyncd[15355]: offset :
+0.000 secSep 05 23:29:41 HOST systemd-timesyncd[15355]: freq offset : -
2177702 (-33 ppm)Sep 05 23:29:41 HOST systemd-timesyncd[15355]:
interval/delta/delay/jitter/drift 32s/-16.125s/0.001s/0.001s/-33ppmSep 05 23:30:01 HOST systemd[1]: Stopping Network Time
Synchronization...Sep 05 23:30:01 HOST systemd[1]: Stopped Network Time Synchronization.
```
Also, `timedatectl set-ntp yes` doesn't seem to have any effect either.
This is the output while systemd-timesyncd was up and running:```
root at HOST:~# timedatectl set-ntp yes
root at HOST:~# timedatectl
Local time: Wed 2018-09-05 23:49:51 CEST
Universal time: Wed 2018-09-05 21:49:51 UTC
RTC time: Thu 2018-09-06 06:48:25
Time zone: Europe/Berlin (CEST, +0200)
Network time on: yes
NTP synchronized: no
RTC in local TZ: no
```
>>
>> systemd-timesyncd configuration for both HOST and VM2
>> ```
>> root at HOST, VM2:/var/log# cat /lib/systemd/system/systemd-
>> networkd.service>
> That's not timesyncd...
My bad.
```
root at HOST, VM2:~# cat /lib/systemd/system/systemd-timesyncd.service
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Network Time Synchronization
Documentation=man:systemd-timesyncd.service(8)
ConditionCapability=CAP_SYS_TIME
ConditionVirtualization=!container
DefaultDependencies=no
RequiresMountsFor=/var/lib/systemd/clock
After=systemd-remount-fs.service systemd-tmpfiles-setup.service systemd-
sysusers.serviceBefore=time-sync.target sysinit.target shutdown.target
Conflicts=shutdown.target
Wants=time-sync.target
[Service]
Type=notify
Restart=always
RestartSec=0
ExecStart=/lib/systemd/systemd-timesyncd
WatchdogSec=3min
CapabilityBoundingSet=CAP_SYS_TIME CAP_SETUID CAP_SETGID CAP_SETPCAP
CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNERPrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
ProtectHome=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
SystemCallFilter=~@cpu-emulation @debug @keyring @module @mount
@obsolete @raw-io
[Install]
WantedBy=sysinit.target
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180904/73e71c42/attachment-0001.html>
More information about the systemd-devel
mailing list