Why does a particular directory always exist in /tmp even after reboots?
I am using Ubuntu 20.04.3. I remember in the past creating a directory /tmp/myWork
. I usually work on that directory: downloading files, saving temporary files while working on some software, etc.
However, when I reboot my machine, that directory is always there but it's empty. I wonder why it doesn't get deleted when I reboot? why its content gets delete but not that directory itself?
Just in case the permission of the directory is important, I include it here:
ls -alF /tmp | grep myWork
drwx------ 3 user user 4096 Jan 4 17:34 myWork/
Any ideas?
Edit:
Here is the output of df /tmp/myWork
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 960379920 852343804 59181692 94% /
Edit2:
$ grep -F '17:34' /var/log/syslog
Jan 4 08:17:34 probook systemd[513982]: Started Application launched by gnome-shell.
Jan 4 08:17:34 probook PackageKit: resolve transaction /34190_abadddeb from uid 1000 finished with success after 598ms
Jan 4 17:34:07 probook gnome-shell[514206]: ../clutter/clutter/clutter-actor.c:10558: The clutter_actor_set_allocation() function can only be called from within the implementation of the ClutterActor::allocate() virtual function.
Jan 4 17:34:42 probook gnome-shell[514910]: [514911:514911:0104/173442.538073:ERROR:CONSOLE(1)] "[Shields]: Can't request shields panel data for tabId: 1155. Error: No tab url specified", source: chrome-extension://mnojpmjdmbbfmejpflffifhffcmidifd/out/brave_extension_background.bundle.js (1)
Jan 4 17:34:42 probook gnome-shell[514910]: [514911:514911:0104/173442.538578:ERROR:CONSOLE(1)] "[Shields]: Can't request shields panel data for tabId: 1155. Error: No tab url specified", source: chrome-extension://mnojpmjdmbbfmejpflffifhffcmidifd/out/brave_extension_background.bundle.js (1)
The fate of /tmp
contents following a reboot depends on a couple of things.
On a system which uses tmpfs
for /tmp
, /tmp
is empty following each reboot because tmpfs
does not persist across reboots (or even umount
followed by mount
). My Ubuntu 20.04.3
system does not use tmpfs
for /tmp
, and I did not override the default.
On a system with /tmp
as a simple subdirectory of /
(or as a mount point on a persistent file system), the contents of /tmp
following a reboot depend on the configuration of systemd-tmpfiles
.
My Ubuntu 20.04.3
system has the following lines in /usr/lib/tmpfiles.d/tmp.conf
.
# Clear tmp directories separately, to make them easier to override
D /tmp 1777 root root -
man tmpfiles.d
includes, the following description of the age
field.
If omitted or set to "-", no automatic clean-up is done.
A simple way to rule out the possibility that something is creating the directory at boot time is to remove it manually and then reboot, but it seems more likely that the existing directory survives the reboot.