From: Àngel Català on
I have installed Debian 4.0 Etch r3 i386 in my laptop and I have a
strange problem with clock setting with NTP that I can't solve by my self.

I use NTP to sync clock, and I think NTP configuration is well done,
even time zones too.

When I boot my laptop, my clock is always +2 hour over my current time.
My ntpd is running, but when I type ntpq -p I get "No association ID's
returned" message.

So I restart ntpd and after a while I get my clock synchronized again,
so I understand that my configuration is OK, but I can't understand why
it does not work at boot time and it does after restart daemon manually.

By the way, after this, I can type ntpq -q and now I get the list of NTP
servers I have configured and its running data.

I will apreciate any help with this problem. If you need some of my
configuration files or any other info, please ask for them.

Many thanks.
From: Dave Uhring on
On Sat, 05 Apr 2008 13:03:00 +0200, Àngel Català wrote:

> I use NTP to sync clock, and I think NTP configuration is well done,
> even time zones too.

NTP has nothing to do with time zones; it is always UTC.

> When I boot my laptop, my clock is always +2 hour over my current time.
> My ntpd is running, but when I type ntpq -p I get "No association ID's
> returned" message.

If your CMOS clock is set to CET, which it would be for your locale and
you have chosen UTC as your local time then that is expected.

Copy /usr/share/zoneinfo/Europe/Madrid to /etc/localtime and see if that
helps.
From: Shadow_7 on
> So I restart ntpd and after a while I get my clock synchronized again,
> so I understand that my configuration is OK, but I can't understand why
> it does not work at boot time and it does after restart daemon manually.

Perhaps ntpd is launching before the network is up. I've had similar
problems with udev running too early if you disable other things like
dbus, autofs, and the likes. Adjust the /etc/rc?.d/S## for ntpd and see
if that helps. Higher numbers run later in the boot sequence.

There's other things for timezone / date stuff as well. So maybe that's
not quite right either. tzconfig, locales, /etc/timezone, /etc/localtime,
and various other things that need setting up as well. Is the computer
clock set to UTC or localtime? Are you rebooting to windows and it's
adjusting for DST without syncing to a server? Even though you already
adjusted for DST in linux.

I had a similar problem once. Although I didn't sync or run ntpd at all.
But every time my computer crashed, or otherwise shutdown without the use
of shutdown(power outage), the clock got bumped four hours. Perhaps your
computer is not shutting down right. All assumptions though as it's not
my computer and I don't know how you have things setup, or not.
From: Àngel Català on
Dave Uhring escribió:
> On Sat, 05 Apr 2008 13:03:00 +0200, Àngel Català wrote:
>
>> I use NTP to sync clock, and I think NTP configuration is well done,
>> even time zones too.
>
> NTP has nothing to do with time zones; it is always UTC.
>
>> When I boot my laptop, my clock is always +2 hour over my current time.
>> My ntpd is running, but when I type ntpq -p I get "No association ID's
>> returned" message.
>
> If your CMOS clock is set to CET, which it would be for your locale and
> you have chosen UTC as your local time then that is expected.
>
> Copy /usr/share/zoneinfo/Europe/Madrid to /etc/localtime and see if that
> helps.

Hi Dave,

I have tryed copying that file to /etc/localtime, but it still is wrong.

In /etc/default/rcS, I have UTC=no (by default). In "Debian GNU/Linux
System Administrator's Manual. Chapter 16 - Time" it can be read: "To
change the computer to use UTC after installation, edit the file
/etc/default/rcS, change the variable UTC to no". I thought if you
wanted use UTC you should set the variable UTC to yes, but it seems on
the other hand.

Thanks for your answer.
From: Àngel Català on
Shadow_7 escribió:
>> So I restart ntpd and after a while I get my clock synchronized again,
>> so I understand that my configuration is OK, but I can't understand why
>> it does not work at boot time and it does after restart daemon manually.
>
> Perhaps ntpd is launching before the network is up. I've had similar
> problems with udev running too early if you disable other things like
> dbus, autofs, and the likes. Adjust the /etc/rc?.d/S## for ntpd and see
> if that helps. Higher numbers run later in the boot sequence.
>
> There's other things for timezone / date stuff as well. So maybe that's
> not quite right either. tzconfig, locales, /etc/timezone, /etc/localtime,
> and various other things that need setting up as well. Is the computer
> clock set to UTC or localtime? Are you rebooting to windows and it's
> adjusting for DST without syncing to a server? Even though you already
> adjusted for DST in linux.
>
> I had a similar problem once. Although I didn't sync or run ntpd at all.
> But every time my computer crashed, or otherwise shutdown without the use
> of shutdown(power outage), the clock got bumped four hours. Perhaps your
> computer is not shutting down right. All assumptions though as it's not
> my computer and I don't know how you have things setup, or not.

Hi,

In /etc/default/rcS, I have UTC=no (by default). In "Debian GNU/Linux
System Administrator's Manual. Chapter 16 - Time" it can be read: "To
change the computer to use UTC after installation, edit the file
/etc/default/rcS, change the variable UTC to no". I thought if you
wanted use UTC you should set the variable UTC to yes, but it seems on
the other hand.

When I boot my laptop in Windows, the clock is OK, but when I boot with
Linux, I get this problem.

My runlevel is 2, so I look at rc2.d. In rc2.d I have S23ntp and after
that: S25bluetooth, S89anacron, S89atd, S89cron, S99acpi-support,
S99rc.local, etc. So ntp is starting quite late in my boot sequence.

Thanks for your answer.