So it's expected that the download template images will not replicate
any host settings (locales, timezone, ...) as those are completely self-
contained images.
As discussed on IRC, it looks like Xenial needs you to also change the
/etc/localtime symlink, which is why your manual change worked for
trusty but not xenial.
** Changed in: lxc (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1632766
Title:
time in lxc ubuntu template
Status in lxc package in Ubuntu:
Invalid
Bug description:
With regard to github bug :
---
adjust timezone to the host at creation time #47
https://github.com/lxc/lxc/issues/47
---
I still can reproduce the problem on different HW running Xenial with
the LXC ubuntu image Trusty and Xenial.
* Bare metal (xenial)
$ date
Wed Oct 12 11:27:55 EDT 2016
LXC (Trusty)
$ sudo lxc-attach -n trusty
root@trusty:/# date
Wed Oct 12 15:28:10 UTC 2016
* Bare metal #2 (xenial)
$ date
Wed Oct 12 11:28:57 EDT 2016
LXC (Xenial)
$ lxc-attach -n xenial
$ date
Wed Oct 12 15:29:32 UTC 2016
Note, that using the debian template everything works fine :
Bare metal #1 (xenial)
$ date
Wed Oct 12 11:30:40 EDT 2016
$ lxc-attach -n debian8
$ date
Wed Oct 12 11:30:45 EDT 2016
However debian and ubuntu got the same piece of code :
# lxc-debian.in
149 # set initial timezone as on host
150 if [ -f /etc/timezone ]; then
151 cat /etc/timezone > "$rootfs/etc/timezone"
152 chroot "$rootfs" dpkg-reconfigure -f noninteractive tzdata
153 elif [ -f /etc/sysconfig/clock ]; then
154 . /etc/sysconfig/clock
155 echo "$ZONE" > "$rootfs/etc/timezone"
156 chroot "$rootfs" dpkg-reconfigure -f noninteractive tzdata
157 else
158 echo "Timezone in container is not configured. Adjust it
manually."
159 fi
160
161 echo "root:root" | chroot "$rootfs" chpasswd
162 echo "Root password is 'root', please change !"
163
164 return 0
165 }
# lxc-ubuntu.in
600 # Set initial timezone as on host
601 if [ -f /etc/timezone ]; then
602 cat /etc/timezone > $rootfs/etc/timezone
603 chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
604 elif [ -f /etc/sysconfig/clock ]; then
605 . /etc/sysconfig/clock
606 echo $ZONE > $rootfs/etc/timezone
607 chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
608 else
609 echo "Timezone in container is not configured. Adjust it
manually."
610 fi
If I run the above manually it has positive effect on Trusty (persistent
across stop/start)
$ cat /etc/timezone > /var/lib/lxc/trusty/rootfs/etc/timezone
$ chroot /var/lib/lxc/trusty/rootfs dpkg-reconfigure -f noninteractive tzdata
Current default time zone: 'America/Toronto'
Local time is now: Wed Oct 12 11:35:37 EDT 2016.
Universal Time is now: Wed Oct 12 15:35:37 UTC 2016.
$ lxc-attach -n trusty
$ date
Wed Oct 12 11:36:02 EDT 2016
But got no effect on Xenial LXC container :
$ cat /etc/timezone > /var/lib/lxc/xenial/rootfs/etc/timezone
$ chroot /var/lib/lxc/xenial/rootfs dpkg-reconfigure -f noninteractive tzdata
Current default time zone: 'Etc/UTC'
Local time is now: Wed Oct 12 15:38:00 UTC 2016.
Universal Time is now: Wed Oct 12 15:38:00 UTC 2016.
# lxc-attach -n xenial
$ date
Wed Oct 12 15:38:06 UTC 2016
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1632766/+subscriptions
--
Mailing list: https://launchpad.net/~touch-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help : https://help.launchpad.net/ListHelp