Trouble with ntpdate: „Can’t adjust the time of day“
To have a correct server time ntpd
is a commonly used daemon. It periodically synchronizes the local server time with a time server. Some days ago I recognized that the time on a server I administrate is two hours slow. So I tried to manually update the time using the ntpdate
tool. But all I got was the following:
root@foobar:/$ ntpdate -u 3.debian.pool.ntp.org
ntpdate[1337]: Can't adjust the time of day: Operation not permitted
Searching the web for the cause of this problem, I found many posts which say that this could be due to the fact that the affected server is a virtual machine and thus cannot set the system time on the host machine. This could be the case here because this is about a virtual machine.
Asking an acquaintance who administrates the host machine for help, he affirmed that the time on the host is correct. He suggested that the problem could be on account of a wrong timezone setting. By executing
dpkg-reconfigure tzdata
I corrected the timezone in the setup and there it was: The correct server time. So the actual problem was not that ntpdate is not allowed to set the time – I assume this is really because of a restriction of the virtual machine. Sometimes the solution can be found at a different spot.
Thanks. That helped me alot.
This blog post should be 1st at Google search for the error message, not 2nd 😉
ah thanks a lot and wish you luck
Thank you, it helped.
thanks!
My date was set for a day ahead on my VM (e.g. set to 30th but it was actually the 29th) and threw the same error. Once the day was corrected it worked as flawlessly.
# date
Fri Dec 30 21:01:54 2016
# date –set 2016-12-29
# ntpdate pool.ntp.org
Tomek, google granted your wish
should i past it in terminal