On Mon, 6 May 2024 at 23:00, Johannes Schauer Marin Rodrigues <jo...@debian.org> wrote: > > Quoting Luca Boccassi (2024-05-06 23:28:59) > > On Mon, 6 May 2024 at 22:27, Simon McVittie <s...@debian.org> wrote: > > > > > > On Mon, 06 May 2024 at 22:08:56 +0200, Johannes Schauer Marin Rodrigues > > > wrote: > > > > 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 > > I guess those users who want to place their chroots in /tmp would have to > disable the cleanup timer on their systems. > > For the mmdebstrap user who just wants to create some tarballs, I think the > flock solution would be sufficient, thank you. > > > More specific settings win, so your application can ship its own tmpfiles.d > > snippet that defines a longer (or infinite) cleanup time for directories > > under /tmp or /var/tmp. > > How would that look like? Say, my application creates temporary directories > with the pattern /tmp/mmdebstrap.XXXXXXXX -- how would the recommended line > which disables cleanup in /usr/lib/tmpfiles.d/mmdebstrap.conf look like?
To be more specific, as per documentation: https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html 'x' lines can be used to override cleanup rules, and support globbing, so something like: x /tmp/mmdebstrap.* > And just to confirm (I read this elsewhere in this thread): if my /etc/fstab > has an entry for /tmp (with a tmpfs) does this automatically mean that no > cleanup will happen or do i still have to put something into /etc to disable > the periodic cleanup? That's something different, fstab is about whether /tmp is a tmpfs or not, cleanups still happen regardless of the filesystem type.