We recently ran into an issue with one of our virtual servers running up in the Rackspace Cloud . Some legacy application code required the time zone on our server to be set to EST but we could not get the UTC offset to stick. We tried all the usual suspects on our Ubuntu 8.04 LTS instance:
- changed /etc/default/rcS
- ran /usr/bin/tzselect
….nothing seemed to worked. My sysadmin and I were at a loss, but we finally stumbled across a site with some good advice about setting a time zone in the cloud:
As a virtual server hosted using Xen virtualization technology, such as those offered by RackSpace Cloud Server offer, system time will get reset by Xen to match the physical machine’s clock whenever the virtual server is restarted.
This time-reset behavior can be modified if you can change the Xen configuration. However as a user of the cloud computing service, you most likely do not have such access.
You can however do the following to set your system to the time you want.
Changing the time zone of your system will set your system time to the correct time of that time zone, given that your virtualization provider gives your server a correct UTC time.
Here’s how we finally made the offset stick on our configuration:
~$ date
Thu Nov 12 23:46:51 UTC 2009
~$ sudo cp /usr/share/zoneinfo/EST /etc/localtime
~$ sudo ntpdate ntp.ubuntu.com
12 Nov 18:47:15 ntpdate[5012]: adjust time server 91.189.94.4 offset -0.002164 sec
~$ date
Thu Nov 12 18:47:17 EST 2009
…bonus points…no reboot required