Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NTPD crashes on start, no idea why.
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
KWhat
l33t
l33t


Joined: 04 Sep 2005
Posts: 620
Location: Los Angeles

PostPosted: Sun Sep 27, 2015 1:50 am    Post subject: NTPD crashes on start, no idea why. Reply with quote

title says it all /etc/init.d/ntpd[13609]: status: crashed
Back to top
View user's profile Send private message
gentoo_ram
Guru
Guru


Joined: 25 Oct 2007
Posts: 410
Location: San Diego, California USA

PostPosted: Wed Sep 30, 2015 5:53 pm    Post subject: Reply with quote

One possible reason is that if the clock on your computer is "too far" off, then NTP will refuse to change the clock and just shut down. Make sure your clock is pretty close and the timezone is configured properly.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Wed Sep 30, 2015 6:03 pm    Post subject: Reply with quote

KWhat,

Does ntp-client run?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
desultory
Administrator
Administrator


Joined: 04 Nov 2005
Posts: 9178

PostPosted: Thu Oct 01, 2015 3:59 am    Post subject: Reply with quote

gentoo_ram wrote:
One possible reason is that if the clock on your computer is "too far" off, then NTP will refuse to change the clock and just shut down. Make sure your clock is pretty close and the timezone is configured properly.
In that is the case, invoking ntpdate with the -B option should remedy the problem, though it would potentially take hours to run. Though I suspect something else is wrong in this case.
Back to top
View user's profile Send private message
KWhat
l33t
l33t


Joined: 04 Sep 2005
Posts: 620
Location: Los Angeles

PostPosted: Wed Oct 14, 2015 4:58 am    Post subject: Reply with quote

ntp-client was not setup to start.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Wed Oct 14, 2015 4:51 pm    Post subject: Reply with quote

KWhat,

ntp-client runs once and will do a big step change it your clock if needed. It then hands over to ntpd to keep the time right.

Both should be in the default runlevel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1360
Location: Montréal

PostPosted: Wed Oct 14, 2015 5:08 pm    Post subject: Reply with quote

If you run Systemd and timedatectl is configure to
Code:
NTP synchronized: yes

that can explain why Ntpd do not start. It can be in conflict with systemd-timesyncd.service.
_________________
Paul
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Tue Apr 26, 2016 4:12 pm    Post subject: Reply with quote

This still doesn't work for me. Do I need to open a port or something? Periodically, my time drifts past 17 mins and stays that way (then ntpd doesn't fix it because it has crashed). After /etc/init.d/ntpd start it fixes the time but then I check the status (/etc/init.d/ntpd status) and it says ntpd has crashed. I'm not sure what to do other than put '/etc/init/ntpd restart' in a cron-job which would fix the problem but I it's not a very elegant solution...

dq
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Tue Apr 26, 2016 4:47 pm    Post subject: Reply with quote

don quixada,

You could try removing the drift file, then restarting bont ntp-client and ntpcd, in that order.
If your clock is more that 1000 sec out, ntpd will bale out.

Check you can reach an ntp server with
Code:
$ ntpq -c rv 192.168.10.3
associd=0 status=01d8 leap_none, sync_pps, 13 events, no_sys_peer,
version="ntpd 4.2.7p364@1.2483-o Fri Apr 12 02:52:48 UTC 2013 (1)",
processor="armv6l", system="Linux/3.6.11-pps-g4642dff-dirty", leap=00,
stratum=1, precision=-19, rootdelay=0.000, rootdisp=1.210, refid=PPS,
reftime=daca203e.3f364003  Tue, Apr 26 2016 18:13:34.246,
clock=daca204d.2efe7a68  Tue, Apr 26 2016 18:13:49.183, peer=63839, tc=4,
mintc=3, offset=-0.003815, frequency=-34.772, sys_jitter=0.001907,
clk_jitter=0.000, clk_wander=0.001

That IP address is my time server. Any response in a good thing.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Tue Apr 26, 2016 6:20 pm    Post subject: Reply with quote

Ok, I removed the ntp.drift file but it still shows a crashed state after restarting it. Also, it seems to take a long time after issuing the "/etc/init.d/ntp-client restart" command (10 seconds).

Also, something to note, I'm not sure what the drift file contents should typically be but I only had one entry in it (-1.860). Is this normal?

Your ip of the time server is a local ip. Do you have an external one?

dq
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Tue Apr 26, 2016 6:56 pm    Post subject: Reply with quote

don quixada,

No but any ntp server should respond.

You must run ntp-client before you run ntpd. The gets your clock correct before ntpd starts.
In turn, that avoids ntpd using the drift to fix your clock over a period of time.
It will give up for errers bigger than 1000 sec. (16.66 mtn)

ntpd should update your BIOS clock regularly too. That needs kernel support.
After an overnight power off, is the BIOS clock correct?
Maybe you need a new CMOS battery?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Tue Apr 26, 2016 7:09 pm    Post subject: Reply with quote

Hmm, good question on the battery. The motherboard is only a couple years old but it could be this... I've never had a battery go on me but stranger things have happened.

I will also check the kernel, it is possible that I don't have it enabled. Do you happen to know the flag?

Regarding the ntp server. I tried to do 'ntpq -c rv 0.ca.pool.ntp.org' but I just got a timeout.

dq
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Tue Apr 26, 2016 7:25 pm    Post subject: Reply with quote

don quixada,

Search for RTC_LIB, if that is on your system, the following options will be hidden and you are good.
Code:
  │ │    - - Enhanced Real Time Clock Support (legacy PC RTC driver)              │ │ 
  │ │    - - Enhanced Real Time Clock Support                                     │ │ 
  │ │    - - Generic /dev/rtc emulation                                           │ │ 
  │ │    - -   Extended RTC operation                                             │ │ 
  │ │    - - EFI Real Time Clock Services 

Otherwise its some combination of the above.

Note the - - means forced off. To see hidden symbols, press 'z'. Its a toggle.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Tue Apr 26, 2016 8:15 pm    Post subject: Reply with quote

Here's what I have:

Code:
Symbol: RTC_CLASS [=y]                                                 
Type  : boolean                                                       
Prompt: Real Time Clock                                                 
  Location:                                                             
    -> Device Drivers                                                   
  Defined at drivers/rtc/Kconfig:8                                     
  Depends on: !S390 && !UML                                             
  Selects: RTC_LIB [=y] 


I also have RTC_SYSTOHC enabled. I didn't see any references in the kernel config to "enhanced" RTC (even after the 'z' toggle) but, as you say, these shouldn't be enabled anyway...

I do *not* have RTC_HCTOSYS enabled however-- should I for some reason?

dq
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Tue Apr 26, 2016 8:24 pm    Post subject: Reply with quote

don quixada,

Neither of those settings matter if you have a dud CMOS battery.

One sets the system time form the CMOS clock on boot, the other updates the BIOS clock from time to time if you have NTP sync.
Neither is essential if ntp time sync works.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Tue Apr 26, 2016 8:30 pm    Post subject: Reply with quote

Ok, but I'm not totally convinced that the CMOS battery is low. I leave my machine on most of the time but when I turn it off it doesn't necessarily affect the system clock. And also, sometimes the time becomes "unsynced" while the computer is running...

An /etc/init.d/ntpd restart fixes the problem but that's not a good solution and doesn't resolve why ntpd crashes.

Regardless, I can still test the battery to see if there's anything wrong with it...

dq
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Tue Apr 26, 2016 8:50 pm    Post subject: Reply with quote

don quixada,

The system real time clock is operated from the master clock oscillator once the system is running. The master clock oscillator is controlled by a cheap crystal that is always slow.
Fast crystals can be slowed down to improve the accuracy but slow ones are always slow. For controlling the CPU, it doesn't matter much. For controlling the BIOS time it matters a lot, so better crystals are used here.

Once upon a time, before NTP, computer clocks were correct at power up and lost time with increasing uptime. NTP fixed that mostly.

Modern CPUs have other timekeeping methods too. Please post your dmesg. I need it from the start to see what it says about the stability of the tsc.

Has the NTP problem always been present or is it new?
If its new, that indicates that something has changed.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Tue Apr 26, 2016 9:19 pm    Post subject: Reply with quote

It's been a problem for quite awhile. Definitely over a year maybe two. I'm just getting fed up enough to deal with it now... :-P I'll post my dmesg when I get home tonight.

dq
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Wed Apr 27, 2016 12:20 am    Post subject: Reply with quote

Ok, actually my dmesg is very unhelpful, it's not even worth posting. It's inundated by my Shorewall rejecting a connection within my local network.

dq
Back to top
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1692

PostPosted: Wed Apr 27, 2016 1:05 am    Post subject: Reply with quote

Quote:
Ok, actually my dmesg is very unhelpful, it's not even worth posting. It's inundated by my Shorewall rejecting a connection within my local network.


While you may think that is unhelpful, it DOES give quite a bit of information. One thing it tells us, is that there is a good indication your shorewall configuration may not be correct. 2 things, going through your older logs, how long have you been getting flooded with connection rejected messages? (Having a large log size can also indicate this). While that message may not be related to this issue, it is still an issue you need to look at.

Second, have you tried disabling your firewall on the computer (so nothing is blocked) to see if it's not your firewall?

Note: I am not saying to keep it disabled for extended periods of time, but disabling the firewall temporarily is a easy test to do, often helpful on troubleshooting a networking issue.
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Wed Apr 27, 2016 1:56 am    Post subject: Reply with quote

I tried to disable shorewall but there is no change in the ntpd status.

Here's the dmesg if it helps:

http://pastebin.com/NmzsDya1

The ip address ending in 43 is my Chromecast. Don't know why it's trying to connect to this computer...

dq
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Thu Apr 28, 2016 11:47 am    Post subject: Reply with quote

@ct85711 or @NeddySeagoon did you get a chance to look at my dmesg?

dq
Back to top
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1692

PostPosted: Thu Apr 28, 2016 3:45 pm    Post subject: Reply with quote

the part I find strange, is that if ntpd is crashing, it should have posted some log messages indicating why

just a quick check around the web, common reasons for it to crash, is your time is too far out of sync, ntpd is unable to connect to any ntp server, and sometimes when the interface address changes (there were reports of issues with vmware/virtualization causing issues too).

generally, ntp uses UDP port 123 for it's communication. Most times you shouldn't have to mess with that, if your firewall has the usual accept established,related traffic rule.

Now one thing you may want to do, is have your firewall stop logging the dropped traffic from your chromecast (so your logs are not being flooded). That's assuming your chromecast is working properly.

I did notice you have some messages from destination port 515 and 9100, both related to printing (9100 is supposedly common for hp printers), so something to look at if you are having trouble printing.

For ntp server, if you need to, you can use the {0-3}.pool.ntp.org pool addresses (pool addresses for public ntp servers).
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42564
Location: 56N 3W

PostPosted: Thu Apr 28, 2016 4:32 pm    Post subject: Reply with quote

don quixada,

There is noting useful in dmesg because of the logspam.
Be sure that your shorewall allows ntp requests out.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
don quixada
l33t
l33t


Joined: 15 May 2003
Posts: 730

PostPosted: Thu Apr 28, 2016 5:57 pm    Post subject: Reply with quote

I could try opening the port although ntpd does seem to run fine and fix the time when I first run it but then it subsequently crashes. So it can't be run as a service it seems. Anyway, I'll try opening the ports on both my shorewall and router...

It's weird that I'm getting printing related errors because I do not even have a printer installed anywhere on any machine. I suppose I do have CUPS installed but I'm not even printing to PS/PDF often on this machine either...

dq
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum