Skip to content
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

Open
vivekrnv opened this issue Nov 26, 2024 · 1 comment
Open

[Bookworm] Timezone setting is not propagated to containers #20925

vivekrnv opened this issue Nov 26, 2024 · 1 comment

Comments

@vivekrnv
Copy link
Contributor

Description

Timezone setting is expected to propagate to the containers. But after bookworm upgrade in SONiC, it is broken

202311

  1. Set a new timezone: config clock timezone Asia/Pyongyang
  2. Updated on host immediately:
timedatectl show
Timezone=Asia/Pyongyang
TimeUSec=Wed 2024-11-27 06:17:03 KST
  1. config save & config reload for the change to be updated in the container.
docker exec eventd zdump /etc/localtime
/etc/localtime  Wed Nov 27 06:20:09 2024 KST

docker exec eventd cat /etc/timezone
Asia/Pyongyang

docker exec eventd date
Wed Nov 27 06:20:39 KST 2024

202405 and above:

config clock timezone Asia/Pyongyang

timedatectl show
Timezone=Asia/Pyongyang
TimeUSec=Wed 2024-11-27 06:37:01 KST

zdump /etc/localtime
/etc/localtime  Wed Nov 27 06:37:15 2024 KST

After config reload, containers are expected to have timezone change but it is not seen

docker exec eventd zdump /etc/localtime
/etc/localtime  Tue Nov 26 21:39:00 2024 UTC

docker exec eventd date
Tue Nov 26 21:39:09 UTC 2024

docker exec eventd cat /etc/timezone
Etc/UTC

cat /etc/timezone
Etc/UTC (Even on host, this file is not updated)

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

/etc/timezone appears to be mostly Debian-specific (including derivatives). On Debian systems, timedatectl set-timezone also updates /etc/timezone, in version of systemd older than 252.6-1 (so until Debian 11 included).

This PR #14000 (Which fixes the timesync issue between host and container) uses /etc/timezone as reference to update the timezone in container.

@vivekrnv
Copy link
Contributor Author

@nmoray can the logic be updated instead to use /etc/localtime directly from host instead of using /etc/timezone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants