Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

"nix-collect-garbage -d" makes "nixos-rebuild switch" unusable when nixos.org is down #176

Open
wizeman opened this issue May 31, 2013 · 3 comments

Comments

@wizeman
Copy link
Member

wizeman commented May 31, 2013

When nixos.org is down and "nix-collect-garbage -d" is used, "nixos-rebuild switch" will fail to work even when doing minor configuration changes such as removing a package from environment.systemPackages.

It seems that some packages/derivations are always needed even for minor configuration changes, however "nix-collect-garbage -d" will delete them, as they seem to not be registered as GC roots.

Even building from source will not work as some of the required sources live in nixos.org.
Specifically, in my case I wasn't being able to download the following source file:

"downloading /nix/store/a0agd0bl2f0wsdz9dgbnr00h1sqwq8fb-bootstrap-tools.cpio.bz2 from http://nixos.org/tarballs/stdenv-linux/x86_64/r23302/bootstrap-tools.cpio.bz2"

curl: (7) Failed to connect to 2001:610:685:1::1: Network is unreachable
builder for `/nix/store/ky1w7k0v62vp2yax30zwrci2ac34cfiy-bootstrap-tools.cpio.bz2.drv' failed with exit code 7
cannot build derivation `/nix/store/wn3rvdspafvdr1jx7hjsg2qr647cxq5w-bootstrap-tools.drv': 1 dependencies couldn't be built
cannot build derivation `/nix/store/5p9qsv7gzv6ynir2gclybfg258s858ck-patchelf-0.6.drv': 1 dependencies couldn't be built
cannot build derivation `/nix/store/1q8kzl60n04sq7fgzaad4cvqqml94jxq-stdenv.drv': 1 dependencies couldn't be built
cannot build derivation `/nix/store/871mm4avff9nq5rsm34xm2lxjpk74j4y-nixos-0.2pre-31065e8-537e3a8M.drv': 1 dependencies couldn't be built
error: build of `/nix/store/871mm4avff9nq5rsm34xm2lxjpk74j4y-nixos-0.2pre-31065e8-537e3a8M.drv' failed

I worked around this issue by adding the seemingly required packages to my environment.systemPackages.

In my case, I needed to add the following: "patchelf gnumake stdenv docbook_xsl_ns docbook5 libxslt", otherwise "nixos-rebuild switch" would always fail with being unable to download those binary packages.

If these are always required for minor configuration changes, it would be nice if they were registered as GC roots so that users wouldn't accidentally shoot themselves in the foot when nixos.org is down.

BTW, if you want to test this problem when nixos.org is up, you can simulate it is down by doing "route add -host nixos.org reject" and making sure you are not using a secondary binary cache.

Then you can do "nix-collect-garbage -d" and now try to make some configuration changes and then use "nixos-rebuild switch" to apply them.

@edolstra
Copy link
Member

Setting

nix.extraOptions = "gc-keep-outputs = true";

in your configuration.nix should prevent this.

@wizeman
Copy link
Member Author

wizeman commented May 31, 2013

@edolstra: that seems to work very well for me.

Would it make sense to make "gc-keep-outputs = true" a default to make "nixos-rebuild" more resilient to network / hydra failures, or is there a significant downside apart from some additional disk space usage?

@Phreedom
Copy link
Member

Phreedom commented Aug 6, 2013

Disk space usage is the downside. I think it's a better idea to add some "resilient" option which would pull these essential packages. Adding a bootstrap-tools mirror would be nice too, although I find it hard to believe someone would want to actually bootstrap the toolchain themselves instead of waiting for cache to go up.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants