From cf83c59215d51d0c8e41cc58f0b75d8d09dc0a27 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 6 Dec 2010 12:58:29 +0000 Subject: [PATCH] NTP synchronisation problems --- ...010-12-06-ntp-synchronisation-problems.txt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 ubuntu/2010-12-06-ntp-synchronisation-problems.txt diff --git a/ubuntu/2010-12-06-ntp-synchronisation-problems.txt b/ubuntu/2010-12-06-ntp-synchronisation-problems.txt new file mode 100644 index 00000000..0bba6677 --- /dev/null +++ b/ubuntu/2010-12-06-ntp-synchronisation-problems.txt @@ -0,0 +1,25 @@ +NTP synchronisation problems + +

The Ubuntu Technical Board is currently conducting a review of the top ten Brainstorm issues users have raised about Ubuntu, and Matt asked me to investigate and respond to Idea #25301: Keeping the time accurate over the Internet by default.

+ +

My first reaction was "hey, that's odd - I thought we already did that?". We install the ntpdate package by default (although it's deprecated upstream in favour of other tools, but that shouldn't be important here). ntpdate is run from /etc/network/if-up.d/ntpdate, in other words every time you connect to a network, which should be acceptably frequent for most people, so it really ought to Just Work by default. But this is one of the top ten problems where users have gone to the trouble of proposing solutions on Brainstorm, so it couldn't be that simple. What was going on?

+ +

I brought up a clean virtual machine with a development version of Natty (the current Ubuntu development version, which will eventually become 11.04), and had a look in its logs: it was indeed synchronising its time from ntp.ubuntu.com, and I didn't think anything in that area had changed recently. On the other hand, I had occasionally noticed that my own laptop wasn't always synchronising its time quite right, but I'd put it down to local weirdness as my network isn't always very stable. Maybe this wasn't so local after all?

+ +

So, I started tracing through the scripts to figure out what was going on. It turned out that I had an empty /etc/ntp.conf file on my laptop. The /usr/sbin/ntpdate-debian script assumed that that meant I had a full NTP server installed (I don't), and fetched the list of servers from it; since the file was empty, it ended up synchronising time from no servers, that is, not synchronising at all. I removed the file and all was well.

+ +

That left the question of where that file came from. It didn't seem to be owned by any package; I was pretty sure I hadn't created it by hand either. I had a look through some bug reports, and soon found ntpdate 1:4.2.2.p4+dfsg-1ubuntu2 has a flawed configuration file. It turns out that time-admin (System -> Administration -> Time and Date) creates an empty /etc/ntp.conf file if you press the reload button (tooltip: "Synchronise now"), as part of an attempt to update NTP configuration. Aha!

+ +

Once I knew where the problems were, it was easy to fix them. I've uploaded the following changes, which will be in the 11.04 release:

+ + + +

I've also sent these changes to Debian and GNOME as appropriate.

+ +

There are still a few problems. The "Synchronise now" button doesn't work quite right in general (bug #90524), and if your network doesn't allow time synchronisation from ntp.ubuntu.com then you'll have to change the value of NTPSERVERS in /etc/default/ntpdate. On the whole, though, I think that many fewer people should have this kind of problem in Ubuntu 11.04.

+ +

It's always possible that I missed some other problem that breaks automatic time synchronisation for people. Please do file a bug report if it still doesn't work for you in 11.04, or contact me directly (cjwatson at ubuntu.com).

-- 2.30.2