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

changing timezones only works partially on linux 24.04 #21336

Open
emaayan opened this issue Nov 26, 2024 · 9 comments
Open

changing timezones only works partially on linux 24.04 #21336

emaayan opened this issue Nov 26, 2024 · 9 comments

Comments

@emaayan
Copy link

emaayan commented Nov 26, 2024

i don't know exactly if this is a bug report or not.. but we've noticed that in ubuntu 24 changing the time zone doesn't seem to take effect in all places
for example doing timedatectl set-timezone don't seem to touch /etc/timezone which is what java takes it's values from by default in ubuntu it seems that dpkg-reconfigure tzdata is considered the standard way of doing things but i understand you guys are using dbus and systemd api's which means this wont' get affected.

@martinpitt
Copy link
Member

Indeed Debian carried a systemd patch to update /etc/timezone for many years (I was even part of that), but it was removed last year: https://salsa.debian.org/systemd-team/systemd/-/commit/5d4b34101117b9b9e64ecbc9b602113f91d4e837

"tzdata will no longer create it, we can just rely on /etc/localtime". Does it actually work to just remove it from your system? (Move it away so that you can restore it easily if it breaks Java)

@emaayan
Copy link
Author

emaayan commented Nov 28, 2024

what do you mean remove it? try to completely remove /etc/timezone and where java will try and take timezone info? won't that brake other stuff in ubuntu?

@martinpitt
Copy link
Member

I'm no expert here, but Debian plans to remove /etc/timezone, see https://bugs.debian.org/822733. It was restored later on in https://tracker.debian.org/news/1421751/accepted-tzdata-2022g-6-source-into-unstable/ and the migration postponed to Debian 13. Hence I suggested trying what happens if you move it away now, if Java falls back to /etc/localtime. Fedora and RHEL haven't had /etc/timezone for many many years, and Java is definitively a thing for RHEL. So there's a good chance that it actually works.

We will not change anything here in Cockpit -- either /etc/timezone is obsolete, and then the distributions will clean it up eventually (that seems to be the current plan); or it isn't, then that systemd patch should be restored.

@emaayan
Copy link
Author

emaayan commented Nov 28, 2024 via email

@martinpitt
Copy link
Member

cockpit-pcp is obsolete, an upgrade should remove it (it got absorbed into cockpit-bridge)

@emaayan
Copy link
Author

emaayan commented Nov 28, 2024

I'm no expert here, but Debian plans to remove /etc/timezone, see bugs.debian.org/822733. It was restored later on in tracker.debian.org/news/1421751/accepted-tzdata-2022g-6-source-into-unstable and the migration postponed to Debian 13. Hence I suggested trying what happens if you move it away now, if Java falls back to /etc/localtime. Fedora and RHEL haven't had /etc/timezone for many many years, and Java is definitively a thing for RHEL. So there's a good chance that it actually works.

We will not change anything here in Cockpit -- either /etc/timezone is obsolete, and then the distributions will clean it up eventually (that seems to be the current plan); or it isn't, then that systemd patch should be restored.

that seems to work too, but won't updating tzdata will automatically create this file? or do i need to remove tzdata too?

@martinpitt
Copy link
Member

won't updating tzdata will automatically create this file

Right, this was just a test, not a permanent solution for Ubuntu 22.04. I was mostly wondering if Java still needs /etc/timezone somehow (which would be a surprise, but you never know..)

do i need to remove tzdata too?

Ugh no, this is very important. It's just /etc/timezone which is obsolete; /etc/localtime symlink and the actual time zone data continue to be (very) relevant.

Thanks for checking!

@martinpitt
Copy link
Member

not a permanent solution for Ubuntu 22.04

Sorry, you said 24.04, but same difference really -- Debian 13 will drop it, and some Ubuntu 25.XX or 26.XX will eventually inherit it.

@emaayan
Copy link
Author

emaayan commented Nov 28, 2024

so basically i need to make sure /etc/timezone gets removed every time i start my java service

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