[Bug 2088268] Re: systemd /tmp cleaning removes files that it shouldn't
Marc Deslauriers
2088268 at bugs.launchpad.net
Thu Feb 13 13:17:42 UTC 2025
So, before systemd-tmpfiles was used, Ubuntu used tmpreaper to perform
periodic cleaning of the /tmp dir. tmpreaper had a list of exceptions:
--protect '/tmp/.X*-{lock,unix,unix/*}' \
--protect '/tmp/.ICE-{unix,unix/*}' \
--protect '/tmp/.iroha_{unix,unix/*}' \
--protect '/tmp/.ki2-{unix,unix/*}' \
--protect '/tmp/lost+found' \
--protect '/tmp/journal.dat' \
--protect '/tmp/quota.{user,group}' \
Looking at the /usr/lib/tmpfiles.d directory, it looks like only a few
files are excluded by the automatic deleting, for example the ones
listed in systemd-tmp.conf.
Disabling automatic cleaning isn't a viable solution, as that would
reintroduce issues with long-running systems.
So, the best way to tackle this issue IMHO would be for each affected
package to ship a configuration file in /usr/lib/tmpfiles.d that list
files that shouldn't be deleted.
Please add to this bug the packages that are affected by automatic
cleaning.
--
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/2088268
Title:
systemd /tmp cleaning removes files that it shouldn't
Status in systemd package in Ubuntu:
Confirmed
Status in xorg package in Ubuntu:
Confirmed
Bug description:
On Ubuntu 24.04.1, systemd 255.4-1ubuntu8.4, the fix for bug #2019026
causes files under /tmp to be removed if their age is greater than 30
days. However, there are files under /tmp that should not be removed
at runtime regardless of their age (whether they belong in that
directory at all is a separate question), for example those listed in
/usr/lib/tmpfiles.d/x11.conf (I have witnessed the disappearance of
X11 lock files, though the sockets are still there; /tmp/.XIM-unix and
/tmp/.font-unix have also disappeared).
I am not familiar enough with systemd-tmpfiles to figure out whether
those files can be properly protected from removal with a tmpfiles.d
configuration change, but I do know that the current configuration
does not do that.
I noticed this problem when a couple of TigerVNC sessions became
inaccessible a month after starting them, which turned out to be
because the "cached" password file in /tmp/tigervnc.XXXXXX/passwd was
removed. This is at least partially a bug in tigervnc, but the problem
also affects other critical not-to-be-removed-or-else files under
/tmp.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2088268/+subscriptions
More information about the foundations-bugs
mailing list