Temporary files (/tmp)
Because swap is only zram, a RAM-backed /tmp (tmpfs) would always take real memory – forgotten
files there cannot be swapped out to disk and neither earlyoom nor the fork guard can free them.
On installed LuxOS systems /tmp is therefore on the disk (encrypted only when the system is - disk
encryption is an option in the installer, off by default):
- Btrfs root in a subvolume (every LuxOS installation): own subvolume
@tmpat the top level of the file system, mounted from/etc/fstabon/tmpwith the root's options plusnodev,nosuid. Programs may still run from/tmp(installers, AppImages, Steam, pip builds), so there is nonoexec.@tmpis not part of system snapshots or a rollback (only@is), backups never include/tmp. - Other root file systems (ext4, xfs, f2fs, Btrfs without subvolumes): systemd's
tmp.mountis masked (/etc/systemd/system/tmp.mount→/dev/null) and/tmpis a directory of the root. - A separate
/tmpfrom the manual partitioning (installer) or your own/tmpline in fstab / owntmp.mountin/etcis left alone. The live ISO keeps/tmpin RAM (tmpfs). - Cleaning (
/usr/lib/tmpfiles.d/luxos-tmp.conf:D /tmp 1777 root root 10d):/tmpis emptied at every start, while running files not touched for 10 days are removed. X11 directories (/tmp/.X11-unix…) are created again by systemd./var/tmpis unchanged (30 days, kept over restarts). Secrets and sockets of LuxOS programs belong in$XDG_RUNTIME_DIR(RAM), not/tmp.
New installations get @tmp from the installer. Existing installations switch automatically:
luxos-tweaks (install script, or luxos-tmp-setup.service once at start when the package update
could not do it, e.g. when started from a snapshot) runs /usr/lib/luxos/luxos-tmp-setup, which
creates @tmp (on a privately mounted top level, the running /tmp is not touched), tries to mount
it with the final options and only then adds the fstab line. It takes effect at the next start.
Done = /var/lib/luxos/tmp-on-disk; after that nothing is changed again (removing the fstab line by
hand is respected). Do not mask tmp.mount together with a /tmp fstab line – the mask in
/etc would also switch off the fstab mount; the fstab line alone already replaces systemd's tmpfs.
Check
findmnt /tmp # /dev/...[/@tmp] btrfs ... nosuid,nodev ... subvol=/@tmp
cat /var/lib/luxos/tmp-on-disk # method=btrfs|mask|fstab|custom
journalctl -b -u luxos-tmp-setup # message of the one-time switch at start
Programs that keep large temporary data should still delete it themselves; files in /tmp survive
until the next start (or 10 days).