Discussion:
Bug#1070482: systemd: tmpfiles.d not cleaning /var/tmp by default
(too old to reply)
Luca Boccassi
2024-05-27 23:50:02 UTC
Permalink
Here's two paragraphs, one for each change, for the release notes:

/tmp/ is now by default a tmpfs, via the tmp.mount unit provided by the
systemd package. The previous setup can be restored simply by masking
the unit locally with:

sudo systemctl mask tmp.mount

or:

sudo touch /etc/systemd/system/tmp.mount



On new installations, tmpfiles.d will now cleanup by default /tmp/
every 10 days, and /var/tmp/ every 30 days. The legacy behaviour can be
restored with a local override if needed:

echo 'D /tmp 1777' | sudo tee /etc/tmpfiles.d/tmp.conf

This override will be automatically provided for upgrades of existing
systems from previous releases to Trixie. As a reminder, individual
files and directories can be marked for exclusion from cleanups with
the 'x' type configuration line as described in the tmpfiles.d manpage,
for example:

echo 'x /tmp/my-precious' | sudo tee /etc/tmpfiles.d/precious.conf
--
Kind regards,
Luca Boccassi
Richard Lewis
2024-05-31 00:20:01 UTC
Permalink
- More context and explanation would be helpful - suggestions below,

- Based on the discussion on d-devel, the tmpfs change is much less
controversial and so should be lower down.

- how do we describe the previous postition /tmp was: a regular
directory? a partition?

- some obvious questions need answering:

* if i have a file in /tmp (and disable the other change) what
actually happens to that file? is it moved "into" the tmpfs or is it
hidden by the tmpfs?

* if i have /tmp as a 2TB separate disk partition do i just lose that
space? or does tmpfs immediately gobble up all my available RAM?

* what happens to my files if i run out of memory because someone
wrote a 500GB file to /var/tmp?

- you could do more to explain the benefits and rationale here - tmpfs
is (i assume) faster?

- sudo is not how most(?) debian users do things
- tmpfiles.d should be systemd-tmpfiles(1) i think?
- using names like /etc/tmpfiles.d/tmp.conf might clobber existing files?
- highly optimistic about how well people know systemd!

=================================================================
This needs an edit/cut, but:

Debian has made two major changes for new installations to the temporary
directories (/tmp and /var/tmp). Because there is a small risk of data
loss, these changes have not been made for upgrades. You may wish to
adopt the new defaults as explained below.

On new installations, systemd-tmpfiles(1) will now delete files in /tmp
and /var/tmp while the system is running. Previously, files in those
directories were only deleted on reboot, but now files in /tmp will be
deleted after 10 days, and files in /var/tmp after 30 days. [is this
really the defualt it seems very short?] If you adopt this change you
can tell systemd-tmpfiles not to delete individual files by making a
file in /etc/tmpfiles.d with lines such as

x /var/tmp/my precious file.pdf
x /tmp/foo

Please see systemd-tmpfiles(1) for more information. On new
installations, the previous behaviour can be restored by creating a file
tmp.conf in /etc/tmpfiles.d containing 'D /tmp 1777' [are you sure this is the correct syntax???]

In addition, on new installations, the /tmp/ directory is now stored in
memory, using a tmpfs(LINK). This should make applications that use
temporary files faster. You can adopt the new default by running
'systemctl unmask tmp.mount' as root [i assume?]. (If you created /tmp
as a separate partition you may want to reclaim the space using lvm or
sfdisk?).

The new behaviour allocates x% of memory to the tmpfs but you can change
this by [how?]. If you have large files in /tmp and you run out of
memory then [what happens?]. On new installations you can make /tmp a
regular directory by running 'systemctl mask tmp.mount' as root [i
assume?].

These changes have been made to align Debian with other distributions,
and you should adapt any local programs that store data in /tmp or
/var/tmp for long periods to use alternative locations, such as ~/tmp/
or [exclude files from deletion as explained above?]..... [i think there
are more points in the d-devel discussion that need making here]

===================================================================
Loading...