7
2
I am running a few Ubuntu VMs on a MacBook Pro host.
Whenever I pause a VM or save its state to disk, the next time I restart it, the system clock goes out of sync.
Is there a way for the VM to know it has just been resumed, and run a command? (for example, running ntpdate -u time.nist.gov
as root would do the trick)
I tried modifying the scripts in /etc/pm/sleep.d
, but these don't appear to be called on VM suspend/resume.
For this particular case, shouldn't the Guest Additions do this automatically? – Mechanical snail – 2011-09-09T21:54:44.950
@Mechanical snail, actually you might be right. I don't remember if I installed the guest additions on these VMs. (never thought to do that because they don't run a GUI) You should make this an answer. – mpontillo – 2011-09-09T23:03:16.087
@Mechanical snail, good sign: I did
mkdir /media/cdrom ; mount /dev/cdrom /media/cdrom ; cd /media/cdrom ; ./VBoxLinuxAdditions.run
and it updated the guest additions from 4.0.10 to 4.0.12 and synchronized the clock. Good so far, but I guess I did have them installed before. (maybe there's a bug...) Now I'll test a save/resume cycle. – mpontillo – 2011-09-09T23:08:09.103@Mechanical snail, clock sync now works. Thanks! If you make this an answer I'll accept it. – mpontillo – 2011-09-09T23:10:24.453