OpenVZ - Operation not permitted on changing date



Error:

When you try to set date in a OpenVZ container, it may show Operation not permitted error.


Reason:

The capability for setting time is not given for the container.
sys_time capability mustbe enabled for the container to set the date and time.


Solution:

1. Login to OpenVZ Hardware Node as root user.

2. [root@HN ~] # vzlist -a | grep <IP of VPS>
                  <VPSID>         59  running   <IP>  server.example.com

3. [root@HN ~] # vzctl stop <VPSID>

4. [root@HN ~] # vzctl set <VPSID> --capability sys_time:on --save

5. [root@HN ~] # vzctl start <VPSID>


Now the capability parameter for changing time is given for the container.
Try again changing the date. This time it will permit you to change the date and time.

Reference:
http://wiki.openvz.org/Man/vzctl.8#Capability_option