On Ubuntu when the root partition gets full you can always run apt-get autoremove, apt-get clean and apt-get autoclean to free up some space for the package manager to continue working. But the equivalent command on nixos seems to have some issues running on a full root partition:

$ nix-collect-garbage
error: committing transaction: database or disk is full

Quite the pickle to be in when the reason you're running nix-collect-garbage to begin with is to clean up the full disk.

1 Answer 1


Hopefully you'll have stuff stored in /tmp you can remove to free up the space needed for nix-collect-garbage to complete.

$ rm -r /tmp/*
  • Do you intend to remove the /tmp directory itself? Otherwise, I'd suggest something like rm -r /tmp/*.
    – Jeff Schaller
    Commented Jan 1, 2018 at 14:05
  • Usually, /tmp is mounted into RAM so it won't help in those cases
    – piegames
    Commented May 15, 2020 at 20:28
  • @piegames I've seen that before but I don't think it's terribly common. Ubuntu for example is not configured this way by default. Commented May 13 at 14:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .