Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
(woops, those don't work too nice when sent to nn@; apologies for the duplicate.) > Control: unarchive -1 > Control: severity -1 important Tim Connors (2010-10-19): > Because dhcp was once installed on this machine, > /var/lib/ntp/ntp.conf.dhcp exists. > > Ntp uses this regardless, completely ignoring /etc/ntp.conf. > > Is this in any way sane? > > Who generated /var/lib/ntp/ntp.conf.dhcp? Why wasn't it removed when > dhcp did not bind the interface? Why would it completely ignore any > settings in /etc/ntp.conf when using dhcp? Shouldn't it just override > or add to the servers instead of rewriting the entire configuration? So we're still seeing people getting bitten by this on wheezy and jessie systems. Wouldn't it make sense to provide a fix for jessie at last? KiBi. signature.asc Description: Digital signature
Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
I ran into this too but on Ubuntu and filed [1] before noticing this Debian bug. I believe that [2, also attached here] might be a simple yet working solution. It changes the initscript to use /var/lib/ntp/ntp.conf.dhcp only if it is newer than /etc/ntp.conf. This should keep the dhclient hook script working as it always updates the ntp.conf.dhcp file when a NTP server is advertised via DHCP. Regards, Simon 1: https://bugs.launchpad.net/debian/+source/ntp/+bug/1472056 2: https://bugs.launchpad.net/debian/+source/ntp/+bug/1472056/+attachment/4425385/+files/ntp-dont-use-stale-dhcp-conf.patch --- /etc/init.d/ntp.orig 2015-07-06 22:21:33.70136 -0400 +++ /etc/init.d/ntp 2015-07-06 22:55:01.128497327 -0400 @@ -22,7 +22,7 @@ . /etc/default/ntp fi -if [ -e /var/lib/ntp/ntp.conf.dhcp ]; then +if [ /var/lib/ntp/ntp.conf.dhcp -nt /etc/ntp.conf ]; then NTPD_OPTS="$NTPD_OPTS -c /var/lib/ntp/ntp.conf.dhcp" fi
Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
Package: ntp Followup-For: Bug #600661 Control: tags -1 patch Hi, any news here? The patch provided by Russell in 2012 looks sensible enough. I have just been bitten by that problem on a new Jessie installation. Best Regards, Bernhard -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
Tags: patch On Fri, 2012-06-29 at 12:16 +1000, Russell Stuart wrote: > moving /var/lib/ntp/ntp.conf.dhcp > to /var/run/ntp/ntp.conf.dhcp would ensure the problem gets fixed > eventually, as everything in /var/run gets cleaned up on reboot. Attached is a patch that does that. diff -Nur ntp-4.2.6.p5+dfsg.old/debian/changelog ntp-4.2.6.p5+dfsg/debian/changelog --- ntp-4.2.6.p5+dfsg.old/debian/changelog 2012-05-12 19:04:44.0 +1000 +++ ntp-4.2.6.p5+dfsg/debian/changelog 2012-06-29 12:27:21.318022032 +1000 @@ -1,3 +1,10 @@ +ntp (1:4.2.6.p5+dfsg-2.1) unstable; urgency=medium + + * Move /var/lib/ntp/ntp.conf.dhcp to /var/run/ntp/ntp.conf.dhcp +to it gets cleaned up on reboot. (closes: #600661) + + -- Russell Stuart Fri, 29 Jun 2012 12:26:21 +1000 + ntp (1:4.2.6.p5+dfsg-2) unstable; urgency=medium * Re-enable crypto support by pointing openssl libdir to multiarch dir. diff -Nur ntp-4.2.6.p5+dfsg.old/debian/ntpdate-debian ntp-4.2.6.p5+dfsg/debian/ntpdate-debian --- ntp-4.2.6.p5+dfsg.old/debian/ntpdate-debian 2011-11-30 16:11:26.0 +1000 +++ ntp-4.2.6.p5+dfsg/debian/ntpdate-debian 2012-06-29 12:24:09.698744492 +1000 @@ -7,7 +7,7 @@ fi if [ "$NTPDATE_USE_NTP_CONF" = yes ]; then - for f in /var/lib/ntp/ntp.conf.dhcp /etc/ntp.conf /etc/openntpd/ntpd.conf; do + for f in /var/run/ntp/ntp.conf.dhcp /etc/ntp.conf /etc/openntpd/ntpd.conf; do if [ -r "$f" ]; then file=$f break diff -Nur ntp-4.2.6.p5+dfsg.old/debian/ntp.dhcp ntp-4.2.6.p5+dfsg/debian/ntp.dhcp --- ntp-4.2.6.p5+dfsg.old/debian/ntp.dhcp 2009-04-24 01:27:05.0 +1000 +++ ntp-4.2.6.p5+dfsg/debian/ntp.dhcp 2012-06-29 12:23:28.302036423 +1000 @@ -1,5 +1,5 @@ NTP_CONF=/etc/ntp.conf -NTP_DHCP_CONF=/var/lib/ntp/ntp.conf.dhcp +NTP_DHCP_CONF=/var/run/ntp/ntp.conf.dhcp ntp_server_restart() { @@ -43,6 +43,8 @@ sed -r -e '/^ *(server|peer).*$/d' $NTP_CONF ) >>$tmp + mkdir -p ${NTP_DHCP_CONF%/*} + mv $tmp $NTP_DHCP_CONF ntp_server_restart diff -Nur ntp-4.2.6.p5+dfsg.old/debian/ntp.init ntp-4.2.6.p5+dfsg/debian/ntp.init --- ntp-4.2.6.p5+dfsg.old/debian/ntp.init 2009-12-27 03:29:45.0 +1000 +++ ntp-4.2.6.p5+dfsg/debian/ntp.init 2012-06-29 12:25:02.131641325 +1000 @@ -22,8 +22,8 @@ . /etc/default/ntp fi -if [ -e /var/lib/ntp/ntp.conf.dhcp ]; then - NTPD_OPTS="$NTPD_OPTS -c /var/lib/ntp/ntp.conf.dhcp" +if [ -e /var/run/ntp/ntp.conf.dhcp ]; then + NTPD_OPTS="$NTPD_OPTS -c /var/run/ntp/ntp.conf.dhcp" fi diff -Nur ntp-4.2.6.p5+dfsg.old/debian/README.Debian ntp-4.2.6.p5+dfsg/debian/README.Debian --- ntp-4.2.6.p5+dfsg.old/debian/README.Debian 2009-04-24 01:27:05.0 +1000 +++ ntp-4.2.6.p5+dfsg/debian/README.Debian 2012-06-29 12:22:05.092613164 +1000 @@ -28,7 +28,7 @@ If DHCP is used to configure the host, and the DHCP server sends information about NTP servers, then this information will be used automatically. This is done by making a copy of /etc/ntp.conf at -/var/lib/ntp/ntp.conf.dhcp, replacing the server entries with the +/var/run/ntp/ntp.conf.dhcp, replacing the server entries with the information provided by the DHCP server, and restarting the NTP server.
Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
I just got bitten by the same problem on squeeze. In my case I used DHCP when I first commissioned the machine, then swapped to a fixed IP once it was going. I am not sure why /var/lib/ntp/ntp.conf.dhcp wasn't cleaned up, but it's now been there unnoticed for many months across several reboots. Most of those reboots have been caused by power failures. Ideally /etc/init.d/ntp should check if the dhclient that created /var/lib/ntp/ntp.conf.dhcp is still running and remove it if not. If that is too complex simply moving /var/lib/ntp/ntp.conf.dhcp to /var/run/ntp/ntp.conf.dhcp would ensure the problem gets fixed eventually, as everything in /var/run gets cleaned up on reboot. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#600661: [pkg-ntp-maintainers] Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
On Mon, May 28, 2012 at 01:37:20AM +0300, Tero Marttila wrote: > >>Purging /ntp/ntp.conf.dhcp > >>on boot would be a start, but in this case, the server has not been > >>rebooted once since it was installed... > > > >It should actually purge that file on reboot. > > On a fresh VM with Debian Squeeze 6.0.5 installed (netinst + DHCP), > with `apt-get install ntp` such that rebooting gives me a > /var/lib/ntp/ntp.conf.dhcp; > > Editing /etc/network/interfaces to replace the default 'iface eth0 > inet dhcp' with 'iface eth0 inet static' + address/netmask/gateway, > and immediately rebooting, leaves me with a persistent stale > /var/lib/ntp/ntp.conf.dhcp that does not go away. And you didn't kill -9 the dhcp client or something? dhcp is supposed to call /etc/dhcp/dhclient-exit-hooks.d/ntp with STOP or something. > A stale ntp.conf.dhcp that persists across reboots will be > surprising to administrators, and not always that easy to notice > (the NTP servers supplied via DHCP during install may continue to > function for some time before being taken out of service). > > I am unable to find any reference to purging the ntp.conf.dhcp at > boot in Squeeze's /etc or the recent packages.debian.org changelogs? > I do not have a wheezy/sid install available for testing, though. Maybe dhcp calls /etc/dhcp/dhclient-exit-hooks.d/ntp with REBOOT and "$new_ntp_servers" = "$old_ntp_servers", both being empty, and we just return leaving the file instead of cleaning it up? Moving this to the start of the function might fix that: if [ -z "$new_ntp_servers" ]; then ntp_servers_setup_remove return fi Kurt -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#600661: [pkg-ntp-maintainers] Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
On 27/05/12 23:55, Kurt Roeckx wrote: On Sun, May 27, 2012 at 11:15:48PM +0300, Tero Marttila wrote: It would seem that in some scenarios reconfiguring /etc/network/interfaces from dhcp to static after install leaves a stale /var/lib/ntp/ntp.conf.dhcp around? It shouldn't, I do this all the time, never ran into this problem. It's probably because you do something so that the dhcp client doesn't have any chance to tell ntp to stop using that file. Agreed; a successful `ifdown eth0` before reconfiguring the interface will remove the ntp.conf.dhcp. However, it is regrettably easy to forget/omit this step before reconfiguring /etc/network/interfaces. Purging /ntp/ntp.conf.dhcp on boot would be a start, but in this case, the server has not been rebooted once since it was installed... It should actually purge that file on reboot. On a fresh VM with Debian Squeeze 6.0.5 installed (netinst + DHCP), with `apt-get install ntp` such that rebooting gives me a /var/lib/ntp/ntp.conf.dhcp; Editing /etc/network/interfaces to replace the default 'iface eth0 inet dhcp' with 'iface eth0 inet static' + address/netmask/gateway, and immediately rebooting, leaves me with a persistent stale /var/lib/ntp/ntp.conf.dhcp that does not go away. A stale ntp.conf.dhcp that persists across reboots will be surprising to administrators, and not always that easy to notice (the NTP servers supplied via DHCP during install may continue to function for some time before being taken out of service). I am unable to find any reference to purging the ntp.conf.dhcp at boot in Squeeze's /etc or the recent packages.debian.org changelogs? I do not have a wheezy/sid install available for testing, though. -- Tero Marttila -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#600661: [pkg-ntp-maintainers] Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
On Sun, May 27, 2012 at 11:15:48PM +0300, Tero Marttila wrote: > > It would seem that in some scenarios reconfiguring > /etc/network/interfaces from dhcp to static after install leaves a > stale /var/lib/ntp/ntp.conf.dhcp around? It shouldn't, I do this all the time, never ran into this problem. It's probably because you do something so that the dhcp client doesn't have any chance to tell ntp to stop using that file. > Purging /ntp/ntp.conf.dhcp > on boot would be a start, but in this case, the server has not been > rebooted once since it was installed... It should actually purge that file on reboot. Kurt -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
Absolutely. /etc/init.d/ntp should not be unconditionally using a stale /var/lib/ntp/ntp.conf.dhcp if /etc/ntp.conf has been configured manually. At the very least, the init script should support disabling the override via /etc/default/ntp, which is currently not even possible. Was bitten by a 10-minute time skew on our NFS server because of this. Ancient ntp.conf.dhcp from February during server install. ntpd was using obsolete NTP servers which have since been replaced. It would seem that in some scenarios reconfiguring /etc/network/interfaces from dhcp to static after install leaves a stale /var/lib/ntp/ntp.conf.dhcp around? Purging /ntp/ntp.conf.dhcp on boot would be a start, but in this case, the server has not been rebooted once since it was installed... -- Tero Marttila -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
This is quite a nasty bug, as (when combined with #560046) it can easily leave you in a situation where NTP has silently stopped working. The incorrect documentation doesn't help matters. It seems to me that /var/lib/ntp/ntp.conf.dhcp needs to be removed when the DHCP client stops. It looks like there's code in the hook to do that, but it evidently doesn't happen reliably, and should the system crash the file will just get left there. I'd recommend making arrangements for ntp.conf.dhcp to be erased on boot and/or altering it to add DHCP-supplied servers in addition to, rather than in place of, servers that are configured in /etc/ntp.conf. -- William Aoki KD7YAFwa...@umnh.utah.edu5-1924 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#600661: ntp: Uses /var/lib/ntp/ntp.conf.dhcp regardless!?
Package: ntp Version: 1:4.2.6.p2+dfsg-1 Severity: normal Because dhcp was once installed on this machine, /var/lib/ntp/ntp.conf.dhcp exists. Ntp uses this regardless, completely ignoring /etc/ntp.conf. Is this in any way sane? Who generated /var/lib/ntp/ntp.conf.dhcp? Why wasn't it removed when dhcp did not bind the interface? Why would it completely ignore any settings in /etc/ntp.conf when using dhcp? Shouldn't it just override or add to the servers instead of rewriting the entire configuration? -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores) Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages ntp depends on: ii adduser 3.112 add and remove users and groups ii dpkg 1.15.8.5Debian package management system ii libc62.11.2-6Embedded GNU C Library: Shared lib ii libcap2 1:2.19-3support for getting/setting POSIX. ii libedit2 2.11-20080614-2 BSD editline and history libraries ii libopts251:5.10-1.1 automated option processing librar ii libssl0.9.8 0.9.8o-2SSL shared libraries ii lsb-base 3.2-23.1Linux Standard Base 3.2 init scrip ii netbase 4.42Basic TCP/IP networking system Versions of packages ntp recommends: ii perl 5.10.1-14 Larry Wall's Practical Extraction Versions of packages ntp suggests: pn ntp-doc(no description available) -- Configuration Files: /etc/ntp.conf changed: driftfile /var/lib/ntp/ntp.drift statsdir /var/log/ntpstats/ statistics loopstats peerstats clockstats filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable server cbnntp iburst dynamic server 192.231.167.19 iburst dynamic restrict -4 default kod notrap nomodify nopeer noquery restrict -6 default kod notrap nomodify nopeer noquery restrict 127.0.0.1 restrict ::1 -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org