On 02/22/2015 09:46 AM, Patrick Shanahan wrote:
* Anton Aylward<opensuse@antonaylward.com> [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. <snip...> So for all practical purposes, the unit systemd-tmpfiles-clean.service is running on my box daily at 22:07 (which is the time of last boot after return from San Antonio on the 15th). The service file looks for which files to clean in: ConditionDirectoryNotEmpty=|/usr/lib/tmpfiles.d ConditionDirectoryNotEmpty=|/usr/local/lib/tmpfiles.d ConditionDirectoryNotEmpty=|/etc/tmpfiles.d ConditionDirectoryNotEmpty=|/run/tmpfiles.d of which the only non-empty directory on my system is: /usr/lib/tmpfiles.d and the only relevant config is /usr/lib/tmpfiles.d/tmp.conf (contents posted above) So my only guess is that these are the pieces of the puzzle that are supposed to insure tmpfiles are cleaned. Checking the journal will tell you if they are running. If the only entry in the journal is the gvfs failure without the Starting/Started Cleanup of Temporary Directories..., then figuring out why they are not running will likely solve the issue. I don't recall doing anything strange/special on install regarding tmpfiles, although I do go though each config setting and I DO set a traditional 'root' account and password. I've always been leery about not using a traditional root account just for the reason that some hooked process that relies on being run by root -- won't -- in the absence of a traditional root account. I doubt it is related. Regardless, here is one data-point among others where the cleaning of tmpfiles seems to be working as it should. From the original post, it appears Peter has all parts of the cleanup configuration discussed above. The only additional checks I see are to check the journal and find out just what is being run (and when) and go from there. Further, there should be a way to manually kick-off the cleaning of tmpfiles. I would figure that out and attempt to force a cleaning and check the results/errors there. That will provide a further bit of info. Good luck. (SysVinit was so much cleaner...) -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org