A nasty new linux meme: /tmp shouldn't be used and your program is wrong for using it

on blog at

With Debian 13 a very significant issue has resulted from changing /tmp from being a directory on disk to a tempfs virtual directory stored in ram. Now any programs that use /tmp will instead use system RAM instead of disk space. Because of this programs that have traditionally (for 20+ years) used /tmp to store files like Qemu and Festival (text to speech) are being told they need to move their large /tmp uses to different directories because otherwise they'll suck up too much system RAM.

It is creating a problem, and fragmentation, for program configuration where none existed in exchange for the chance of a slight speed-up by keeping everything in ram. Setting this as a default in Debian 13 signals the Debians defaults are for *big* machines with excess ram. Users with smaller amounts will have to do a post install manual configuration to achieve normal performance and avoid slowdowns from tempfs taking ram and pushing things into swap when the ram inevitably fills. And the fallout from programs having to change their code just to avoid using /tmp for what it's meant for will be much larger.

Now you may say, "once there's memory pressure the tempfs will push back to disk anyway via swap" and that is true. But it is also true that the memory pressure wouldn't exist without the tempfs. And this pushing back and forth can only slow things down when compared to a more straightaway, less steps/io, setup of just files in folders on disk.

Another objection is "most people don't have much stored in /tmp". And that's also true. But that doesn't change the fact that /tmp is there to be used. It's meant for 5kb or 5GB. There has never been a limit. And now people are trying to say there must be a limit because of the bad downsides of this change.

That's not to say there are no upsides. The performance increase in some applications, like Firefox, is notable. Considering this, /tmp should be left alone and a new /tmpfs in ram "standard" be created for programs that desire the potential speed up. That way existing workflows would not be broken and devs would not have to change their programs code unless they wanted to.

In this context the "ram is there to be used" is a bad application of the meme, a bad default, and the /tmp->tempfs change resulting from it should be reverted in future Debian 13 point releases.

The good thing is that it's an easy fix for users (if not software devs): "You can return to /tmp being a regular directory by running systemctl mask tmp.mount as root and rebooting."

[comment on this post] Append "/@say/your message here" to the URL in the location bar and hit enter.

[webmention/pingback] Did you respond to this post? What's the URL?