systemd / systemd

The systemd System and Service Manager
https://systemd.io
GNU General Public License v2.0
13.18k stars 3.77k forks source link

Put time limit on systemd-tmpfiles-setup by default #31641

Closed marekrost closed 6 months ago

marekrost commented 7 months ago

Component

systemd-tmpfiles

Is your feature request related to a problem? Please describe

I have just waited 20 minutes for my computer to boot.

Describe the solution you'd like

There should be a limit on how long the job can run during boot.

Describe alternatives you've considered

I have considered overriding it just myself locally, but I believe this would be better solution as a whole.

The systemd version you checked that didn't have the feature you are asking for

No response

poettering commented 7 months ago

Ahum. Why would that take 3mins? please provide logs.

marekrost commented 7 months ago

I think I've identified what behavior causes the long startup of systemd-tmpfiles-setup.service, I'll get the logs.

marekrost commented 6 months ago

The long boot time seems to be caused by large volume of files inside /tmp on my system. Specifically, these files originate from: https://github.com/wkeeling/selenium-wire/issues/408

Attached boot log from 2 days ago shows that system boot got stuck cleaning up these temporary files for nearly 8 minutes straight.

2024-04-08_boot.log

I suppose the question is - is this correct and expected behavior on the side of systemd-tmpfiles-setup? Or no-one just expected huge amount of files in /tmp?

poettering commented 6 months ago

/tmp/ should be a tmpfs generally. If you distro still is using a traditional fs there, please file a bug. It's 2024.

If it's tmpfs then clean-up is entirely automatic, because it's backed by swap (i.e. can just get lost during boot), rather than a traditional fs (where stuff must be synced to disk), which requires unnecessary write cycles at both shutdown and startup.

Generally, we have to run tmpfiles.d/ stuff during boot, to guarantee that the system is in order (ie. /tmp/ must be rleatively clean so that the system can operate correctly). It's simply not OK to leave stuff half set up.

This seems to be a local misconfiguration mostly the way I see it.

marekrost commented 6 months ago

First of all, thanks for the insight. The machine would be a clean Debian 12.3 install, so I'll look in that direction.

I can see how this is user-related or, at most, distro-specific issue. Patching the time limit would make sense only on distros that both use systemd and do not use on tmpfs on /tmp by default.

I'm closing the feature request.