Time was not adjusted automatically in container after updating
tzdata package in a CentOS/Redhat container.
Time was not adjusted because
/etc/localtime file was not updated. And
/etc/localtime was not updated because
/etc/sysconfig/clock file is missing - it should contain timezone which is used on a server for system to update
This issue was confirmed as a bug with internal ID #PSBM-29853
To fix the issue for existing containers it's necessary to copy
/etc/sysconfig/clock from hardware node:
[root@pcs ~]# cp -fp /etc/sysconfig/clock /vz/root/<CTID>/etc/sysconfig/clock
<CTID> should be replaced with Container ID in question.
Once it's copied, reinstall
tzdata package in the container:
[root@container ~]# yum reinstall tzdata -y
Permanent fix should be applied to the OS template
post-cache script. Add following line to
[ -f /etc/sysconfig/clock ] && cp -fp /etc/sysconfig/clock etc/sysconfig/clock
<OS>should be replaced with OS in question (e.g.
<RELEASE>should be replaced with release in question (e.g.
<ARCH>should be replaced with arch in question (e.g.
Make sure to add line next to the line that copies "localtime" file. E.g.:
# diff -pruN post-cache.original post-cache --- post-cache.original 2014-11-01 15:57:23.294445979 +0600 +++ post-cache 2014-11-01 15:58:00.181968471 +0600 @@ -23,6 +23,7 @@ fi pushd $rootdir > /dev/null [ -f /etc/localtime ] && cp -fp /etc/localtime etc/localtime +[ -f /etc/sysconfig/clock ] && cp -fp /etc/sysconfig/clock etc/sysconfig/clock [ -f /etc/sysconfig/i18n ] && cp -fp /etc/sysconfig/i18n etc/sysconfig/i18n popd > /dev/null
Once you've added the line it will be necessary to update template cache:
# vzpkg update cache <TEMPLATE_NAME>