[Bug 1685484] Re: DHCP exit hook for setting systemd-timesyncd NTP servers doesn't work
Balint Reczey
balint.reczey at canonical.com
Thu Oct 11 10:02:05 UTC 2018
** Changed in: systemd (Ubuntu)
Assignee: Balint Reczey (rbalint) => (unassigned)
** Changed in: systemd (Ubuntu)
Importance: Medium => Low
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1685484
Title:
DHCP exit hook for setting systemd-timesyncd NTP servers doesn't work
Status in network-manager package in Ubuntu:
Confirmed
Status in systemd package in Ubuntu:
Confirmed
Status in systemd package in Debian:
New
Bug description:
I think it's regression for
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1578663 in
zesty.
1. NTP servers are send via DHCP and seen by NM:
$ nmcli con show connection1 | grep ntp
DHCP4.OPTION[30]: requested_ntp_servers = 1
DHCP4.OPTION[31]: ntp_servers = 80.50.231.226 217.96.29.26 212.160.106.226
2. timesyncd is using hardcoded default NTP server:
$ systemctl -n 200 status systemd-timesyncd.service
* 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: active (running) since Sat 2017-04-22 13:12:23 CEST; 16min ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 576 (systemd-timesyn)
Status: "Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com)."
Tasks: 2 (limit: 4915)
Memory: 1.5M
CPU: 20ms
CGroup: /system.slice/systemd-timesyncd.service
`-576 /lib/systemd/systemd-timesyncd
Apr 22 13:12:23 slodki systemd[1]: Starting Network Time Synchronization...
Apr 22 13:12:23 slodki systemd[1]: Started Network Time Synchronization.
Apr 22 13:12:53 slodki systemd-timesyncd[576]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
3. There are not other time sync deamons installed:
$ cat /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf
[Unit]
# don't run timesyncd if we have another NTP daemon installed
ConditionFileIsExecutable=!/usr/sbin/ntpd
ConditionFileIsExecutable=!/usr/sbin/openntpd
ConditionFileIsExecutable=!/usr/sbin/chronyd
ConditionFileIsExecutable=!/usr/sbin/VBoxService
$ ls -l /usr/sbin/{ntpd,openntpd,chronyd,VBoxService}
ls: cannot access '/usr/sbin/ntpd': No such file or directory
ls: cannot access '/usr/sbin/openntpd': No such file or directory
ls: cannot access '/usr/sbin/chronyd': No such file or directory
ls: cannot access '/usr/sbin/VBoxService': No such file or directory
4. There is only one default timesyncd.conf file with default values:
$ sudo find / -iname \*timesync\*
/etc/systemd/timesyncd.conf
/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service
/etc/dhcp/dhclient-exit-hooks.d/timesyncd
/usr/share/man/man5/timesyncd.conf.d.5.gz
/usr/share/man/man5/timesyncd.conf.5.gz
/usr/share/man/man8/systemd-timesyncd.8.gz
/usr/share/man/man8/systemd-timesyncd.service.8.gz
/tmp/systemd-private-d029f63116924e99b9fc44caf622e299-systemd-timesyncd.service-6NwdRT
/lib/systemd/systemd-timesyncd
/lib/systemd/system/systemd-timesyncd.service
/lib/systemd/system/systemd-timesyncd.service.d
/var/tmp/systemd-private-d029f63116924e99b9fc44caf622e299-systemd-timesyncd.service-jz0q47
$ cat /etc/systemd/timesyncd.conf
# 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.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.
[Time]
#NTP=
#FallbackNTP=ntp.ubuntu.com
5. DHCP hook installed as /etc/dhcp/dhclient-exit-hooks.d/timesyncd is
not working,
TIMESYNCD_CONF=/run/systemd/timesyncd.conf.d/01-dhclient.conf is not
created.
6. After manually executing steps from hook all works as expected:
$ sudo mkdir -p /run/systemd/timesyncd.conf.d/
$ sudo cat <<EOF >/run/systemd/timesyncd.conf.d/01-dhclient.conf
> [Time]
> NTP=80.50.231.226 217.96.29.26 212.160.106.226
> EOF
$ sudo systemctl try-restart systemd-timesyncd.service
$ sudo systemctl status systemd-timesyncd.service
* 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: active (running) since Sat 2017-04-22 13:47:28 CEST; 2min 6s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 3094 (systemd-timesyn)
Status: "Synchronized to time server 80.50.231.226:123 (80.50.231.226)."
Tasks: 2 (limit: 4915)
Memory: 764.0K
CPU: 19ms
CGroup: /system.slice/systemd-timesyncd.service
`-3094 /lib/systemd/systemd-timesyncd
Apr 22 13:47:27 slodki systemd[1]: Starting Network Time Synchronization...
Apr 22 13:47:28 slodki systemd[1]: Started Network Time Synchronization.
Apr 22 13:47:28 slodki systemd-timesyncd[3094]: Synchronized to time server 80.50.231.226:123 (80.50.231.226).
So hook is not triggered and NTP servers configuration not passed from DHCP/NM to timesyncd.
Kubuntu zesty amd64, systemd 232-21ubuntu3, network-manager 1.4.4-1ubuntu3
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1685484/+subscriptions
More information about the foundations-bugs
mailing list