network-manager not restarting ntp daemon

Bug #267891 reported by tyler
48
This bug affects 8 people
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Binary package hint: network-manager

When requesting ntp servers via dhcp, network manager does not create the file /etc/ntp.conf.dhcp and does not restart the ntp daemon with that file.

I already worked around bug https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/264111, so network-manager requests the correct options from the dhcp server, but fails to update the time server settings.

Tags: pet-bug
Revision history for this message
Alexander Sack (asac) wrote :

how does the ntp update work?

why does ntp it need that .dhcp file?

isn't ntp start/stop/update script hooked into the /etc/network/if*.d/ directories?

Changed in network-manager:
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
tyler (durdon-tyler) wrote :

As far as I understand it, the ntpdate, which sets the system time, is run from the /etc/network/if-up.d/ntpdate script.

The problem is for periodical updates of the system time, the ntpd daemon has to be installed, which uses a config file, which points to the ntp servers to use.

The standard dhclient program does create such a configfile accordingly and restarts the ntp daemon with that, it the ntp-servers option is set.

network manager fails to do that, so only the ntpdate script is run, which at least adjusts the current system time.

Revision history for this message
Alexander Sack (asac) wrote :

latest NM 0.7 fixed a bug that made dhclient not honour /etc/dhcp3/dhclient.conf. Now that is fixed in latest upload. maybe that helps in your case?

Revision history for this message
tyler (durdon-tyler) wrote :

I've testet the behaviour now with the current packages in intrepid, but they still failed to configure ntpd correctly.

They do honour the /etc/dhcp3/dhclient.conf file now.

Revision history for this message
tyler (durdon-tyler) wrote :

I've played with network-manager and dhclient and found out, that when started from network-manager, the scripts in '/etc/dhcp3/dhclient-exit-hooks.d' are not properly executed.
There is also the ntp script located responsible for the creation of said 'ntp.conf.dhcp' file.
I've not tested, if scripts in the '/etc/dhcp3/dhclient-enter-hooks.d' directory are executed.

Revision history for this message
tyler (durdon-tyler) wrote :

I've located the problem now.

When run from the command line, dhclient uses the script in /sbin/dhclient-scripts to execute the scripts located in the '/etc/dhcp3/dhclient-exit-hooks.d' and '/etc/dhcp3/dhclient-enter-hooks.d' directories.

network-manager calls dhclient with the parameter -sf LIBEXECDIR "/nm-dhcp-client.action" (translates to '/usr/lib/NetworkManager/nm-dhcp-client.action'), which does something else and the scripts are not executed.

(source code location: nm-dhcp-dhclient.c:251)

As far as I can see in the code, it is necessary for proper handling in network manager.

It would be nice to have an interface to allow enter and exit hooks for dhclient like it was possible before.

Revision history for this message
Alexander Sack (asac) wrote :

not sure if this is really a NM problem. why can't ntp use the if-up.d hooks as everything else?

Changed in network-manager:
status: Incomplete → Triaged
Revision history for this message
Alexander Sack (asac) wrote :

what kind of file is that .dhcp file? could we create that somehow?

Revision history for this message
Alexander Sack (asac) wrote :

i looked. appears to be just a script setting the new ntp servers. isnt that information in some lease file in /var/lib/dhcp3/*.leases ? could you please check?

Revision history for this message
tyler (durdon-tyler) wrote :

Yes, the information is provided in /var/lib/dhcp3/dhclient.leases

The relevant option is: "option ntp-servers 192.168.1.1;"

With the .dhcp file you are correct, this is a file with a ntpd configuration with the information provided by dhcp.

As to why the ubuntu (and debian for that matter) scripts use this hook, I don't know, but I can imagine there is a certain reason for that. (there are other scripts there too, avahi for example)

@creating the .dhcp file: The current script already creates the file, but by using the information from the dhclinet-exit-hooks. It should be possible to use the information from the lease file with minor changes, but the problem as I see it is, that this should be provided out of the box (because it is confusing if the 2 programs behave differently)

The problem is, that setting the ntp option in dhclient.conf should be honoured by both dhclient from the command line and network-manager.

btw, sorry for the late response, had some problems with my mail setup the last weeks...

Alexander Sack (asac)
Changed in network-manager:
assignee: nobody → asac
Revision history for this message
Sergey V. Udaltsov (sergey-udaltsov) wrote :

Actually, same issue with ntpdate. There is a script /etc/dhcp3/dhclient-enter-hooks.d/ntpdate which is supposed to create /etc/default/ntpdate.dhcp. But since that script is not being called by dhclient (because of the command line supplied by NM), the new configuration file is not created.

Checked in jaunty

Revision history for this message
Raven (larsheide-deactivatedaccount-deactivatedaccount) wrote :

Isn't this a subset of the problems from bug #293139? (Is there no way to make this bug a "sub-"bug of that, or should it be marked a duplicate?)

Revision history for this message
Raven (larsheide-deactivatedaccount-deactivatedaccount) wrote :

There is an aditional snag with /usr/sbin/ntp-debian. If NTPDATE_USE_NTP_CONF is set to "yes" (is so by default), then ntpdate-debian will look for "/etc/ntp.conf.dhcp /etc/ntp.conf /etc/openntpd/ntpd.conf" and ignore an ntpdate.dhcp. If the ntp package is not installed, then none of "/etc/ntp.conf.dhcp /etc/ntp.conf /etc/openntpd/ntpd.conf" will existand the default ubuntu NTP will be used instead of the one configured in ntpdate.dhcp. So I would propose to set NTPDATE_USE_NTP_CONF to "no" by default. After all, both configfiles for ntp and ntpdate would contain the correct NTP Servers (if they are created at all) and therefore use the right time.

Revision history for this message
Raven (larsheide-deactivatedaccount-deactivatedaccount) wrote :

I meant ntpdate-debian

Revision history for this message
KWAndi (lst-hoe01) wrote :

Any progress?
Seems still be the case for Ubuntu 10.04...
No NTP servers are set with DHCP options

Martin Pitt (pitti)
Changed in network-manager (Ubuntu):
assignee: Alexander Sack (asac) → nobody
Revision history for this message
garo (nikolas) wrote :

I'm using 10.10 here.
When i manually run dhclient it searches the ntpservers and restarts ntpd with a config that uses the ntpservers received from the dhcpserver.
But when i use networkmanager it also finds the ntpservers (I can see them in the leases file) but doesn't restart ntpd with these servers.

Revision history for this message
garo (nikolas) wrote :

This does not seem to be an issue when ntp isn't started before (at boottime)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.