Comment 3 for bug 1823098

Revision history for this message
Jeremy Chadwick (koitsu) wrote :

This is still a problem, even as of focal. I ran into this today and was shocked/surprised to find ntpq -p kept showing the NTP server set in option 42 (DHCP server options), rather than what was hard-coded into /etc/ntp.conf. I absolutely had this working a few days prior! Things broke when the DHCP client on the system renegotiated its lease.

The problem, in the case of the systemd unit, is that the systemd unit uses ExecStart=/usr/lib/ntp/ntp-systemd-wrapper. That wrapper is a shell script that contains:

if [ -e /run/ntp.conf.dhcp ]; then
        NTPD_OPTS="$NTPD_OPTS -c /run/ntp.conf.dhcp"
fi

What populates this file is /etc/dhcp/dhclient-exit-hooks.d/ntp, which runs after DHCP client exits (so on a renew, refresh, etc.). This file is provided by the ntp package itself (per dpkg -S). There doesn't seem to be a way to short-circuit the logic in the file via any kind of override, nor in the wrapper mentioned above.

This kind of problem is exactly what happens when people try to make software "smart", rather than just leaving things alone and letting sysadmins configure things properly.