3

On my RaspBMC, the time drifts pretty much (more than a day in one month). So I started to use NTP, but have problems running it.

I called sudo update-rc.d ntp enable, I also added DAEMONS=(!hwclock ntp ntpdate) to /etc/rc.local, I made sure there is a correct symlink from /etc/rc2.d/S18ntp, however, after rebooting, service ntp status says the daemon is not running. Running the daemon manually by calling sudo service ntp start works correctly.

What else should I do to run the daemon all the time?

Edit: In /var/log/daemon.log I see normal functioning when I run the service manually, but after a reboot, this is shown:

Mar  3 08:57:46 raspbmc ntpd[1179]: ntpd [email protected] Sat Dec 20 21:33:54 UTC 2014 (1)
Mar  3 08:57:46 raspbmc ntpd[1202]: proto: precision = 1.000 usec
Mar  3 08:57:46 raspbmc ntpd[1202]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING
Mar  3 08:57:46 raspbmc init: ntp main process (1202) terminated with status 1
Mar  3 08:57:46 raspbmc init: ntp main process ended, respawning
...
Mar  3 08:57:47 raspbmc init: ntp respawning too fast, stopped
4
  • You could try adding service ntp start to /etc/rc.local
    – Wilf
    Feb 13, 2015 at 0:38
  • Thanks, I'll try it. But do you know, why the mentioned actions did not result in NTP service running? Feb 13, 2015 at 8:02
  • Tried, also doesn't work. Isn't the ntp service shutting down itself for some reason? Feb 13, 2015 at 8:08
  • unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING is the problem. Its saying something is already running and bound to that port... doesn't say what though. One step at a time.
    – Piotr Kula
    Mar 3, 2015 at 8:48

2 Answers 2

1

All you should need is update-rc.d So I'm guessing you or raspbmc inadvertently changed something from default debian/raspbian/rpi-raspbian making one of the tests in /etc/init.d/ntp fail.

@ppumkin said

sudo apt-get remove ntpdate

As It can conflict. (they use the same port) You can also just disable it's invocation if you want to keep using it.

This is what it looks like on my raspbmc where ntp seems to be working

root@raspbmc:~# service ntp status
ntp start/running, process 941

root@raspbmc:~# grep ntp /var/log/daemon.log | tail                            
Jan 31 11:27:24 raspbmc ntpd[920]: ntpd [email protected] Sat Dec 20 21:33:54 UTC 2014 (1)
Jan 31 11:27:24 raspbmc ntpd[941]: proto: precision = 1.000 usec
Jan 31 11:27:24 raspbmc ntpd[941]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Jan 31 11:27:24 raspbmc ntpd[941]: Listen and drop on 1 v6wildcard :: UDP 123
Jan 31 11:27:24 raspbmc ntpd[941]: Listen normally on 2 lo 127.0.0.1 UDP 123
Jan 31 11:27:24 raspbmc ntpd[941]: Listen normally on 3 eth0 192.168.0.153 UDP 123
Jan 31 11:27:24 raspbmc ntpd[941]: Listen normally on 4 lo ::1 UDP 123
Jan 31 11:27:24 raspbmc ntpd[941]: Listen normally on 5 eth0 fe80::ba27:ebff:fec1:c508 UDP 123
Jan 31 11:27:24 raspbmc ntpd[941]: peers refreshed
Jan 31 11:27:24 raspbmc ntpd[941]: Listening on routing socket on fd #22 for interface updates

root@raspbmc:~# dpkg -l | grep -i ntp
ii  ntp                             1:4.2.6.p5+dfsg-2+deb7u1           armhf        Network Time Protocol daemon and utility programs

root@raspbmc:~# find /etc/ -iname '*ntp*'
/etc/dhcp/dhclient-exit-hooks.d/ntp
/etc/init/ntp.conf
/etc/rc2.d/S17ntp
/etc/rc5.d/S17ntp
/etc/rc4.d/S17ntp
/etc/cron.daily/ntp
/etc/default/ntp
/etc/ntp.conf
/etc/rc3.d/S17ntp
/etc/init.d/ntp

root@raspbmc:~# nice grep -RiP "[^a-z]ntp" /etc/ 2>/dev/null | perl -pe 's/:.*//g'  | grep -v ntp | sort -u 
/etc/dhcp/dhclient-enter-hooks.d/debug
/etc/dhcp/dhclient-exit-hooks.d/debug
/etc/dhcp/dhclient.conf
/etc/init.d/.depend.start
/etc/init/early-network-time.conf
/etc/passwd
/etc/passwd-
Binary file /etc/alternatives/net matches

root@raspbmc:~# runlevel
 2

Start by looking at the log and comparing the other commands I showed, then if nothing jumps out add /bin/date >> /home/pi/ntp.log on the 11th line of /etc/init.d/ntp to see if the service is being called at all, if not, remove soft links and re-run update-rc.d if it is then move the log line down the script file until you find where it's failing. Use a binary like search for the log line position (0%,50%,100%,75%,62%,etc)

7
  • In my question I tell that I called sudo update-rc.d ntp enable without the desired effect. Could you elaborate more on what you meant by your answer? Mar 2, 2015 at 9:49
  • @peci1 improved the answer, let us know what you find. Mar 3, 2015 at 1:11
  • Thanks for referring to /var/log/daemon.log, I haven't known this file. See the edit of my question for what I get in this log file after a reboot. Mar 3, 2015 at 8:09
  • 1
    @peci1 undo your changes to /etc/rc.local etc to be sure you are not calling it more than once. also note this askubuntu.com/a/413426/384263 Mar 3, 2015 at 8:19
  • Great! The culprit was really in ntpdate. I disabled it and now ntpd runs normally. Could you edit your answer to include this information? Mar 3, 2015 at 10:05
1

It seems like the application ntpupdate might be running during that rc level.

Please try removing it and reboot.

sudo apt-get remove ntpdate

NTP is its successor but it seems ntpupdate to be installed and run by default.

2
  • Yes, that's it ;) However, I chose @user1133275 's answer as correct, because he provided a more complete debugging solution. I'd at least vote you up, however I've still been missing two point to be allowed to do that :) Mar 3, 2015 at 10:06
  • No problem. Hope you stay with us for a long time. Ask questions any time.
    – Piotr Kula
    Mar 3, 2015 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.