Cannot set config file in /etc/default/ntp

Bug #1129696 reported by Alexander Garden
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ntp (Debian)
New
Unknown
ntp (Ubuntu)
Won't Fix
Wishlist
Christian Ehrhardt 

Bug Description

Description: Ubuntu 12.04 LTS
Release: 12.04

ntp:
  Installed: 1:4.2.6.p3+dfsg-1ubuntu3.1
  Candidate: 1:4.2.6.p3+dfsg-1ubuntu3.1
  Version table:
 *** 1:4.2.6.p3+dfsg-1ubuntu3.1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:4.2.6.p3+dfsg-1ubuntu3 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
f
I had a need to set a custom config file for ntp. I looked about and found that I could pass a '-c' option and that options for ntp are set in /etc/default/ntp in NTPD_OPTS. So I put it in there: NTPD_OPTS='-g -c /path/to/custom/ntp.conf'. It worked. Until I deployed to another box that was receiving NTP settings via DHCP. On that box, ntpd exited with an error because it had received two config files in its arguments. Not good.

After reading through the init script, I opted to add a new variable to /etc/default/ntp specifically for holding a custom config file. Attached is a patch that will use that value if DHCP has not created its own ntp.conf. If NTP settings were passed via DCHP, then those settings will override the custom config file.

Tags: patch
Revision history for this message
Alexander Garden (tolaythisbodydown) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch for /etc/init.d/ntp" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Changed in ntp (Ubuntu):
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I know it's a long time, but I'm cleaning up old NTP bugs atm.

The patch looks good, this will need another patch with an example to the config file.
Setting triaged since one can start working on it.

Although I'm not sure if this is worth a delta, so if one is starting to work on it maybe we should fix it in Debian right away and pick it up in the next sync.

Changed in ntp (Ubuntu):
status: Confirmed → Triaged
Changed in ntp:
status: Unknown → New
Changed in ntp (Ubuntu):
assignee: nobody → ChristianEhrhardt (paelzer)
Revision history for this message
Robie Basak (racb) wrote :

Thank you Alexander for submitting this patch, and to Christian for catching up on old bugs. I'm reviewing Christian's merge proposal at https://code.launchpad.net/~paelzer/ubuntu/+source/ntp/+git/ntp/+merge/299122 which includes this patch but thought it would be more inclusive to discuss it directly in this bug.

There is a risk in introducing a new configuration variable in a delta in Ubuntu. If Debian don't adopt exactly the same thing, it means that we have to maintain a delta indefinitely in Ubuntu, since to then sync with Debian would mean breaking users on upgrade. In this case, Alexander will set the new NTPD_CONF variable and after a sync, Alexander will upgrade to a version where this silently stops working. Christian said "I'm not sure if this is worth a delta" and for this reason I agree.

Instead, I propose that it doesn't make sense for the system to be configured to request NTP configuration via DHCP and then not use it. So I think a more appropriate solution is to expect users who want to override ntp.conf to also disable NTP-by-DHCP in dhclient's configuration. Then /var/lib/ntp/ntp.conf.dhcp would not exist and this problem wouldn't arise. dhclient packaging should also ensure that the file is deleted when it is no longer relevant. If this is not currently possible, I think a fix should be in dhclient's package to make this easier, rather than in ntp to ignore the supplied configuration.

Alexander said "On that box, ntpd exited with an error because it had received two config files in its arguments. Not good." and I agree. Note though that with Alexander's patch, this can still happen - the patch just provides a workaround at configuration level. My proposal doesn't solve this problem either, I admit; my alternative workaround is to adjust dhclient.

So I'm proposing a "Won't Fix" for ntp in Ubuntu, and to add a task for dhclient if necessary. We can of course take whatever Debian want to do, since then we don't incur a maintenance burden. If Debian wants to add $NTPD_CONF, I have no objection. So thank you Christian for filing this in Debian. But I don't think we should add it in a delta in Ubuntu because of the pain of the divergence from Debian in this case.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

@Robie
thank you for the great explanation.
I agree with you that with these extra details my "I'm not sure" should become a "lets not add delta" for this.

I also like the suggested workaround - FYI here is a good summary of how to actually do that:
=> http://serverfault.com/questions/329596/how-to-override-the-ntp-information-sent-by-dhcp-in-debian

Fortunately with the git commits this can easily be removed from the merge.
Please let men know if you want me to change and push something.

But - waiting for user feedback if we overlook something first.

Revision history for this message
Alexander Garden (tolaythisbodydown) wrote :

Thank you all for working on this.

Removing ntp-servers from the request in dhclient seems like a clean way of avoiding the collision. I am comfortable using that going forward and being able to put '-c mycustom.conf' in NTPD_OPTS.

Revision history for this message
Robie Basak (racb) wrote :

Thanks Alexander. Let's mark this Won't Fix for Ubuntu then.

Changed in ntp (Ubuntu):
status: Triaged → Won't Fix
Mathew Hodson (mhodson)
affects: ntp → ubuntu
Changed in ubuntu:
importance: Unknown → Undecided
no longer affects: ubuntu
Changed in ntp (Debian):
status: Unknown → New
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.