Re: Re: Make /tmp/ a tmpfs and cleanup /var/tmp/ on a timer by default [was: Re: systemd: tmpfiles.d not cleaning /var/tmp by default]
On Tue, 7 May 2024 at 15:53, Sam Hartman <hartmans@debian.org> wrote:
>
> >>>>> "Johannes" == Johannes Schauer Marin Rodrigues <josch@debian.org> writes:
> >> > > If [files can be deleted automatically while mmdebstrap is using them],
> >> > > how should applications guard against that from
> >> > > happening?
> >> >
> >> > As documented in tmpfiles.d(5), if mmdebstrap takes out an exclusive
> >> > flock(2) lock on its chroot's root directory, systemd-tmpfiles should
> >> > fail to take out its own lock on the directory during cleanup, and
> >> > respond to that by treating the directory as "in use" and skipping it.
> >>
> >> That also works, but only as long as mmdebootstrap is actually
> >> running, and as far as I understand it is not a long-running service,
> >> not sure if it works for this use case
>
> Note that according to the man page, ctime is used as well as mtime.
> So for roots that are actually temporary, I don't think much needs to be
> done.
> It won't matter that the mtime might be old because the ctime should be
> consistent with when the root is unpacked.
>
> I do wish there were a way to specify for /var/tmp that directories
> under /var/tmp should be deleted in their entirety or entirely left
> alone.
> I realize we'd have a big debate about whether that was a good default,
> but I'd find it useful for my systems at least.
This is a reasonable RFE, and it has already been proposed some days
ago (in the right place, upstream):
https://github.com/systemd/systemd/issues/32674
Reply to: