-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bookworm] Timezone setting is not propagated to containers #20925
Comments
@nmoray can the logic be updated instead to use /etc/localtime directly from host instead of using /etc/timezone |
@vivekrnv It is not recommended to mount the symlink. That is why, I mounted only the timezone and is creating the symlink at docker runtime. |
Hmm, so one way i could think is this. @nmoray Can you try if this solves the problem?
|
@nmoray, could you please take a look at Vivek's comments and rework your patch? |
@prabhataravind Okay, let me look into it. |
I haven't but looks like that command is used in older systems or systems without systemd. Besides "config clock" command, in our deployments we use DHCP for mgmt ip. When eth0 recieved mgmt-ip, it also invokes the timedatectl command and changes the timezone. Thus, we should consider timedatectl as the command that is used to change timezone and work upon it to solve this issue |
@vivekrnv Okay. IMO, following change will not work out. When the container is rebooted, "timedatectl show -p Timezone --value" will always return the timezone set inside the container only. So it will eventually create the symlink based on the default timezone only.
Presently, I can think of three options to solve this issue.
|
@vivekrnv There is one better way. The method timezone_update() from hostcfgd is responsible for updating the timezone. We can update the /etc/timezone file inside this method.
|
@vivekrnv Please try out this fix and let me know if it works. |
@nmoray, I'm in favour of option 3, did some preliminary testing and the change is working. I know its not ideal but this should work as long as the container has tzdata package installed. Problem with option 1 & 2, they can solve the "config cli" flow but not the timezone setting through DHCP flow. Eg for the dhcp flow:
For both flows to work, i could only think of option 3. I will raise a fix for this |
@vivekrnv one way to fix your DHCP flow is by overriding systemd-timedated.service. We can write the new timezone in /etc/timezone file as a part of ExecStartPost. This way, we can achieve our goal with minimal change. |
@vivekrnv for your reference,
Note: I tested it on the earlier debian version so I used nik_timezone as a temporary file in place of /etc/timezone. |
/etc/timezone is deprecated in Debian. In SONiC, we should try to stay close to Debian for generic config and thus I’m not in favor in patching systemd to update /etc/timezone. |
Description
Timezone setting is expected to propagate to the containers. But after bookworm upgrade in SONiC, it is broken
202311
config clock timezone Asia/Pyongyang
202405 and above:
After config reload, containers are expected to have timezone change but it is not seen
Triage
Issue lies in timedatectl command not updating /etc/timezone in systemd version used on bookworm
Ref: https://unix.stackexchange.com/questions/451709/timedatectl-set-timezone-doesnt-update-etc-timezone
This PR #14000 (Which fixes the timesync issue between host and container) uses /etc/timezone as reference to update the timezone in container.
The text was updated successfully, but these errors were encountered: