I'm losing files in /tmp
on current Ubuntu (22.04.2), possibly related to virtualisation. Any insights appreciated. This is not a normal cleanup; the file is lost immediately.
I have two systems: a remote VPS, and a local staging system, both running the same software. On both systems, /tmp
is not a tmpfs
; it's part of the LVM volume group mounted at /
.
Apache runs program1
and program2
immediately after each other:
program1
creates a new subdirectory under /tmp
, with 2 files: file1
(a Python source file) and file2
(the output of file1
). If debug is enabled, file1
is retained; otherwise, it it deleted after creating file2
(with a C library remove
)
program2
returns file2
to the client
This all works as expected on the staging system. If debug is enabled, the new /tmp/xxx
directory is still on the filesystem, and contains both file1
and file2
. If debug isn't enabled, it contains only file2
.
On the VPS:
- if debug is not enabled, everything works, but there's nothing left under
/tmp
- if debug is enabled,
program2
fails, reporting that file2
doesn't exist
I have 'fixed' the code by removing the C lib remove
, so that file1
is always retained, but I don't understand what's going on - it appears that the file remove has somewhere triggered a remove of the entire directory.