On 02/22/2015 09:46 AM, Patrick Shanahan wrote:
* Anton Aylward
[02-22-15 08:51]: [...] # 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 -
which isn't what we want and so we try creating lines in /etc/tmpfiles.d But that is compeltely beside the point.
The lines that matter are:
# Exclude namespace mountpoints created with PrivateTmp=yes x /tmp/systemd-private-* x /var/tmp/systemd-private-* X /tmp/systemd-private-*/tmp X /var/tmp/systemd-private-*/tmp The tmp.conf in/etc/tmpfiles.d/ is for maintaining config over updates and is the last/final word. Some experimenting reveals a possible solution. It appears that there is no default time or it is beyond expectations. The following change helps:
d /tmp 1777 root root 2d - d /var/tmp 1777 root root 2d -
note the added "2d" and it's position. This is described in the man file but it's usage not clear until it is correctly applied and just works. One thing I still do not understand is the cleaning of files in directories marked "PrivateTmp=yes", nor can I find an effective override. Files below those directories*are* cleared/removed/cleaned, but not the directories. Seems this would eventially cause a problem.
Intrigued by the issue, I thought I would offer another, albeit
non-authoritative, data point on this matter. My x86-64 13.1 install has been
running 24/7 for the better part of a year with heavy use made of the /tmp dir.
Currently it contains (virtually nothing):
[08:52 alchemy:.../scr/tmp/stack] # du -hcs /tmp
2.3M /tmp
2.3M total
Both the following are empty:
/etc/tmpdirs.d/
/etc/tmpfiles.d/
The only relevant config found is:
/usr/lib/tmpfiles.d/tmp.conf
with content (without comment):
d /tmp 1777 root root -
d /var/tmp 1777 root root -
x /tmp/systemd-private-*
x /var/tmp/systemd-private-*
X /tmp/systemd-private-*/tmp
X /var/tmp/systemd-private-*/tmp
Checking the service shows the last run of "Cleanup of Temporary Directories"
occurred Feb 22 22:07:46
(yes, I get the gvfs failure as well, it is irrelevant to whether /tmp is
cleaned, and simply indicates gvfs was NOT mounted at the time the cleanup was
run [check /var/run/user/UID]):
# systemctl status systemd-tmpfiles-clean.service
systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static)
Active: inactive (dead) since Sun 2015-02-22 22:07:46 CST; 11h ago
Docs: man:tmpfiles.d(5)
man:systemd-tmpfiles(8)
Process: 13040 ExecStart=/usr/bin/systemd-tmpfiles --clean (code=exited,
status=0/SUCCESS)
Main PID: 13040 (code=exited, status=0/SUCCESS)
Feb 22 22:07:46 alchemy systemd-tmpfiles[13040]: stat(/run/user/1000/gvfs)
failed: Permission denied
Feb 22 22:07:46 alchemy systemd[1]: Started Cleanup of Temporary Directories.
A quick check of the journal from last boot shows, at least on my system, the
cleanup of /tmp is called daily:
# journalctl -u systemd-tmpfiles-clean.service
-- Logs begin at Sun 2015-02-15 21:52:53 CST, end at Mon 2015-02-23 09:14:09 CST. --
Feb 15 22:07:46 alchemy systemd[1]: Starting Cleanup of Temporary Directories...
Feb 15 22:07:46 alchemy systemd-tmpfiles[1876]: stat(/run/user/1000/gvfs)
failed: Permission denied
Feb 15 22:07:47 alchemy systemd[1]: Started Cleanup of Temporary Directories.
Feb 16 22:07:46 alchemy systemd[1]: Starting Cleanup of Temporary Directories...
Feb 16 22:07:46 alchemy systemd-tmpfiles[14082]: stat(/run/user/1000/gvfs)
failed: Permission denied
Feb 16 22:07:46 alchemy systemd[1]: Started Cleanup of Temporary Directories.
Feb 17 22:07:46 alchemy systemd[1]: Starting Cleanup of Temporary Directories...
Feb 17 22:07:46 alchemy systemd-tmpfiles[18255]: stat(/run/user/1000/gvfs)
failed: Permission denied
Feb 17 22:07:46 alchemy systemd[1]: Started Cleanup of Temporary Directories.