Directory /tmp is not emptying or unmounting. Contains files from months past, including over 100 PDF files left over from Okular. Have also noticed an error message flashing by about /tmp not unmounting during computer restart or shutdown.
# Clear tmp directories separately, to make them easier to override
# SUSE policy: we don't clean those directories
d /tmp 1777 root root -
d /var/tmp 1777 root root -
into
# Clear tmp directories separately, to make them easier to override
# My policy: empty /tmp en /var/tmp on boot.
D! /tmp 1777 root root 1d
D! /var/tmp 1777 root root 1d
See
man 5 tmpfiles.d
================================
For making /tmp a tmpfs:
Add an entry into /etc/fstab
Before mounting this file system for the first time (either by command, or by reboot) you should clean the present /tmp directory as good as possible. Existing contents will still occupy disk space when you mount a file system over it.
Hi
Then I must say you would have something funky going on or applications not cleaning up (a bug report)…?
On my machines here I see less than 200MB of /tmp space usage, end of the day openSUSE leaves these sorts of thing for the user/administrator to configure…
To put it in other words, whoever is responsible for dumping files/directories in /tmp should be the one responsible to remove/clean it up. (clean your own…)
otherwise, yeah a bug report is needed…
Yes, in original Unix, it was “normal” to clean /tmp on boot. I assume that in many Linux distributions this is still the default. It seems that in the past openSUSE (or it’s forerunners) users have complaint that they lost data they put in /tmp over a (unexpected?) shutdown/boot. As a result the default was changed to what it is now.
As a good system manager, you should watch the filling grade of your file systems and, independent if /tmp is on a separate file system or not, watch /tmp. When /tmp keeps on growing beyond a reasonable size, you should do something about it (as others above already suggested), like:
Find out which user(s) is using /tmp as a permanent storage, either on purpose or, unknowingly, by incident and talk to them.
Find applications that use /tmp as long time storage over sessions and see if you can configure them to behave better (or even complain to their makers).
Change the default of cleaning at boot or using a tmpfs to let it vanish at shutdown (both described above).
As actions on shutdown/boot will not help much on systems that are running for days/weeks/months without boot, a cron job to e.g. remove all files not in use and not touched for two days might be something to consider.
Best solution. /tmp is temporary, as it should be.
Also, ignore my statement that I was seeing an unmounting error about /tmp. The error is not about /tmp, it’s actually about /var not unmounting. So many problems to keep track of …
Hi
In your use case, which is how it should be FHS on /tmp it’s recommended to be cleaned out, but like the standard says system admin is not in scope and openSUSE likes to follow upstream as much as possible…
Take a look at the man (5) page for ‘tmpfiles.d’ – I have a file in ‘/etc/tmpfiles.d/’ named “zypp-var-tmp.conf” which does only one thing:
R! /var/tmp/zypp.*
Code reading of “/usr/lib/tmpfiles.d/tmp.conf” and “/usr/lib/tmpfiles.d/var.conf” will also give some enlightenment WRT what the systemd “tmp files cleanup” is doing for the openSUSE case …
I admit that, I deal with a current SDDM issue by means of a (user == root) “run at boot time” ‘/etc/cron.d/’ cron job: