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
    Jan 1, 2018 at 14:05
  • Usually, /tmp is mounted into RAM so it won't help in those cases
    – piegames
    May 15, 2020 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.