180 points · by lionkor · 3y ago · 141 comments
Turns out something in proxmox (maybe a service?) doesn't understand daylight savings time (Dublin).
The only way to know was to google "proxmox systemd 100% cpu" and find above post.
Christ.
Edit: The fix, of course, is `ln -sf /usr/share/zoneinfo/Etc /etc/localtime`
Edit 2: Looks like that just unsets the timezone. It's too late for me to find the real fix, but you basically want to set the timezone to something else (like UTC).
I've advocated for over a decade as a systems engineer not to set system time to anything other than UTC. Not all languages or applications compensate for DST very well, and depending on your applications relationship with time it's a non-trivial problem to solve. What is far more trivial to do is to ship logs to a log server and let the UI of the log server translate time for the viewer of the logs. Almost every time I have argued with executives, managers, and SWEs without SE experience and lost something unexplainable and detrimental happens around DST.
Edit:
For the uninitiated I'll try to paint a clearer picture. All system time in Linux is tracked in seconds past Jan 1, 1970. The problem occurs in the translation between UTC and local time, which is handled by a library/package/module in your application. If your application is time sensitive and not looking for a literal time traveling event then things can get real weird, real fast. If there is a bug in that library/package/module things will also get real weird, real fast.
> If your application is time sensitive and not looking for a literal time traveling event...
One of my least-favourite facts is that these statements are misleading. Since Linux uses UTC and not TAI, it no longer tracks an absolute measurement of seconds since the unix epoch as it takes “leap seconds” in to account. As well, because of leap-seconds you can absolutely have time-travelling events.
https://developers.redhat.com/blog/2015/06/01/five-different...
Unix, not linux. I don’t even think they can track TAI, but I definitely have never seen one which does, they all define unix time as 86400*days since epoch + seconds since midnight.
Setting the timezone should have no such effect.
My guess it that it effectively unset it, in your case that probably does nothing(system time is utc and dublin is in utc) what was it set to before?
edit: all I can find is localtime(5) and it only says that /etc/localtime is the local time zone file.
March 2022 https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/19668...
March 2021 (Fedora) https://bugzilla.redhat.com/show_bug.cgi?id=1941335
systemd upstream fix https://github.com/systemd/systemd/pull/19075
There are terminal servers, for example, which are basically workstations. There are servers configured by other people for local time, and we may need to configure our own servers into its network.
There is server software out there that uses the host timezone. Heck, huge vendors do this regularly. This happens in log files, in schedulers, in notification emails, and so on. People want to see their log timestamps in their local time, they want to schedule in local time, and they want their emails to show events in their local time.
Yes, optimally, all times should always stored in UTC or UTC+offset formats, then displayed in local time only "at the end client". Generally, this is actually what happens. Windows, MacOS, UNIX, Linux, and Android all store the system clock as UTC and all system APIs use this.
So in some sense, we are all already using UTC on our servers. The time zone setting doesn't change the system clock to something other than UTC, it just tells user-mode software how the human users expect to see time formatted for display.
The problem is that server software especially is terrible at this. Just... bad. The worst offenders are text-based log files, which almost always get a formatted timestamp with an unspecified time zone. Could be UTC, could be the server's local time, could be Mars time, who knows?
In summary: don't blame system administrators for correctly configuring server settings. Blame the lazy software developers who can't be bothered to use ISO timestamps that specify time zones unambiguously, irrespective of the time zone setting.
Next thing you'll tell me to stop using space characters in file names...
For a terminal server it is not uncommon when different users connect from places with different time zones. It would make sense to have TZ in a user profile but keep UTC as a server system locale.
As far as practical use of UTC vs local time: I am a developer that happens to work with customers directly. It is difficult enough to get customer to provide timestamps for issues they report in local time, I cannot imagine they would be able to convert to UTC.
Love the local time!
What exactly do you mean by this? As in, what part of your software stack is doing this. IIRC if you set your OS to be in UTC then anything at the OS level will only speak UTC. Databases and your own software will do what they are told to do but systemd etc. will all speak UTC only. Even running date in the shell should give you a UTC timestamp.
The only question is, is the implementation user focused or developer prioritized
[0]: https://gist.github.com/stephanGarland/b7cdd963e0ac53ea42f8e...
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019716
Webapps should be timezone aware via the browser or user preferences, internal timezone should be whatever makes sense for logging et al.
I strongly prefer everything in UTC and changing time zone is an issue for only the vary top layer of the display/user interface/frontend whatever if absolutely needed - generally libraries designed for displaying have much more robust timezone handling than just random daemons and backend software.
All of the servers I run are located in Toronto, Canada: why do I care about UTC? What would having all of them being UTC get me?
A few jobs ago I took care of servers that were in: California, Ontario, Quebec, Switzerland, Singapore. UTC made sense there.
Local time is governed by local authorities; UTC, much less so.
Eliminates all the software bugs due to non-monotonically increasing time.
If you get bought by a company in the EU/UK or vice versa then it ultimately makes it easier to deal with time as you become part of a global company.
For a system to not boot in a particular time zone is a serious bug, but you should not blame the problem on the time zone, you should blame the problem on whatever is broken in some critical piece of code that probably should not be using local time.
I mean, yes, you can do that, but don't pretend that a program not handling unicode is the user's fault for typing unicode (s/unicode/timezones, s/typing/using).
EDIT: I'm just saying that you can't blame the user for using the features that come with the system.
> I've noticed systemd (PID=1) is running at 100% CPU utilization. That's not normal. I ran this command:
strace -f -p 1
> The process was reporting continuously attempt to access /etc/localtime file. That's also unusual.> I managed to get the output I was receiving on the console while tracking systemd process.
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3522, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3522, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3522, ...}) = 0
Maybe if it's endlessly failing to stat the target, any valid target might help.stat returns 0 on successful completion.
The correct fix would be timedatectl, but as you can guess, that's broken together with systemd.
When Debian switched to systemd in the default was when I began to seriously use OpenBSD and I've never regretted the decision.
Because the Unix process API is unreliable and unsafe ( http://catern.com/process.html ), managing processes is difficult to impossible in a general way under Unix systems including Linux. Linux gained some features to help with this, but for the longest time, PID 1 was the only process that could manage its child processes in a way that wasn't fraught with race conditions -- meaning systemd or something like it was the only way to have safe, effective process management because it tracked all that state in PID 1.
Blame Unix being broken, not systemd, for the problems systemd solves.
The only thing I dislike about systemd is that it is written in C, but otherwise it is a single purpose solution to the surprisingly complex problem of managing services during boot and running. I fail to see how state is relevant here — if it were written in Haskell it would also have state, almost by definition it has to handle external state. No Monad would help you there, there is just correct and not correct software.
You can't be saying this with a straight face. systemd project subsumes functionality of
- device hotplug
- user session manager
- cron
- logging
- network management
- time zone management
- time sync
- cgroup manager
- deleting /tmp files
- DNS resolver
- UEFI boot manager
and also dozen other things I've forgotten.
The Ubuntu bug is from 2022.
Curious that proxmox is hit in 2023. Proxmox must happen to have a particular systemd timer event setup by default that triggers this.
Backport hacks always come back to bite you in the end when your distro is running unsupported software, and it feels like I see something at least annually about Debian's "ensure everything is old so all bugs are predictable" ends up just causing pain.
Looks like the negative DST has already caused problems in the past and applications that can't handle it (ICU & OpenJDK) have to build tzdata as per the rearguard section / ziguard.awk.
Example, California had an energy crisis soon after WWII, and changed when day light savings started/ended. There are time zone rules that track this history exactly, including a note about how clocks lost 6 minutes a day because PG&E changed AC from 60 to 59.5 Hz:
https://github.com/eggert/tz/blob/71faa2a55db2c9f21f4099b58c...
* Eire after 1971: https://github.com/eggert/tz/blob/main/europe#L526
* Morocco after 2019: https://github.com/eggert/tz/blob/main/africa#L928
* Namibia between 1994 and 2017: https://github.com/eggert/tz/blob/main/africa#L1167
But.
It's 2023. Setting a non-UTC timezone shouldn't break your system (or applications). Bugs happen and this is one of them, but "set your system to UTC" isn't an appropriate response here.
It's perfectly appropriate to provide a workaround before the problem has actually been resolved.
With that the following reproducer is fixed:
TZ=Europe/Dublin faketime 2023-03-26 systemd-analyze calendar --iterations=5 'Sun *-*-\* 01:00:00'
[0]: https://git.proxmox.com/?p=systemd.git;a=commit;h=e7eb2b5864...
(just noticed that I wrote Ireland/Dublin instead of Europe/Dublin in the commit message)[1]: https://pve.proxmox.com/wiki/Package_Repositories#sysadmin_t...
For servers I manage, I absolutely refuse to use an OS with systemd. There have been too many unpredictable cases.
The DNS related issues seen (have they now been resolved?) where it takes over the DNS resolver functions and refuses to honor what you have put in e.g. /etc/resolv.conf ; a web search for "systemd breaks normal dns resolv.conf" will give you a lot of results ; unsure if this is now fully fixed.
Strange things with LXC based VMs moved/migrated between hosts, even if an offline move; I think in 1 case I just ended up creating a new VM from scratch; then rsync'ing everything over from the host node into the VM's directory.
e.g. Most DHCP clients have done that since... well, probably since DHCP was invented. See, for example:
https://wiki.debian.org/resolv.conf
If you want a static resolv.conf, but you're not using a completely static network config and have some kind of dynamic network management daemon, be that `dhclient`, or `NetworkManager`, or `systemd-resolved`, you've always needed to explicitly configure it to leave resolv.conf alone.
Not sure how this is a systemd issue?
In terms of problematic default services, I'd look at GNOME. systemd is just the medium.
Fix was to re-symlink `/etc/localtime` to proper time zone.
Didn't want or cared to dig into this deeper, but interesting to see that there are more issues about this.
For anyone interested, I manage around 20+ Proxmox machines with these Ansible roles:
https://github.com/liv-io/ansible-roles-debian
Example playbook:
https://github.com/liv-io/ansible-playbooks-example/blob/mas...
EDIT: Seems to be back.
Proxmox is based out of Vienna, Austria.
So a Timing glitch.
Because who wants to be bothered with Novice or Intermediate Tickets?
The main issue was always this one, having side functions like dealing with timezones breaking your pid 1. In such a case it is almost impossible to resolve the problem from the system itself you have to mount the drive with another OS or reinstall when possible.
When I shutdown I would like a shutdown sig to be sent to my database and then continue once it gets a successful response. No one wants that to just be killed because that would cause data loss.
When I shutdown I want my filesystem synced so things mid-write don't experience data loss.
The problem is badly written scripts that keeps sending a "one more min" response. But you could override that if you actually cared instead of just whining.
But as you wrote, If someone really cares, they would fix it.
PS: But what usually gets me about these 90s waits whenever I get them is that the message does not say which thing (unit, etc) is the issue. THAT is something worth criticising.
If it is taking 5 mins for my db to respond with "success" then either fix the db or switch it.
That's not systemd's fault that the database is rubbish.
Just because you decided to kill the database while it was still in use, that's your fault.
The concept of setting the time zone is a high level library thing already and all these systems, their standard time functions simply provide a time since some fixed epoch.
Ie see C time(), gettimeofday, clock_gettime, GetSystemTime. They’re all “UTC” based.
If a piece of server software is going out of its way to deal with local time APIs and blows up because of it - well it either legitimately needs to deal in local time, or it’s so poorly designed that simply keeping the system locale set to UTC isn’t somehow a magic fix. That’s just an adhoc assumption.