# ntp-4.1.1b-r3 Broken?

## Darthanubis

To: gentoo-user@gentoo.org

Subject: Re: [gentoo-user] ntpd configuration

Date: Thu, 09 Jan 2003 02:50:10 -0500

Organization: n/a

X-Mailer: Sylpheed version 0.8.8claws (GTK+ 1.2.10; i686-pc-linux-gnu)

On Wed, 08 Jan 2003 11:24:22 -0600

> If you use ntpd to update your time rather than ntpdate (which you

> should if you run a database ... avoids time discontinuity problems),

> then you still need /etc/ntp.conf.

> 

> Your problem below is caused because you didn't read the contents of

> /etc/conf.d/ntpd as you should have  :Smile: 

> 

> # /etc/conf.d/ntpd

> NTPDATE_WARN="y"

> NTPDATE_CMD="ntpd"

> NTPDATE_OPTS=""

> 

> # /etc/ntp.conf

> server timelord.uregina.ca

> server time.nist.gov

> logfile         /var/log/ntpd.log

> driftfile       /var/lib/misc/ntp.drift

> 

> Then when you start ntp

> # /etc/init.d/ntpd start

> 

>  * Initializing clock via ntpd...

> [ ok ]

>  * Starting ntpd...

> [ ok ]

> 

Using this setup, the script starts fine. However the time does not get

updated. The log fills with :

9 Jan 02:31:09 ntpd[13177]: signal_no_reset: signal 17 had flags 4000000

9 Jan 02:31:09 ntpd[13178]: signal_no_reset: signal 17 had flags 4000000

9 Jan 02:31:11 ntpd[13178]: server returns a permission denied error 

At then proceeds to fill the log with : server returns a permission

denied errors.

Ntpdate from CLI still updates the server. I don't know if this is a bug

or not, so I thought I'd run it past you guys first. Here is what my

confs look like:

/etc/conf.d/ntpd is the same as you have advised, 

# Comment this out if you dont want the init script to warn

# about not having ntpdate setup

NTPDATE_WARN="y"

# Command to run to set the clock initially

# if you want to use ntpd to set the clock, change this to 'ntpd'

NTPDATE_CMD="ntpdate"

# Options to pass to the above command

# you might want to change 'someserver' to a valid

# hostname which you can aquire below

NTPDATE_OPTS="-b otc1.psu.edu"

##

# A list of available servers is available here:

# * http://www.eecis.udel.edu/~mills/ntp/clock1.html

# and

# * http://www.eecis.udel.edu/~mills/ntp/clock2.html

##

/etc/ntp.conf:

#restrict default noquery notrust nomodify

#restrict 127.0.0.1

#restrict 192.168.1.0 mask 255.255.255.0

#fudge 127.127.1.0 stratum 3

server otc1.psu.edu

server tock.usno.navy.mil

#server time.nist.gov

driftfile /var/lib/misc/ntp.drift

logfile /var/log/ntpd.log

Those original lines are commented out, as I have no idea what the hell

they mean.

Also /etc/init.d/ntpd stop does not stop all running ntpd processes?!

Before this "update" of ntp all was fine. Whats the deal?

----------

## fidler

I have the same problem with a similar configuration....

----------

## Darthanubis

I knew I could not be the only one. Thanks for confirming that!

Now how do we fix it?

----------

## fidler

Well,  I changed my configuration back and it seems to work just fine....

/etc/conf.d/ntpd 

```

logfile         /var/log/ntpd.log

driftfile       /var/lib/misc/ntp.drift

# Name of the servers ntpd should sync with

# Please respect the access policy as stated by the responsible person.

#server         ntp.example.tld         iburst

##

# A list of available servers is available here:

# * http://www.eecis.udel.edu/~mills/ntp/clock1.html

# and

# * http://www.eecis.udel.edu/~mills/ntp/clock2.html

##

```

/etc/conf.d/ntpd

```

root@pceurp52 conf.d # cat ntpd

# Copyright 1999-2002 Gentoo Technologies, Inc.

# Distributed under the terms of the GNU General Public License v2         

# $Header: /home/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd.confd,v 1.8 2003/01/01 01:27:45 vapier Exp $

# Comment this out if you dont want the init script to warn

# about not having ntpdate setup

# NTPDATE_WARN="y"

# Command to run to set the clock initially

# if you want to use ntpd to set the clock, change this to 'ntpd'

NTPDATE_CMD="ntpdate"

# Options to pass to the above command

# you might want to change 'someserver' to a valid

# hostname which you can aquire below

NTPDATE_OPTS="-b  some.time.server.org"

##

# A list of available servers is available here:

# * http://www.eecis.udel.edu/~mills/ntp/clock1.html

# and

# * http://www.eecis.udel.edu/~mills/ntp/clock2.html

##

```

While it may be true that one needs to use ntpd, ntpdate works just fine.

I did change my time server, however.... (for this post).

----------

## Darthanubis

This is unacceptable as it does not fix the problem. Check your /var/log/ntp.log or ntpd.log to see what is actually happening. Is the time being updated on a regular basis ie. every hour? 9 Jan 02:43:11 ntpd[13178]: 

server returns a permission denied error

 9 Jan 02:43:11 ntpd[13178]: server returns a permission denied error

 9 Jan 02:44:11 ntpd[13178]: server returns a permission denied error

 9 Jan 02:44:11 ntpd[13178]: server returns a permission denied error

 9 Jan 02:45:11 ntpd[13178]: server returns a permission denied error

 9 Jan 02:45:11 ntpd[13178]: server returns a permission denied error

 9 Jan 02:46:11 ntpd[13178]: server returns a permission denied error

 9 Jan 02:46:11 ntpd[13178]: server returns a permission denied error

This is what I get trying to use ntpd.

9 Jan 16:09:45 ntpd[28125]: parent died before we finished, exiting

 9 Jan 16:09:57 ntpd[28183]: signal_no_reset: signal 17 had flags 4000000

 9 Jan 16:12:26 ntpd[28247]: signal_no_reset: signal 17 had flags 4000000

 9 Jan 16:17:58 ntpd[28245]: kernel time discipline status change 41

This is what I get using ntpdate.

Finally, 

20 Dec 19:43:26 ntpd[13149]: time reset 0.158601 s

20 Dec 19:43:26 ntpd[13149]: synchronisation lost

21 Dec 02:31:42 ntpd[13149]: time reset 0.660950 s

21 Dec 02:31:42 ntpd[13149]: synchronisation lost

21 Dec 03:08:12 ntpd[13149]: time reset -0.334943 s

21 Dec 03:08:12 ntpd[13149]: synchronisation lost

21 Dec 15:33:08 ntpd[13149]: synchronisation lost

21 Dec 15:51:20 ntpd[13149]: time reset 2.049580 s

21 Dec 15:51:20 ntpd[13149]: synchronisation lost

25 Dec 16:55:40 ntpd[13149]: synchronisation lost

25 Dec 17:13:50 ntpd[13149]: time reset 2.065477 s

25 Dec 17:13:50 ntpd[13149]: synchronisation lost

25 Dec 18:18:19 ntpd[13149]: time reset 0.667395 s

25 Dec 18:18:19 ntpd[13149]: synchronisation lost

25 Dec 18:46:31 ntpd[13149]: time reset -0.392610 s

25 Dec 18:46:31 ntpd[13149]: synchronisation lost

26 Dec 04:05:19 ntpd[13149]: time reset 0.654001 s

26 Dec 04:05:19 ntpd[13149]: synchronisation lost

26 Dec 04:39:53 ntpd[13149]: time reset -0.293852 s

This is what the log looked like when ntpd was working. Obviously something is wrong.

----------

## SpanKY

 *Quote:*   

> 9 Jan 02:31:11 ntpd[13178]: server returns a permission denied error

 

this is probably because you didnt read/understand the server information that was posted ... it probably only allows certain kind of clients to connect ... at any rate, its the server thats causing that ... find a better one

 *Quote:*   

> Those original lines are commented out, as I have no idea what the hell they mean.

 

ntpd added them for you

 *Quote:*   

> Also /etc/init.d/ntpd stop does not stop all running ntpd processes?!

 

ill look into this one

 *Quote:*   

> Before this "update" of ntp all was fine. Whats the deal?

 

many people complained about the state of ntpd ... they didnt want to run ntpdate on their machine, or they wanted to run a different program, etc...

this release (with the conf.d/ntpd file) allows people to do so

----------

## Darthanubis

[quote="SpanKY"] *Quote:*   

> 9 Jan 02:31:11 ntpd[13178]: server returns a permission denied error

 

this is probably because you didnt read/understand the server information that was posted ... it probably only allows certain kind of clients to connect ... at any rate, its the server thats causing that ... find a better one

Thanks for looking into this, as I and another have filed bug reports on this, as it is an ongoing thread on the gentoo user mailing list.

Also, it aint the server, its the same server I used for months. If it were that simple, I would naturally tried another server if I did not know anything else. I did not think I would have to mention that I tried several servers. :Sad: 

----------

## SpanKY

 *Quote:*   

> Thanks for looking into this, as I and another have filed bug reports on this

 

i know, i'm also known as vapier  :Wink: 

 *Quote:*   

> as it is an ongoing thread on the gentoo user mailing list.

 

if only i received -user all the time

 *Quote:*   

> Also, it aint the server, its the same server I used for months. If it were that simple, I would naturally tried another server if I did not know anything else.

 

odd ... this would be a problem of all the ntpd releases since none of the revision changes has modified the compile process much

----------

## SpanKY

 *Quote:*   

> 
> 
> > # /etc/conf.d/ntpd
> 
> > NTPDATE_WARN="y"
> ...

 

stop will only kill the 1 ntp process it starts ... it will not kill the one run by NTPDATE_CMD ... in this case you should have had -q in the NTPDATE_OPTS variable ...

if you can provide some info on how you got this to happen (aside from the above notes) then i can debug it some more ...

----------

## Darthanubis

To: gentoo-user List <gentoo-user@gentoo.org>

Subject: Re: [gentoo-user] ntpd configuration

Date: Thu, 09 Jan 2003 20:09:19 -0500

User-Agent: Mutt/1.4i

On Thu, Jan 09, 2003 at 05:48:16PM -0600, Thomas T. Veldhouse wrote:

> Oh yeah ---

<snip:description of ntpd woes>

Ah, I see the problem now.  The ntpd rc script will start *both*

NTPDATE_COMMAND *and* ntpd, if you read the source.  So you shouldn't

set NTPDATE_COMMAND to ntpd or else you'll start it twice.

-- 

T.T.

--

gentoo-user@gentoo.org mailing list

This is what another user determined. Thus ntpd cannot be used to update the time as one session of ntpd is using the port. SO it seems the script hhas to be told not to start ntpd? Because when I stop ntpd there is still one session of ntpd still running.

Checking my log, the time oddly seems to be syncing now! Albeit every 3hrs instead of every hour, but thats fine.

I changed nothing from the default. Here is what I have now.

/etc/ntpd.conf:

restrict default noquery notrust nomodify

restrict 127.0.0.1

restrict 192.168.1.0 mask 255.255.255.0

fudge 127.127.1.0 stratum 3

server otc1.psu.edu

server tock.usno.navy.mil

server time.nist.gov

#driftfile /var/lib/misc/ntp.drift

driftfile /etc/drift

logfile /var/log/ntp.log

# Copyright 1999-2002 Gentoo Technologies, Inc.

# Distributed under the terms of the GNU General Public License v2

# $Header: /home/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd.confd,v 1.8 2003/01/01 01:27:45 vapier Exp $

# Comment this out if you dont want the init script to warn

# about not having ntpdate setup

NTPDATE_WARN="y"

# Command to run to set the clock initially

# if you want to use ntpd to set the clock, change this to 'ntpd'

NTPDATE_CMD="ntpdate"

# Options to pass to the above command

# you might want to change 'someserver' to a valid

# hostname which you can aquire below

NTPDATE_OPTS="-b otc1.psu.edu"

##

# A list of available servers is available here:

# * http://www.eecis.udel.edu/~mills/ntp/clock1.html

# and

# * http://www.eecis.udel.edu/~mills/ntp/clock2.html

##

It appears to also work so long as I do not try to use a driftfile in location other than /etc/driftfile. Using driftfile /var/lib/misc/ntp.drift seems to stall the ntpd checking, as the log no longer writes any progress.

Once I used the above configuration, it updated properly every 3hrs. Thats fine, but can you confirm if this version needs the driftfile to be in /etc?

If so thats fine too I guess?

----------

## fidler

My /var/log/ntpd.log looks fine...

```

 9 Jan 15:39:49 ntpd[29127]: frequency initialized 0.000 from /var/lib/misc/ntp.drift

 9 Jan 16:40:29 ntpd[29127]: ntpd exiting on signal 15

10 Jan 08:56:01 ntpd[1540]: frequency initialized 0.000 from /var/lib/misc/ntp.drift

```

Could you try a different server?

----------

## Darthanubis

 *fidler wrote:*   

> My /var/log/ntpd.log looks fine...
> 
> ```
> 
>  9 Jan 15:39:49 ntpd[29127]: frequency initialized 0.000 from /var/lib/misc/ntp.drift
> ...

 

Since your logfille and your driftfile are in the location as my old version of ntp which worked fine, I doubt we are speaking of the same version?

ntp-4.1.1b-r3

----------

## timmy

I'm also having problems with ntp 4.1.1b-r3.

My gateway PC is running gentoo 1.2 and has ntp 4.1.1a installed and successfully synching with my ISP's time server. I have 2 other PCs running gentoo 1.4_rc2 with 4.1.1b-r3. Before these 2 PCs were upgraded, they were also running ntp 4.1.1a and successfully synching with my gateway PC.

Now however, every time these PCs reboot, /etc/ntp.conf is reset to:

```
restrict default noquery notrust nomodify

restrict 127.0.0.1

restrict 192.168.0.0 mask 255.255.255.0

fudge 127.127.1.0 stratum 3

server 127.127.1.0

driftfile /etc/ntp.drift

logfile /var/log/ntp.log
```

I have no idea where this is coming from...  It works fine if I change it back to:

```
server 192.168.0.1

driftfile /etc/ntp.drift

logfile /var/log/ntp.log
```

and restart ntpd.

I can stop and start ntp and ntp.conf stays correct, it gets set to the mad values on every reboot, though.

Tim

----------

## pjp

Moved from Other Things Gentoo.

----------

## jaanv

Found out from the mailinglist that dhcpd rewrites ntp.conf - can be inhibited by passing -Y -N to dhcpcd_eth0 in /etc/conf.d/net.

jaanv

----------

## SpanKY

-r4 is out which should fix/help all the current problems

----------

## Decibels

Well, I am trying to help someone that's time is always off and had the ntp.conf all setup and everything working until now. Great.

Figured out that the ntpdate was the best thing to use since it wasn't up all the time like a server. So removed ntp from /etc/init.d default and configured the  /etc/conf.d/ntpd to use ntpdate and gave it several servers to use from the /etc/ntp.conf file that use to work fine. Seems to be working, set the clock back several hours and updated it fine.

Did notice that ntpd is started backup after boot, but at least it sets the time now instead of complaining. I guess it let's ntpdate do it's thing first. Thanks for the input.

By the way, I know two people that have -r4 and still have the problem. It didn't fix it.

----------

## SpanKY

i really dont see much here to work with ... you need to post more information as to what problems they are having

----------

## Decibels

I thought the problem was pretty well described above so I didn't mention it.

/etc/ntp.conf is overwritten each time apparently by dhcp.  Written everytime reboot:

```
restrict default noquery notrust nomodify

restrict 127.0.0.1

restrict 24.207.208.0 mask 255.255.240.0

fudge 127.127.1.0 stratum 3

server 127.127.1.0

driftfile /etc/ntp.drift

logfile /var/log/ntp.log
```

 What I could find on the net about it seemed to indicate you needed to pass a -N option to dhcpcd to have it not overwrite the ntp.conf file.  I didn't really find any info on exactly how to do that with Gentoo.  I tried several ways and ended up not having eth0 starting. But for my needs I found that I really didn't need anything but ntpdate, since the computer isn't on all the time, time isn't mission critical for me. 

The real bugger is that ntp worked fine for a long time, now it doesn't cause the file gets overwritten each time it boots. I did find one thing that said dhcp does this, saves the original as ntp.conf.sv, then when dhcp shuts down it puts the old .sv file back in place. Which seems kind of silly to replace it then put it back.  What is even stranger is when did this start?  I found out how to setup ntp on the net from a lot of sources (none of them mentioned passing an option to dhcp, so would seem like this is a new issue, but), then when this came up, found a few sources that indicated the -N option needed to be passed to dhcp. So get a little confusing about when and what is happening. At least I'm confused. hehe. Anyway, I found a pleasant enough workaround for my needs, that should not be affected by getting this fixed or not. Though I do believe it needs to have something done.

----------

## SpanKY

 *Decibels wrote:*   

> /etc/ntp.conf is overwritten each time apparently by dhcp.

 

read the info in the ntp.conf file you get when you emerge ntp ... if you want, you can just read the cvs version here:

http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/net-misc/ntp/files/ntp.conf?rev=1.4&content-type=text/vnd.viewcvs-markup

 *Quote:*   

> What I could find on the net about it seemed to indicate you needed to pass a -N option to dhcpcd to have it not overwrite the ntp.conf file.  I didn't really find any info on exactly how to do that with Gentoo.  I tried several ways and ended up not having eth0 starting.

 

read above

i believe that is the only problem you have ...

----------

## Decibels

Thanks, google didn't cough that one up to me.

I have always had that commented out, missed the options part in the

description.

#dhcpcd_eth0="..."

changed to 

dhcpcd_eth0="-Y -N"

*Later: found out it had to be "-YN" and not as above, rebooted after putting ntpd back in default runscript and worked fine, file not overwritten and time set.

I will forward this to my Dad and see if it helps him. I am sure it will work, just don't have time till tomorrow to test it out myself.

Thanks again

Wrote a little tutorial on ntpd and ntpdate at:http://webpages.charter.net/decibelshelp/LinuxHelp_NTP.html#ntp

----------

## DancesWithWords

Decibels,

Your mini-how-to was quite help full.  Just got one question and that is pertaining to rebooting with a laptop, which is more common then with servers and desktops.  I"ve heard that ntpdate can be used to get the correction time for the initial contact and the ntpd can be used after that to keep things accurate.

Have you heard of this and would you know how this would be configured?  I understand that for this to work ntpdate must run before ntpd?  If ntpdate runs the init.d first, does the script also terminate the program after the correct time had been received?

Thanks for you help.

--

DancesWithWords

----------

## SpanKY

 *Decibels wrote:*   

> Wrote a little tutorial on ntpd and ntpdate at:http://webpages.charter.net/decibelshelp/LinuxHelp_NTP.html#ntp

 

you should update it for 4.1.2  :Smile: 

things are very different but imo, a lot easier

----------

## Decibels

Hmmm, had to go to portage folder to find it.  Update world not showing it as update candidate, but apparently not masked cause can install it without ~x86.  Regenworld didn't change anything. Will look into it.

That did remind me that I needed to add another way to use ntpdate with /etc/local.start if your time is rarely off like mine. So did get that added. Thanks.

----------

## Mnemia

Prior to the 4.1.2 build, I had to comment out the entire /etc/conf.d/ntpd file as the settings in it were wrong if you use ntpd and not ntpdate. I commented it all to prevent the init script from starting ntpd twice.

What has changed in the new 4.1.2 version? Will that behavior be fixed now if I emerge it? I don't want to use ntpdate at all since my client machines are on all the time and ntpdate messes up (last time I checked) the measurement of the accuracy of your local clock.

----------

## SpanKY

 *Mnemia wrote:*   

> Prior to the 4.1.2 build, I had to comment out the entire /etc/conf.d/ntpd file as the settings in it were wrong if you use ntpd and not ntpdate.

 

actually they werent, you just had to set NTPDATE_WARN="n" and leave the other NTPDATE vars commented out and it would run ntpdate before running ntpd ...

if you wanted to use ntpdate functionality of ntpd, then you could, that was the point of allowing ppl to specify the command

 *Quote:*   

> I commented it all to prevent the init script from starting ntpd twice.

 

it only ran it twice if you told it to

 *Quote:*   

> What has changed in the new 4.1.2 version?

 

the init.d script has been split (dunno why i didnt do it in the first place ...)

ntp-client for ppl (like me) who just want the client and ntpd for ppl (like you i guess) who just want the ntp daemon

----------

## Mnemia

OK, thanks a lot for clarifying that. I was mostly just using my init file completely commented because it worked fine like that for ntpd.

I'll check out the new version - sounds like you made some good changes to it.

----------

## DancesWithWords

 *SpanKY wrote:*   

>  *Decibels wrote:*   Wrote a little tutorial on ntpd and ntpdate at:http://webpages.charter.net/decibelshelp/LinuxHelp_NTP.html#ntp 
> 
> you should update it for 4.1.2 
> 
> things are very different but imo, a lot easier

 

So I followed how-to and have done removal of ntpd "so it doesn't start before ntpdate: rc-update del ntpd default"

Now a bit confused from here... at this point neither ntpd or ntpdate start at boot up, even with the changes specified previously in the how-to?

You see my IBM T/P 600E just started keeping really, really bad time.  As an amateur astronomer I need accurate time and in the field I don't have access to my network  :Wink:   I'm not super obsessive about time, I just need it to be close.

----------

## Decibels

Did you read it with the new tutorial? I haven't finished the ntpd one yet. But the client is up. I have big orange headers showing which tutorial to use for which version.

Seems you may have skipped this part:

```
 Installing NTP: (NTP-CLIENT Section)

At the time of this writing you have to implicitly imply ntp-4.1.2 if you want it. It will also upgrade swig and libcap. After you emerge ntp you need to get it to work at boot. Add to default run-levels (as root): rc-update add ntp-client default . Now it will load at boot, but you don't have a server picked yet. So go to NTP Servers and read the info if you want and at the bottom of the page is the servers urls. Find a server(s) in your Time Zone, several incase one is down, preferably in stratum 2. Then as root, open up the /etc/conf.d/ntp-client file. It looks like this:
```

Specifically this:

 *Quote:*   

>  After you emerge ntp you need to get it to work at boot. Add to default run-levels (as root): rc-update add ntp-client default . 

 

Then don't forget to pick a server(s) on the NTP server site and add to the ntp-client  in /etc/conf.d  .

I am going to be looking at the ntpd part today. I will reread the other (ntp-client). If something doesn't seem quite readable let me know.

----------

