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.
[](javascript:void(0))
网友评论