Karmic fails to cleanup /tmp

April 2010


With our configuration, Ubuntu Karmic didn't cleanup /tmp during boot. This is due to bug 478392: /tmp is not cleaned at boot when it is on a separate partition.

We can fix this (as suggested in the bugreport thread) by creating a script /etc/init/cleantmp.conf:

# cleantmp - clean /tmp directory at startup

description"clean /tmp"

start on local-filesystems

task
script
if mount | grep -q /tmp
then
rm -Rf /tmp/*
fi
end script
    

The script complies with the upstart docs, and upstart will execute it at boot.