tmpfiles.d - or why are my temp files in /tmp gone?

Tuesday, May 29, 2018
Linux

In later Ubuntu versions tmpfile.d is used to keep /tmp clean. That is, after a reboot, your files you placed in there are vanished. Kind of a bummer when you do not know.

You can change that behavior by placing a file into /etc/tmpfile.d/. If you want to keep your files two days around create a file (let’s say named tmp.conf) with the following content:

#/etc/tmpfiles.d/tmp.conf
d /tmp 1777 root root 2d

You probably should not do it unless you run this on all your machines. For me it is simply too easy to assume it works everywhere the same as on my machine. Which might lead you to loose some amount of work/time.