Previous page

Next page

Locate page in Contents

Print this page

Changing System Time From Container

Normally it is impossible to change the system time from a Container. Otherwise, different Containers could interfere with each other and could even break applications depending on the system time accuracy.

Normally only the Hardware Node system administrator can change the system time. However, if you want to synchronize the time via Network Time Protocol (NTP), you have to run NTP software, which will connect to external NTP servers and update the system time. It is not advisable to run application software on the Hardware Node itself, since flaws in the software can lead to compromising all Containers on the Hardware Node. Thus, if you plan to use NTP, you shall create a special Container for it and configure it to have the sys_time capability. The example below illustrates configuring such a Container:

# vzctl set 101 --capability sys_time:on --save

Unable to set capability on running Container

Saved parameters for Container 101

The output of the above command warns you that vzctl cannot apply changes in the capabilities to a running Container. The Container has to be restarted before changes take effect:

# vzctl stop 101; vzctl start 101

Stopping Container ...

Container was stopped

Container is unmounted

Starting Container ...

Container is mounted

Adding IP address(es): 192.168.1.101

Hostname for Container set: Container101

Container start in progress...

# ssh root@ct101

root@ct101's password:

Last login: Mon Feb 28 23:25:58 2007 from 10.100.40.18

[root@ct101 root]# date

Mon Feb 28 23:31:57 EST 2007

[root@ct101 root]# date 10291300

Tue Feb 29 13:00:00 EST 2007

[root@ct101 root]# date

Tue Feb 29 13:00:02 EST 2007

[root@ct101 root]# logout

Connection to Container101 closed.

# date

Tue Feb 29 13:01:31 EST 2007

The command session above shows the way to change the system time from Container 101. The changes will affect all the Containers and the Hardware Node itself. It is not advisable to have more than one Container with the sys_time capability set on.

NTP is described in Internet Standard RFC 1305; more information including client software can be obtained from the NTP web server (http://www.ntp.org).

Please send us your feedback on this help page