[Nix-dev] Re: Cleaning `/tmp' at boot time

Eelco Dolstra e.dolstra at tudelft.nl
Wed Oct 29 15:31:39 CET 2008


Ludovic Courtès wrote:

>> * Disable deleting /tmp at boot time.  This should be controlled
>>   by an option (which should default to off, IMHO).  I was rather
>>   surprised when I rebooted my system and it started deleting all
>>   of /tmp (which, for instance, contained some test DB/repos for 
>>   the Subversion server)...
> 
> Hmm, I'll have to disagree with that.  :-)
> 
> `/tmp' was never meant to store things in the long term, as the name
> implies.  We could make it an option, but then it should be "on" by
> default.  That's what people coming from other Linux distros or other
> Unices expect I think.  

Well, I don't think my SUSE install ever deleted /tmp automatically :-)

> And it obviates the need to manually run "sudo
> rm -rf /tmp/*" on a running system that may contain bind mounts to
> /nix/store...

But as Marc pointed out, on a long-running system you still need to do that.  So
you're better off cleaning /tmp from a cronjob.  Also, on a long-running system,
once you *do* reboot, the boot time increases a lot (on my laptop it took a few
minutes to delete /tmp).

In any case, the current command to delete it:

  rm -rf --one-file-system /tmp/*

is broken.  It will fail / do bad things if there are too many files or files
starting with "-" in /tmp.  Better to do "find /tmp ... -print0 | xargs -0 rm --
..." or something.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list