shussekaidoのブログ

shussekaidoのブログ

ブログの説明を入力します。

Amebaでブログを始めよう!
So, I finally got around to troubleshooting time sync in my VMs. When virtual machines resume from standby the date/time in the VM will be behind. After a while you can end up with your VM being days behind the actual date. For some reason I found it difficult to google up a clear solution, which is really strange - you'd think it's a really common issue.

So, here is a solution that worked for me. First of all you want to make sure your ntpd daemon is set to run at startup. On FreeBSD your /etc/rc.conf needs to have ntpd_enable="YES"

Edit /etc/ntp.conf:

# Add minpoll and maxpoll to your time servers in order to poll time once a minute:
server 0.freebsd.pool.ntp.org iburst minpoll 6 maxpoll 6
server 1.freebsd.pool.ntp.org iburst minpoll 6 maxpoll 6
server 2.freebsd.pool.ntp.org iburst minpoll 6 maxpoll 6

# Uncommment these lines at the end:
server 127.127.1.0
fudge 127.127.1.0 stratum 10

# Add this line:
tinker panic 0


The tinker panic 0 part tells ntpd not to freak out during boot time (otherwise it will throw an error if VM time lag is greater than 10 mins). Most places I googled make it seem like tinker panic 0 is the actual solution but in reality it only works when the VM boots up. The edits mentioned above help the VM update the time after resuming from sleep.

Remember to restart ntpd (service ntpd restart).