On 4/3/21 12:02 PM, Peter McD wrote:
Am 03.04.21 um 16:44 schrieb Till Dörges:
Am 03.04.21 um 13:39 schrieb Peter McD:
Anyway I change q /var/tmp 1777 root root 1d two reboots and /var/tmp still gets cleared?
Yes, that's what I'd expect. But beware that you have to edit the correct configuration file. After the change in the filesystem RPM it should be /etc/tmpfiles.d/fs-var-tmp.conf (rather than /etc/tmpfiles.d/tmp.conf)
So I move from /usr/lib/tmpfiles.d/fs-var-tmp.conf to /etc/tmpfiles.s/
and modify # d /var/tmp 1777 root root - to d /var/tmp 1777 root root 1d
I expect after a reboot older folders/files. e.g. drwx------ 3 root root 4096 3. Apr 17:40 systemd-private-6704694542b3421f8612991315fd7962-chronyd.service-RNsuvq
But several reboots later there are only the folders/files with the same /date/time of the latest boot time.
e.g. drwx------ 3 root root 4096 3. Apr 17:56 systemd-private-6d19ab9a0f284936a9177444417f38b8-chronyd.service-33ZqOB
What is wrong?
Peter
I'm not sure I understand your question. Perhaps this may help . . . "The age of a file system entry is determined from its last modification time (mtime), its last access timestamp (atime), and (except for directories) its last status change timestamp (ctime). Any of these three (or two) values will prevent cleanup if it is more recent than the current time minus the age field." To see what systemd-tmpfiles is doing, do: #env SYSTEMD_LOG_LEVEL=debug systemd-tmpfiles --clean You will see the exceptions. E.g., systemd folders are skipped because a glob in an earlier config file has protected it; some files will be skipped because they are actually a "live socket" (like sddm*); some files/folders may be updated by the systemd process itself before the clean executes, such as runtime-root. Your "1d" age parameter should work fine. Just note however that there are programs which will put a file under /tmp that it will use as long as it is open but will not be protected from deletion, this can happen with X. Consequently, deleting that file can crash or lock that program. So when I was once testing using an age of 1h, I crashed X. "1d" should avoid this, but even with that I did once see an application program with a file in /tmp that was >day old, and it locked when that file was deleted (I suspect this is very rare, though). Of course if you boot daily that avoids such problems. An alternative that guarantees the cleaning will only happen at boot, despite whenever systemd-tmpfiles may be run, is to place a "!" after the "d" command (i.e., "d!") and change the systemd-tmpfiles-clean.service file to add the "--boot" flag. This way systemd-tmpfiles will always ignore the cleaning command except at boot. HTH, --dg