How to get rid of /tmp?

Hello, people!

In my local setup, I have /tmp in a separate partition.

Now I want to get rid of that partition, integrating it in the / system.

But, obviously, /tmp is occupied; then I’m not able to unmount it.

Question: how can I get rid of /tmp that way?

Can you reboot? You could try reconfiguring how it sets up the mounts in the first place, then reboot the machine.

This is one of the easiest approaches. Just remove the /tmp mountpoint from hardware-configuration.nix, use sudo nixos-rebuild boot, then reboot. Dunno if it’ll automatically create a /tmp directory (though I’d wager it would); but if not you can bind-mount / to some place and make it before you reboot.

sudo mount --bind / /mnt
sudo mkdir /mnt/tmp
1 Like

Ah, now there is a problem: /tmp is blocking the nixos-rebuild.

How is it blocking nixos-rebuild? The advice given causes no meaningful change to your running system, it only prepares the system to have the correct setup after reboot. Unless your existing /tmp dir is already unusable for some reason?

Because of some strange reason, e2fsprogs doesn’t compile. Or more precisely, it fails the test phase. The reason is something related to hugefile support and /tmp…

For now, I rebooted the system in “1” mode, unmounted /tmp and installed e2fsprogs. Now the system is being built.