[SOLVED] LXC not getting host time

CharlesErickT

Member
Mar 15, 2017
52
7
8
31
Hello,

From my understanding, a container should get his date and time settings from the host ?

I'm asking because all my containers on a said host are in UTC timezone while the host is on the EST timezone. Rebooting the host and the containers changed nothing.

Do I need to set /etc/localtime manually in the container ? What if NTP is installed on the host ? Shouldn't the containers pull the NTP time from the host ?

The containers are Ubuntu 16.04 LTS

and here's my pveversion -v on the host
Code:
proxmox-ve: 5.1-25 (running kernel: 4.13.4-1-pve)
pve-manager: 5.1-35 (running version: 5.1-35/722cc488)
pve-kernel-4.13.4-1-pve: 4.13.4-25
libpve-http-server-perl: 2.0-6
lvm2: 2.02.168-pve6
corosync: 2.4.2-pve3
libqb0: 1.0.1-1
pve-cluster: 5.0-15
qemu-server: 5.0-17
pve-firmware: 2.0-3
libpve-common-perl: 5.0-20
libpve-guest-common-perl: 2.0-13
libpve-access-control: 5.0-7
libpve-storage-perl: 5.0-16
pve-libspice-server1: 0.12.8-3
vncterm: 1.5-2
pve-docs: 5.1-12
pve-qemu-kvm: 2.9.1-2
pve-container: 2.0-17
pve-firewall: 3.0-3
pve-ha-manager: 2.0-3
ksm-control-daemon: 1.2-2
glusterfs-client: 3.8.8-1
lxc-pve: 2.1.0-2
lxcfs: 2.0.7-pve4
criu: 2.11.1-1~bpo90
novnc-pve: 0.6-4
smartmontools: 6.5+svn4324-1
zfsutils-linux: 0.7.2-pve1~bpo90

Thanks
 
set your timezone in your lxc container with:

> dpkg-reconfigure tzdata
 
  • Like
Reactions: _gabriel
set your timezone in your lxc container with:

> dpkg-reconfigure tzdata
Then the time will be synchronise with the host if they are on the same timezone and the host is an NTP server or they are separate and not related ?
 
The timezone is normally used purely for the purpose of dispalying the time or parsing user input. Internally your container will use the host's clock.
So if they're using the same timezone, they should display the same time, but one's timezone setting will not influence the other's.
 
I would like to start the ntp service in a (debian12) lxc container, for exposing the host time to the other clients.
The syntax that was working properly on debian11 lxc container, now brings to the error

systemd[1]: ntpsec.service - Network Time Service was skipped because of an unmet condition check (ConditionCapability=CAP_SYS_TIME)

Obviously, I have already tried all other fix described in this post.
Can anybody point me into the right direction?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!