Hi list,
In some cases users may want to clean up the files under /tmp only during boot with the following configuration
# cat /etc/tmpfiles.d/fs-tmp.conf #Type Path Mode User Group Age Argument d! /tmp 1777 root root 14d
But according to the man page of tmpfiles.d
'''
If the exclamation mark ("!") is used, this line is only safe to execute during boot, and can break a running system. Lines without the exclamation mark are
presumed to be safe to execute at any time, e.g. on package upgrades. systemd-tmpfiles will take lines with an exclamation mark only into consideration, if the
--boot option is given.
presumed to be safe to execute at any time, e.g. on package upgrades. systemd-tmpfiles will take lines with an exclamation mark only into consideration, if the
--boot option is given.
'''
we have to make the following change to systemd-tmpfiles-setup.service to make it work as described above.
diff --git a/units/systemd-tmpfiles-setup.service b/units/systemd-tmpfiles-setup.service
index 6cae32850f..71d967aa48 100644
--- a/units/systemd-tmpfiles-setup.service
+++ b/units/systemd-tmpfiles-setup.service
@@ -21,7 +21,7 @@ RefuseManualStop=yes
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
+ExecStart=systemd-tmpfiles --clean --create --remove --boot --exclude-prefix=/dev
SuccessExitStatus=DATAERR CANTCREAT
ImportCredential=tmpfiles.*
ImportCredential=login.motd
index 6cae32850f..71d967aa48 100644
--- a/units/systemd-tmpfiles-setup.service
+++ b/units/systemd-tmpfiles-setup.service
@@ -21,7 +21,7 @@ RefuseManualStop=yes
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
+ExecStart=systemd-tmpfiles --clean --create --remove --boot --exclude-prefix=/dev
SuccessExitStatus=DATAERR CANTCREAT
ImportCredential=tmpfiles.*
ImportCredential=login.motd
Is there any reason why "--clean" is omitted in this service file?
-- Regards,
Lidong Zhong