System Clock in a VirtualBox Debian Guest

By default, the system clock in Debian is set to UTC (Universal Time), and then adjusted to your local time, based on your time zone and daylight savings time. This can be a problem if you are running a Debian VirtualBox guest machine, because VirtualBox sets the virtual machine's system clock to local time when the machine is started. Because Debian expects the system clock to be UTC, the time zone adjustment results in the wrong local time (unless you live near Greenwich?).
You can fix the problem by editing the the file "/etc/default/rcS" (you'll need to be root). Simply change the line "UTC=yes" to "UTC=no" and save the file. After rebooting, Debian will treat the system clock as local time (which it is) instead of UTC, and won't adjust it for time zones.
December 3rd, 2009 - 14:59
Since I spent 1/2 hour on this, I might add: running “restart” after changing /etc/default/rcS is not sufficient! I had to bring down the VBox processes on the host (Ubuntu 9.10) OS entirely, then the rcS mod worked.
December 3rd, 2009 - 15:18
That’s good to know. I’m not sure if I inadvertently had done the same thing on my machine, or if it wasn’t necessary with a Windows XP host.
January 13th, 2010 - 13:32
@Stuart thanks for adding that note! I’ve been trying to get this to work for days, and it never occurred to me to restart virtual box.