Hi all. First post. I'm using wheezy. My pi lives in a rural location that is subject to frequent short power outages. When the the pi powers back up, it does so quicker than my router can re-acquire its internet connection. So when it tries to update its time from an NTP server it fails because it has no internet access. I believe that's what is causing some mysterious time inaccuracies on my pi. (It's not off by an integral number of hours so the time zone isn't the problem.)
Can anyone point me towards a way to have the pi keep trying a bit harder for a bit longer to get a proper time? (Yes, I know I should just get a decent UPS or something...)
Or is there a place where detailed NTP logs are saved so I can try to dig a little deeper?
Many thanks
NTP / time settings
10 posts
- Posts: 2
- Joined: Thu Aug 30, 2012 7:51 pm
I have the same problem.
My Pi is powered from a USB socket on the back of my modem and boots up much faster, if the modem restarts for any reason, and, as a result, my system time is well out from what it should be.
I'll post back, if I find a solution.
My Pi is powered from a USB socket on the back of my modem and boots up much faster, if the modem restarts for any reason, and, as a result, my system time is well out from what it should be.
I'll post back, if I find a solution.
- Posts: 3
- Joined: Sun Sep 02, 2012 8:33 am
I (think) it's mission accomplished.
Having searched for information and having followed links to
http://raspberrypi.stackexchange.com/questions/266/how-can-i-keep-system-time
and
http://www.wikihow.com/Change-the-Timezone-in-Linux
this is how I did it.
I'm using Raspbian (Wheezy), meaning NTP is already installed, so I used
After
Anyone not in the UK would have to search through /usr/share/zoneinfo's subdirectories to find the most appropriate location to change to symbolic link target to.
That's what seems to have worked for me.
I hope it works for you and anyone else who tries it.
If anyone with more experience than myself knows an easier way, of course....
Having searched for information and having followed links to
http://raspberrypi.stackexchange.com/questions/266/how-can-i-keep-system-time
and
http://www.wikihow.com/Change-the-Timezone-in-Linux
this is how I did it.
I'm using Raspbian (Wheezy), meaning NTP is already installed, so I used
- Code: Select all
sudo nano /etc/rc.conf
- Code: Select all
DAEMONS=(!hwclock ntpd)
After
- Code: Select all
sudo reboot
- Code: Select all
sudo ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
- Code: Select all
sudo reboot
Anyone not in the UK would have to search through /usr/share/zoneinfo's subdirectories to find the most appropriate location to change to symbolic link target to.
That's what seems to have worked for me.
I hope it works for you and anyone else who tries it.
If anyone with more experience than myself knows an easier way, of course....
- Posts: 3
- Joined: Sun Sep 02, 2012 8:33 am
Great, thanks for that, I will experiment. I was on the verge of running (as a cron job on reboot) a script to wait a while (to give the router time to come up) and then try NTP. Your solution looks like much less of a botch! Thanks
- Posts: 2
- Joined: Thu Aug 30, 2012 7:51 pm
Hi,
I'm also using Raspbian (Wheezy)
The way I have setup my NTP time server for the Raspi to keep correct time was to edit this file
/etc/ntp.conf
Remove the hash(#) from the line below *You need to talk to an NTP server or two (or three)*
type the URL of the time server in front of server. such as ntp.timeserver.com
I also setup a rc.conf file the same as you have but found some more information on how to make it run faster, add ntpdate so your file looks this:
DAEMONS=(!hwclock ntpd ntpdate)
Source: http://raspberrypi.stackexchange.com/qu ... ystem-time
Hope that's useful
I'm also using Raspbian (Wheezy)
The way I have setup my NTP time server for the Raspi to keep correct time was to edit this file
/etc/ntp.conf
Remove the hash(#) from the line below *You need to talk to an NTP server or two (or three)*
type the URL of the time server in front of server. such as ntp.timeserver.com
I also setup a rc.conf file the same as you have but found some more information on how to make it run faster, add ntpdate so your file looks this:
DAEMONS=(!hwclock ntpd ntpdate)
Source: http://raspberrypi.stackexchange.com/qu ... ystem-time
Hope that's useful
- Posts: 3
- Joined: Fri Aug 31, 2012 6:46 pm
Okay.
Watch this space. More to come, because....
Logged into my Pi today, to find the time two hours slow again!
Modem must have rebooted overnight, for some reason, (Note to self: Get a new modem. This one started randomly rebooting two weeks ago and you've no idea why) and the Pi hasn't got the right local time now.
Hey, ho. Back to work on it.
Watch this space. More to come, because....
Logged into my Pi today, to find the time two hours slow again!
Modem must have rebooted overnight, for some reason, (Note to self: Get a new modem. This one started randomly rebooting two weeks ago and you've no idea why) and the Pi hasn't got the right local time now.
Hey, ho. Back to work on it.
- Posts: 3
- Joined: Sun Sep 02, 2012 8:33 am
I can not get the system time to update. Do I need to make rc.conf executable? I thought ntpd -gq would update the time, but it doesn't seem to be working either.
- Posts: 3
- Joined: Wed Oct 03, 2012 6:40 pm
If you have power issues...whether it's sags and surges or outages (brief or otherwise), or even if you think your power is reliable...
Get an Uninteruptable Power Supply (UPS). Put not only your Pi and PC on it, but you networking equipment (modem, router, switches, etc.) on it as well. If you can't get everything on one UPS, get however many you need. If you want to isolate your network gear, get small UPS (<500VA) for the network and a larger one for other equipment.
Doing this will save you much grief in the long run...and not just with the Pi. There will be less wear and tear on your electronics, you won't lose work because your machine dropped, you won't be rebuilding corrupted SD cards, you'll be able to ignore brief power interruptions, and you'll be able to do an orderly shutdown in longer interruptions.
Just to give a concrete example from a few years ago... I was running convention registration when the power went out in the hotel we were using for the con. I had my crew process the registrations they were already working on and then we did a controlled shutdown of 4 PCs, two impact printers, and a Linux server, plus the associated network bits that tied it all together ....all because it was all running on two 1.5KVA UPS'. The power was out for about 3 hours. When we got power back, everything came back up smoothly with no glitches and no file corruption.
You never know when or where you'll have a power outage.
Get an Uninteruptable Power Supply (UPS). Put not only your Pi and PC on it, but you networking equipment (modem, router, switches, etc.) on it as well. If you can't get everything on one UPS, get however many you need. If you want to isolate your network gear, get small UPS (<500VA) for the network and a larger one for other equipment.
Doing this will save you much grief in the long run...and not just with the Pi. There will be less wear and tear on your electronics, you won't lose work because your machine dropped, you won't be rebuilding corrupted SD cards, you'll be able to ignore brief power interruptions, and you'll be able to do an orderly shutdown in longer interruptions.
Just to give a concrete example from a few years ago... I was running convention registration when the power went out in the hotel we were using for the con. I had my crew process the registrations they were already working on and then we did a controlled shutdown of 4 PCs, two impact printers, and a Linux server, plus the associated network bits that tied it all together ....all because it was all running on two 1.5KVA UPS'. The power was out for about 3 hours. When we got power back, everything came back up smoothly with no glitches and no file corruption.
You never know when or where you'll have a power outage.
- Posts: 856
- Joined: Fri Mar 09, 2012 7:36 pm
- Location: Vallejo, CA (US)
Left_Guard wrote:I (think) it's mission accomplished.
Having searched for information and having followed links to
http://raspberrypi.stackexchange.com/questions/266/how-can-i-keep-system-time
and
http://www.wikihow.com/Change-the-Timezone-in-Linux
this is how I did it.
I'm using Raspbian (Wheezy), meaning NTP is already installed, so I usedto create a file into which I put the line
- Code: Select all
sudo nano /etc/rc.conf.
- Code: Select all
DAEMONS=(!hwclock ntpd)
Afterthe date was correct, but the time was one hour slow, so I then used
- Code: Select all
sudo rebootwhich, after another dose of
- Code: Select all
sudo ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime, got the time in line with my local UK time.
- Code: Select all
sudo reboot
Anyone not in the UK would have to search through /usr/share/zoneinfo's subdirectories to find the most appropriate location to change to symbolic link target to.
That's what seems to have worked for me.
I hope it works for you and anyone else who tries it.
If anyone with more experience than myself knows an easier way, of course....
I was looking for ages for a workaround about the non real clock Pi and it seems your post gave real time to my Pi.Thanx a lot.
- Posts: 8
- Joined: Wed Oct 10, 2012 8:21 am
Hi,
I'm wondering about the successful settings.
AFAIK, Debian has not a rc.conf.
AFAIK you mix up two distros: Debian (SysV style init process) and Arch (BSD style init process). Wikipedia has a brief explanation here: http://en.wikipedia.org/wiki/Init.
Greetings
Herbert
I'm wondering about the successful settings.
AFAIK, Debian has not a rc.conf.
AFAIK you mix up two distros: Debian (SysV style init process) and Arch (BSD style init process). Wikipedia has a brief explanation here: http://en.wikipedia.org/wiki/Init.
Greetings
Herbert
- Posts: 1
- Joined: Fri May 17, 2013 11:58 am