date cannot set date Operation not permitted — OpenVZ
Upon installation of an OpenVZ container (VE/Virtual Environment) I was unable to set the date, and the time-zone was incorrect. date cannot set date Operation not permitted attempts to set the date resulted in the following error. This post explains how to solve the following error while setting the time in a openvz container vps.
Error:
date: cannot set date: Operation not permitted
Reason:
Capability not set for the vps
Soultion:
On Openvz node:
Stop the vps
[root@test ~]# vzctl stop 105
set the parameter
[root@test ~]# vzctl set 105 –save –capability sys_time:on
Saved parameters for CT 105
Start the vps
[root@test ~]# vzctl start 105
Enter into the vps
[root@test8 ~]# vzctl enter 105
entered into CT 105
[root@abc /]#
check date
[root@abc /]# date
Fri Sep 16 00:39:09 CST 2011
Change date
[root@abc /]# date -s “Tue Sep 27 00:39:09 CST 2011”
Tue Sep 27 00:39:09 CST 2011
check date again
[root@abc /]# date
Tue Sep 27 00:39:19 CST 2011
Thats it. Date has been changed.