OpenVZ VPS wont let you change the date.

July 7th, 2009

I was preparing a backup script for my virtual servers and I realized that the date was 1 day ahead and intersting enough I could not change the date.

# date -s "7 JUL 2009"
date: cannot set date: Operation not permitted
Tue Jul  7 00:00:00 EDT 2009

After some research it became clear that OpenVZ did not want me to change the date of the VPS and this did not have to do with your Host server datetime.

So, long story short, quick solution.

Change your VPS time zone and all will be fine.

Backup your current time file

mv /etc/localtime /etc/localtime.backup

Create a new symbolic link to your current timezone (server’s timezone)

ln -s /usr/share/zoneinfo/[Country]/[Area] /etc/localtime

You can get a better idea of which time zones are available by listing the content of this folder and follow the path.

ls /usr/share/zoneinfo

enjoy…

Tags: , , ,
Posted in Linux, OpenVZ, Virtualization | Comments (4)