[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to prevent /tmp files from being deleted at reboot



Am 11.07.2016 um 15:22 schrieb MI:
> Hi,
> 
> Attached is the output. (BTW, findmnt is cool; I didn't know about it).
> 

Thank you. I just wanted to be sure that you weren't using
tmpfs-for-/tmp by default, which isn't the case.

Now to your issue. You said you wanted time based clean-up (remove files
older then 30 days) but *not* remove them on boot.

You've created a file /etc/tmpfiles.d/tmp.conf which overrides the
default that is shipped in /usr/lib/tmpfiles.d/tmp.conf
So far so good. What you used in /etc/tmpfiles.d/tmp.conf is:

D /tmp 1777 root root 30d

Let's see the tmpfiles.d man page [1]:

>        D
>            Similar to d, but in addition the contents of the directory will be
>            removed when --remove is used.

During boot systemd-tmpfiles-setup.service is run:

$ systemctl cat systemd-tmpfiles-setup.service | grep ExecStart
ExecStart=/bin/systemd-tmpfiles --create --remove --boot
--exclude-prefix=/dev

So, you actually requested that /tmp is cleaned up during boot. What you
want is the 'd' option. Again, have a look at the tmpfiles.d man page [2]:

>        d
>            Create a directory. The mode and ownership will be adjusted if specified and the directory already exists. Contents of this directory are subject to time based cleanup if the time
>            argument is specified.


So, what you copied from the bug report was simply not what you were
looking at. Always consult the man pages. The ones shipped by systemd
are actually pretty decent.


I think that should solve your misteries.


Regards,
Michael


[1] https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html#D
[2] https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html#d

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: