You are not logged in.
I am using the Default settings.
systemd-tmpfiles-clean.timer is active
and
systemd-tmpfiles-clean
is running as scheduled, but old files are not cleared from /var/tmp. In particular older files in sub-directories of /var/tmp/ are not being cleaned. I have files from April that have not been cleared
Any additional setup that I need.
Last edited by odror (2025-01-29 01:19:12)
Offline
grep -rE '^[dDe].*var' /etc/tmpfiles.d/* /run/tmpfiles.d/* /usr/local/lib/tmpfiles.d/* /usr/lib/tmpfiles.d/* /usr/local/share/user-tmpfiles.d/* /usr/share/user-tmpfiles.d/*
grep -rE 'var/tmp' /etc/tmpfiles.d/* /run/tmpfiles.d/* /usr/local/lib/tmpfiles.d/* /usr/lib/tmpfiles.d/* /usr/local/share/user-tmpfiles.d/* /usr/share/user-tmpfiles.d/*
man 5 tmpfiles.d
Offline
Check the console output from:
env SYSTEMD_LOG_LEVEL=debug systemd-tmpfiles --clean
Offline
I think I found the issue. I have a directory in /var/scan where I want to keep files up to 30 days. The issue is that systemd check the 30 days limit by access time and not by creation time. So whenever I use nautilus on this directory, it resets the access time for every file in the directory.
I need files to be deleted based on creation time and not access time.
my conf file in /etc/tmpfiles.d is
v /var/tmp/scan - root root 30d
Offline
The age of a file system entry is determined from its last modification timestamp (mtime),
its last access timestamp (atime), and (except for directories) its last status change
timestamp (ctime). By default, any of these three (or two) values will prevent cleanup if it
is more recent than the current time minus the age field. To restrict the deletion based on
particular type of file timestamps, the age-by argument can be used.
…
Offline
(I am wrong, see seth below) But that begs the question: why is access time updated? The default is relatime. With very few exceptions it should stay this way. Why is the mount point configured different on your system?
Last edited by mpan (2025-01-26 16:34:35)
Sometimes I seem a bit harsh — don’t get offended too easily!
Offline
relatime
Update inode access times relative to modify or change time. Access time is only updated
if the previous access time was earlier than or equal to the current modify or change
time. (Similar to noatime, but it doesn’t break mutt(1) or other applications that need
to know if a file has been read since the last time it was modified.)Since Linux 2.6.30, the kernel defaults to the behavior provided by this option (unless
noatime was specified), and the strictatime option is required to obtain traditional
semantics. In addition, since Linux 2.6.30, the file’s last access time is always
updated if it is more than 1 day old.
(Ftr, I know that because I held the same misbelief)
Offline
TIL. Thanks, seth!
/me slaps himself for not checking the source he linked.
Sometimes I seem a bit harsh — don’t get offended too easily!
Offline
Problem fixed. I changed the line in he file in /tmp/tmpfiles.d
to
v /var/tmp/scan - root root bmBM:30d
Offline