[Bug 1578663] Re: create DHCP exit hook for setting NTP servers through dhclient

Martin Pitt martin.pitt at ubuntu.com
Tue May 17 19:56:10 UTC 2016


I set up DHCP with NTP on the host as described in the test case. With
the xenial-updates systemd, timesyncd still gets the time from
ntp.ubuntu.com. With xenial-proposed packages, timesyncd gets the time
from the (fake) NTP server:

  May 17 21:53:57 autopkgtest systemd-timesyncd[643]: Timed out waiting
for reply from 4.3.2.1:123 (4.3.2.1).

When not giving NTP over DHCP, timesyncd continues to use the default:

  May 17 21:55:48 autopkgtest systemd-timesyncd[357]: Synchronized to
time server 91.189.94.4:123 (ntp.ubuntu.com).


** Description changed:

  Similar to /etc/dhcp/dhclient-exit-hooks.d/ntpdate, we should ship a
  DHCP exit hook for timesyncd to update the timesyncd configuration in
  /run/systemd/timesyncd.conf.d/01-dhclient.conf to set the picked up NTP
  servers, and restart timesyncd.
  
  SRU INFORMATION
  ===============
  Rationale: This is a regression compared to trusty where we used ntpdate; /etc/dhcp/dhclient-exit-hooks.d/ntpdate ran ntpdate on the new NTP servers. This causes timesyncd to always try and talk to the disto configured server (ntp.ubuntu.com) which might be disallowed by firewall rules or other networking policy. Thus machines in such an environment never get a correct time sync even when they get a local NTP server advertised over DHCP (unless they use systemd-networkd, which is not done by default in Xenial).
  
  Test case:
- - Set up a DHCP server that includes NTP information. For example, you can set LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf in /etc/default/lxc-net, and create /etc/lxc/dnsmasq.conf with "dhcp-option=option:ntp-server,4.3.2.1", and then run QEMU on lxcbr0 instead of the builtin network.
+ - Set up a DHCP server that includes NTP information. For example, you can set LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf in /etc/default/lxc-net, and create /etc/lxc/dnsmasq.conf with "dhcp-option=option:ntp-server,4.3.2.1", restart lxc-net, and then run QEMU on lxcbr0 instead of the builtin network.
  - In the client machine, disconnect and reconnect the network (e. g. "sudo ifdown ens3; sudo ifup ens3").
  - Check in "systemctl status systemd-timesyncd" that timesyncd tries to sync with the given NTP server (for the bogus 4.3.2.1 it will fail, but the point is that it did try).
  
  Regression potential: A broken dhclient-exit-hooks.d has the potential
  to break subsequent hooks. dhclient-scripts runs the hooks without "set
  -e", but syntax errors can still cause damage. Thus it should be
  verified that later hooks (e. g. /etc/dhcp/dhclient-exit-hooks.d
  /zzz_avahi-autoipd) still run. Beyond that there is little potential for
  regression as

** Tags removed: verification-needed
** Tags added: verification-done

-- 
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/1578663

Title:
  create DHCP exit hook for setting NTP servers through dhclient

Status in systemd package in Ubuntu:
  Fix Released
Status in systemd source package in Xenial:
  Fix Committed
Status in systemd source package in Yakkety:
  Fix Released

Bug description:
  Similar to /etc/dhcp/dhclient-exit-hooks.d/ntpdate, we should ship a
  DHCP exit hook for timesyncd to update the timesyncd configuration in
  /run/systemd/timesyncd.conf.d/01-dhclient.conf to set the picked up
  NTP servers, and restart timesyncd.

  SRU INFORMATION
  ===============
  Rationale: This is a regression compared to trusty where we used ntpdate; /etc/dhcp/dhclient-exit-hooks.d/ntpdate ran ntpdate on the new NTP servers. This causes timesyncd to always try and talk to the disto configured server (ntp.ubuntu.com) which might be disallowed by firewall rules or other networking policy. Thus machines in such an environment never get a correct time sync even when they get a local NTP server advertised over DHCP (unless they use systemd-networkd, which is not done by default in Xenial).

  Test case:
  - Set up a DHCP server that includes NTP information. For example, you can set LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf in /etc/default/lxc-net, and create /etc/lxc/dnsmasq.conf with "dhcp-option=option:ntp-server,4.3.2.1", restart lxc-net, and then run QEMU on lxcbr0 instead of the builtin network.
  - In the client machine, disconnect and reconnect the network (e. g. "sudo ifdown ens3; sudo ifup ens3").
  - Check in "systemctl status systemd-timesyncd" that timesyncd tries to sync with the given NTP server (for the bogus 4.3.2.1 it will fail, but the point is that it did try).

  Regression potential: A broken dhclient-exit-hooks.d has the potential
  to break subsequent hooks. dhclient-scripts runs the hooks without
  "set -e", but syntax errors can still cause damage. Thus it should be
  verified that later hooks (e. g. /etc/dhcp/dhclient-exit-hooks.d
  /zzz_avahi-autoipd) still run. Beyond that there is little potential
  for regression as

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1578663/+subscriptions



More information about the foundations-bugs mailing list