On Wed, May 18, 2011 at 06:34:50PM +0200, Tom Gundersen wrote:
Hi guys,
Thanks to all of you who answered my many previous RFC's, I will follow up on them with code soon :-)
In the last initscripts release I inedvertently introduced a bug where /tmp is not cleared on boot if it is mounted on a non-tmpfs drive (it was only cleared if it lived on the root partition). This lead to a long discussion in the bug report about possible use-cases for /tmp. Among other things it was requested that we should stop clearing /tmp or make it configurable. As always, I'm opposed to adding configuration options just for the sake of it, so I propose something different.
First of all, this is what I took away from the discussion:
1) /tmp should always be mounted as tmpfs (there are some really obscure scenarios when it should not be (if you have individual files larger than 256GB on it)) 2) if /tmp is not mounted as tmpfs it should always be cleared at boot
That said, some users disagree, and want to /tmp to be preserved on reboot. Usually I would deny such a request, but I figured it would actually simplify things, so why not. This is my proposal:
1) We advice users to mount /tmp as tmpfs (possibly with the proviso that the partition they would normally have used for /tmp is turned into swap space, and the size option of /tmp is set to the size of the old partition), this could be added to the standard fstab if we wish. 2) We never touch /tmp at boot. This makes no difference if the users follow our advice. 3) If the user wants to mount /tmp as a different fs, we advice them to put "rm -rf /tmp/* /tmp/.*" in rc.local, or manage /tmp in any other way they want (e.g. by using the tmpwatch package).
What do you think?
Cheers,
Tom
Looking at the patch that triggered this, I'm confused as to why the logic was added to rc.sysinit to begin with. Why conditionally check for /tmp being mounted? What's the harm in unconditionally calling rm -rf /tmp/*? Has it bitten us in the past? The commit message doesn't even cover this change. dave