[Bug 2019026] Re: systemd /tmp cleaning is suboptimal
Steve Langasek
2019026 at bugs.launchpad.net
Fri Feb 16 15:18:23 UTC 2024
On Fri, Feb 16, 2024 at 01:06:07PM -0000, Paride Legovini wrote:
> Maybe we could make that 40d, as 30d is likely to be a time interval at
> which a lot of periodic things happen (e.g. an off-site backup).
The period here is the age at which files are considered old and to be clean
up, not the interval at which the clean-up happens.
Also fwiw I have edited my /usr/lib/tmpfiles.d/tmp.conf locally (using a
diversion) since this bug was moving forward and it doesn't actually seem to
be working.
$ grep -v ^# /usr/lib/tmpfiles.d/tmp.conf
d /tmp 1777 root root 30d
$ sudo find /tmp -type f -mtime +30 | wc -l
130319
$ sudo find /tmp -atime +30 | wc -l
8
$ sudo find /tmp -ctime +30 | wc -l
744
$
So at least on desktop I have something that is regularly changing
ctime/atime on the contents of /tmp and therefore preventing them from being
garbage collected...
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer https://www.debian.org/
slangasek at ubuntu.com vorlon at debian.org
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2019026
Title:
systemd /tmp cleaning is suboptimal
Status in systemd package in Ubuntu:
Confirmed
Bug description:
Historically on Debian and Ubuntu, before systemd, the default
handling of /tmp was to periodically, and at boot, remove all
files/directories older than 30 days; and leave other contents alone.
With the move to systemd, the "default" (really, hard-coded in
/usr/lib/tmpfiles.d/tmp.conf) is to not clean /tmp periodically, but
at boot to remove all contents.
This is suboptimal for two reasons.
By cleaning /tmp *only* at boot, if a system makes heavy use of /tmp
and has lots of inodes under it, possibly due to failures of some
process to clean up after itself, at boot the system will be
unavailable for an unnecessarily long time while these files are
removed.
By cleaning *all* files under /tmp, this makes a reboot an Event where
in-progress files may be unnecessarily lost.
While the FHS does not *guarantee* that files under /tmp will persist
across boot (because /tmp may be a tmpfs), it also does not *require*
that /tmp be cleared on boot.
Although data stored in /tmp may be deleted in a site-specific
manner, it is recommended that files and directories located in
/tmp be deleted whenever the system is booted.
FHS added this recommendation on the basis of historical
precedent and common practice, but did not make it a
requirement because system administration is not within the
scope of this standard.
I therefore believe the correct value for /usr/lib/tmpfiles.d/tmp.conf
to restore past behavior is 'd /tmp 1777 root root 30d'.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2019026/+subscriptions
More information about the foundations-bugs
mailing list