I’ve scoured forums trying to fix this with no avail. My system time is off by an hour, and a few minutes. This of course throws off the time in HA. I’ve done everything I could find from changing international settings, updating ntp servers, etc. I thought I would be smart and move the Rpi a time zone over, but it still corrects itself to be an hour off. I’m at a loss.
If the time is off by an hour, then it’s most likely a timezone issue.
You can check a few things. The first is what does the output of sudo ntpq -c pe show?
Next is what does the output of date and date -u show? The first should show your local time and timezone, the second the time in UTC (aka GMT). You can then check the UTC time against one of any number of web sites, or even a simple Google for what is the time in GMT.
Finally, did date display your local timezone? It should match a file in /usr/share/zoneinfo. For example, if you’re in California, you’d be using US/Pacific, if you’re in Moscow you’d be using Europe/Moscow. If you don’t know, just tell us the country you live in (or, if you’re in a country with multiple timezones, where you live - AFAIK that’s only Australia, USA, Canada, Russia, and Greenland).
sudo ntpq -c pe says connection refused.
date shows the correct time zone but is 1 hour and 4 minutes behind
date -u shows the time also an hour and 4 minutes behind UTC
pi@raspberrypi:~ $ sudo aptitude install ntp
The following partially installed packages will be configured:
bsd-mailx exim4-daemon-light ntp
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 197 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Setting up ntp (1:4.2.6.p5+dfsg-7+deb8u2) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Job for ntp.service failed. See 'systemctl status ntp.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript ntp, action "start" failed.
dpkg: error processing package ntp (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up exim4-daemon-light (4.84.2-2+deb8u3) ...
Job for exim4.service failed. See 'systemctl status exim4.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript exim4, action "start" failed.
dpkg: error processing package exim4-daemon-light (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of bsd-mailx:
bsd-mailx depends on default-mta | mail-transport-agent; however:
Package default-mta is not installed.
Package exim4-daemon-light which provides default-mta is not configured yet.
Package mail-transport-agent is not installed.
Package exim4-daemon-light which provides mail-transport-agent is not configured yet.
dpkg: error processing package bsd-mailx (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
ntp
exim4-daemon-light
bsd-mailx
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to perform requested operation on package. Trying to recover:
Setting up ntp (1:4.2.6.p5+dfsg-7+deb8u2) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Job for ntp.service failed. See 'systemctl status ntp.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript ntp, action "start" failed.
dpkg: error processing package ntp (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up exim4-daemon-light (4.84.2-2+deb8u3) ...
Job for exim4.service failed. See 'systemctl status exim4.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript exim4, action "start" failed.
dpkg: error processing package exim4-daemon-light (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of bsd-mailx:
bsd-mailx depends on default-mta | mail-transport-agent; however:
Package default-mta is not installed.
Package exim4-daemon-light which provides default-mta is not configured yet.
Package mail-transport-agent is not installed.
Package exim4-daemon-light which provides mail-transport-agent is not configured yet.
dpkg: error processing package bsd-mailx (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
ntp
exim4-daemon-light
bsd-mailx
That’s your problem. Somehow you’ve got a broken install. Did you start with Hassbian, or Raspbian and then install HA? Your best bet at this point is probably a Raspbian forum, where there’ll be many folks available to walk you through fixing this quickly.
Yeah I started with Raspbian and then used the AiO installer last year. I haven’t had a problem until recently so I’m not really sure what happened. That or I just haven’t noticed >.<
I really appreciate your help this far. I’ll reach out in the Raspbian forum before I do clean install.
You might find that removing exim and installing dma fixes it. You’ll know when sudo aptitude update; sudo aptitude full-upgrade works and doesn’t error.
I can’t get the Pi to boot anymore. I took the SD card out and put it in my PC and I can’t get it to read correctly. I think the SD might have crapped out on me.
Could be the original problem of all of this. I’ll grab a new card and do a clean install. I had some other weird issues so a clean start isn’t the worst of ideas!
Thanks for all of your help. I expect NTP to work after I reinstall haha.
I also have problem with time. “date” shows Thu 11 May 23:02:46 EEST 2017 but actual is 25th and time 21.22
Any ideas? I tried changing servers in ntp.conf but no success.
Unfortunately, I believe my problem was that my SD card was failing and lost some crucial files for NTP. The best advice I can give is below from Tinkerer. Try reinstalling NTP and if it fails, check the logs and see what is preventing it from installing. My card got bad enough to where it won’t boot anymore. So I’m on to a new card and fresh installs.