Fix OpenVZ Network Date and Timezone


Having problems setting your OpenVZ network date and timezone? Familiar with this annoying error; “Error: date: cannot set date: Operation not permitted”? Here is a little tutorial on how to properly set the date and timezone in an openvz container. Lets keep it simple.

With openvz virtualization, using NTP is a pain since certain resources are shared between the host and the openvz container, such as the kernel. A work around for this is to update our 'localtime' file in /etc to point to the proper timezone file.

In this example, I will be updating my server timezone to Atlantic Standard Time

1.) Lets rename the current 'localtime':

mv /etc/localtime /etc/localtime.BAK

2.) Create the symlink to the proper timezone file:

ln -s /usr/share/zoneinfo/Canada/Atlantic /etc/localtime

And that's it. Type 'date' in to validate that you are now on the right timezone. I have tested and can validate that this works on Centos 6.2 and Ubuntu 12.10 containers. I'm sure there are other ways to get around this but give it a try and let us know how you make out!



Blog Administrator at iWebSource

I’m not much of a writer and never have been. I would love to change the world, but they won’t give me the source code.



Atlantic Canada’s #1 source for online solutions! Premium webdesign, business class web hosting, flexible reseller hosting and more!

Looking forward to summer? Make your reservation today at JNK Trailer Rentals! — – 2 months ago




Leave a Reply

You must be logged in to post a comment.