/tmp woes on Nobara Linux
/tmp filled on my desktop Linux box running Nobara (Fedora 44). WTF? The problem turned out to be Chrome leaving behind download files.
What is /tmp on Nobara
/tmp is not a disk-backed filesystem. It’s tmpfs, which sits in RAM. Fedora sizes it to be 50% of RAM by default, or 14GB in my case.
/tmp gets cleared on reboot. It also gets cleared daily by systemd-tmpfiles. That’s configured (mostly) in /usr/lib/tmpfiles.d/tmp.conf and by default deletes files older than 10 days.
There’s also a /var/tmp on regular disk which is for temporary files that should last longer than just a reboot. The systemd job deletes files older than 30 days there.
Finding the /tmp usage
First thing I did is run du /tmp. And saw nothing there but some small files. Which sent me down a rabbit hole of using lsof to find deleted files and some eldritch possibilities of giant RAM pages or other memory management problems.
Nah, the problem was just that Chrome writes its download turds to hidden . files like /tmp/.com.google.Chrome.GsPvIQ. Which du -s /tmp/* won’t show. Have to do du -s /tmp* /tmp/.* Fucking Unix.
Anyway, once I found what the /tmp files were I quit Chrome expecting them to be deleted. Nope. Was it a Chromium app? No. lsof showed nothing had the file open, it was just something Chrome left behind. Ugh. Arguably Chrome should be writing these to /var/tmp.
A reboot should fix this kind of stupidity but I’m stubborn and think Linux systems shouldn’t need rebooting.
Temporary data in my RAM?
I’m wondering why tmpfs is a thing. To me, /tmp is where you put data that you don’t want to keep in RAM. Why waste precious RAM on temporary dross? Why have such a small temporary partition?
I guess the theory is you want /tmp to be fast and not wear an SSD. And if there’s memory pressure, why, that’s what swap is for. (I have 30GB of swap on a partition in an SSD). That makes a certain kind of sense to me but I don’t love it.
While I’m here, the real confusing thing in a modern Linux is zram. Or alternately zswap. And the controversy between them. I started trying to read about this and realized I couldn’t make an informed decision, so I’m just taking Nobara’s defaults.
Which worked fine right until Chrome did something dumb like assume /tmp was OK for large files.