PROJET AUTOBLOG


BohwaZ

Site original : BohwaZ

⇐ retour index

Debian and Ubuntu: /tmp doesn't get cleaned at boot-time anymore?

dimanche 30 mars 2014 à 18:45

Sometimes after some magic happening, maybe an upgrade or a custom software setup, I can't remenber, the /tmp directory doesn't get cleaned anymore at boot-time.

The result is that when you are booting your computer you'll find files in /tmp from the previous time when your computer was on. Too bad.

The cause of this can be found in the /lib/init/bootclean.sh file. The clean_tmp() function uses some checks before emptying the directory. And one of those is checking whether the /tmp directory is actually world-writable, using this command:

$ find /tmp -maxdepth 0 -perm -002

If this command returns nothing then you've got the same problem as me: your /tmp directory is not world-writable anymore. Just type in this command:

# chmod a+rwX /tmp

And voilà it's done! You can now check that it works using:

# service checkroot-bootclean.sh start

If your /tmp directory is not empty then you should read on the /lib/init/bootclean.sh script and find which check is avoiding the function to clean your /tmp directory at boot.