We have two separate issues here:
a/ /tmp-on-tmpfs
b/ time based clean-up of /tmp and /var/tmp
I think it makes sense to discuss/handle those separately.
Regarding b/: ...
The tmpfiles rule tmp.conf as shipped by systemd upstream ...
Files that are older then 10 days or 30 days are automatically cleaned up.
To me, the purpose of /var/tmp/ when I have my "user" hat on is: a
place to put files I don't want backed up, particularly large ones,
and which if I run out of disk space is a place to look for stuff to
delete. it's not "a place to put files that the system might
capriciously delete just because."
One compromise would be to enable the /var/tmp/ reaper by default only
on new installations.
We have two separate issues here:
a/ /tmp-on-tmpfs
b/ time based clean-up of /tmp and /var/tmp
I think it makes sense to discuss/handle those separately.
Agreed.
I also don't see any issue with a/, at worst people will be annoyed
with it for some reason and can then change it back.
Regarding b/: ...
The tmpfiles rule tmp.conf as shipped by systemd upstream ...
Files that are older then 10 days or 30 days are automatically cleaned up.
This seems like a rather dangerous thing to spring on people.
First of all, time can be pretty fluid on user machines.
Then upon reading the release notes, on such a machine, one can simply do:
touch /etc/tmpfiles.d/tmp.conf
And they get no automated cleanups.
Then upon reading the release notes, on such a machine, one can simply do:
touch /etc/tmpfiles.d/tmp.conf
And they get no automated cleanups.
This also disables on-boot cleaning of /tmp/.
The root issue here is that deleting not-read-in-a-while but-maybe-stat'ed-recently-by-make-that-doesn't-count files from
/var/tmp/ by default, particularly when the system didn't used to,
violates the principle of least surprise.
There's an old debugging story
As someone who regularly deals with large datasets, and keeps them in
the "approved" don't-back-these-up location /var/tmp
What I am looking for right now is packages or internal
infrastructure that need
an update to cope with these two changes before I upload them, so if
you know of any please do let me know and I'll happily look into it
and at least file a bug, if not a MR. Thanks.
Okay.
git and other version control systems should be modified to warn if
the work tree or git dir are in /var/tmp and therefore exposed to
unexpected deletion of files, and possibly modified to refuse to clone
there without an explicit --force-unstable-storage option.
What I am looking for right now is packages or internal
infrastructure that need
an update to cope with these two changes before I upload them, so if
you know of any please do let me know and I'll happily look into it
and at least file a bug, if not a MR. Thanks.
If it clones into /tmp the *entire* tree will either be reaped (upon
reboot) or not.
But having just some files deleted from a git dir or git working dir
is much more dangerous, because various git commands can treat files
deleted from the working tree as deliberate changes to be committed,
and files deleted from the git dir can render it unusable.
tmpfiles.d snippets can be defined to cleanup on a timer _anything_,
tmpfiles.d snippets can be defined to cleanup on a timer _anything_,
It's a question of what the *default* behaviour should be.
For whatever reason, a lot of people who process large data use /var/tmp/FOO/ as a place to store information that should not be backed up, but also should not just disappear.
To be honest I'm greatly surprised by this idea, and by the suggestiontmpfiles.d snippets can be defined to cleanup on a timer _anything_,
It's a question of what the *default* behaviour should be.
For whatever reason, a lot of people who process large data use
/var/tmp/FOO/ as a place to store information that should not be
backed up, but also should not just disappear.
While personal anecdotes and stories can be interesting and amusing in many circumstances, I am not really looking for those at this very moment. What I am looking for right now is packages or internal infrastructure that need an update to cope with these two changes before I upload them, so if you know of any please do let me know and I'll happily look into it and at least file a bug, if not a MR. Thanks.
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.
If [files can be deleted automatically while mmdebstrap is using them],
how should applications guard against that from
happening?
Hi,
Quoting Luca Boccassi (2024-05-06 15:20:08)
While personal anecdotes and stories can be interesting and amusing in many circumstances, I am not really looking for those at this very moment. What I
am looking for right now is packages or internal infrastructure that need an
update to cope with these two changes before I upload them, so if you know of
any please do let me know and I'll happily look into it and at least file a bug, if not a MR. Thanks.
mmdebstrap uses $TMPDIR (because that's what Perl's File::Temp uses) and falls
back to /tmp for storing the chroot directories it creates. The modification times on files in that chroot directory are potentially much older than 10 days
as they match the timestamps on the packages installed in the chroot. Do I understand it correctly that with the proposed change and an unfortunate timing
it can happen that files older than 10 days get removed from a temporary chroot
directory in /tmp? If yes, how should applications guard against that from happening?
Quoting Luca Boccassi (2024-05-06 23:28:59)
On Mon, 6 May 2024 at 22:27, Simon McVittie <[email protected]> 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?
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?
On Mon, 6 May 2024 at 22:27, Simon McVittie <[email protected]> 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
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.
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.
On Mon, 6 May 2024 at 11:33, Barak A. Pearlmutter <[email protected]> wrote:
We have two separate issues here:
a/ /tmp-on-tmpfs
b/ time based clean-up of /tmp and /var/tmp
I think it makes sense to discuss/handle those separately.
Agreed.
I also don't see any issue with a/, at worst people will be annoyed
with it for some reason and can then change it back.
Regarding b/: ...This seems like a rather dangerous thing to spring on people.
The tmpfiles rule tmp.conf as shipped by systemd upstream ...
Files that are older then 10 days or 30 days are automatically cleaned up. >>
First of all, time can be pretty fluid on user machines.
Then upon reading the release notes, on such a machine, one can simply do:
touch /etc/tmpfiles.d/tmp.conf
And they get no automated cleanups. This stuff is designed to be
trivially overridable, both by end-users and image builders. What I am looking for is, what packages need bugs/MRs filed to deal with this
change, if any.
possibly convince those applications to use their own
scratch space such as /tmp/<package>/ that is more easily identifiable
...3) I would put a file in any auto-cleaned space named "1-AUTOCLEAN.txt" that contains some verbage explaining that things in this directory will be wiped based on rules set in (wherever).
>> > > If [files can be deleted automatically while mmdebstrap is using them],"Johannes" == Johannes Schauer Marin Rodrigues <[email protected]> writes:
>> > > If [files can be deleted automatically while mmdebstrap is using them],"Johannes" == Johannes Schauer Marin Rodrigues <[email protected]> writes:
>> > > 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.
On Mon, May 06, 2024 at 04:50:50PM +0100, Barak A. Pearlmutter wrote:
tmpfiles.d snippets can be defined to cleanup on a timer _anything_,
It's a question of what the *default* behaviour should be.
For whatever reason, a lot of people who process large data use /var/tmp/FOO/ as a place to store information that should not beTo be honest I'm greatly surprised by this idea, and by the suggestion
backed up, but also should not just disappear.
that a lot of people do this, to me this is very similar by that half-joke about people storing useful files in the Recycle Bin.
Quoting Andrey Rakhmatullin (2024-05-06 19:14:40)I actually meant the Windows feature :)
On Mon, May 06, 2024 at 04:50:50PM +0100, Barak A. Pearlmutter wrote:
tmpfiles.d snippets can be defined to cleanup on a timer _anything_,
It's a question of what the *default* behaviour should be.
For whatever reason, a lot of people who process large data use /var/tmp/FOO/ as a place to store information that should not beTo be honest I'm greatly surprised by this idea, and by the suggestion
backed up, but also should not just disappear.
that a lot of people do this, to me this is very similar by that half-joke about people storing useful files in the Recycle Bin.
I'm doing exactly that. I use paper I already printed stuff on but which were misprints or which are no longer useful to me and are just destined for the recycling bin to write stuff on that is important to me. After I'm done with my
work on this scrap paper I decide what I want to keep and copy to permanent storage and what I want to really throw away.
We have two separate issues here:
a/ /tmp-on-tmpfs
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (0 / 16) |
| Uptime: | 161:50:57 |
| Calls: | 12,094 |
| Calls today: | 2 |
| Files: | 15,000 |
| Messages: | 6,517,778 |