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.

Comments (6)

UncleCrackerDezember 3rd, 2012 at 12:16

Thanks. That helped me alot.

TomekJuni 7th, 2013 at 16:36

This blog post should be 1st at Google search for the error message, not 2nd 😉

maxOktober 4th, 2013 at 10:20

ah thanks a lot and wish you luck

BartasOktober 28th, 2013 at 15:15

Thank you, it helped.

moJanuar 19th, 2016 at 16:32

thanks!

cDezember 30th, 2016 at 03:10

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

Leave a comment

Your comment

(required)