Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos-install fails with getting attributes of path /nix/store/...: No such file or directory #126141

Closed
Artturin opened this issue Jun 8, 2021 · 62 comments · Fixed by #132046
Closed

Comments

@Artturin
Copy link
Member

Artturin commented Jun 8, 2021

Describe the bug
during nixos-install a error appears getting attributes of path /nix/store/...: No such file or directory
the person who told me about this is @epsyle
i was using his dotfiles to test https://github.com/epsyle/snowflake/tree/c13f37ac19942bdcc3ddced28015b47b10e1f6b2

i did this in a vm and he did it on hw

To Reproduce
Steps to reproduce the behavior:

  1. boot nixos-minimal-21.05.804.5de44c15758-x86_64-linux.iso
  2. create a root partition
  3. add fira-code in to your systemPackages
  4. nixos-install

Expected behavior
install should work

Screenshots
Screenshot_nixos-unstable_2021-06-08_02:34:54

Additional context
after nix-build '<nixpkgs>' -A fira-code or nix-shell -p fira-code the install will continue until there's a another error of the same type which can be fixed by doing the same thing
Screenshot_nixos-unstable_2021-06-08_04:29:14
nix-store --repair-path /nix/store/41qphrp1ksc1fqm01i7khs30n1zjl56r-fira-code-5.2 would fix it too

I hope this issue will help new people who are searching for a fix

Maybe related NixOS/nix#1281

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.10.40, NixOS, 21.05.804.5de44c15758 (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.12
  • channels(root): "nixos-21.05.804.5de44c15758"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
@Artturin
Copy link
Member Author

Artturin commented Jun 9, 2021

seen 3 people with the same issue in the last 2 days

@Artturin Artturin reopened this Jun 9, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/21-05-not-installed/13547/3

@Artturin
Copy link
Member Author

Artturin commented Jun 15, 2021

i've seen this happen ~7 times in the past week

here's one just 1 hour ago https://www.reddit.com/r/NixOS/comments/o0gil2/does_anyone_know_how_to_fix_this_error/

and theres one in the Nix / NixOS matrix server right now

@Artturin
Copy link
Member Author

a workaround by @jonringer
first

nix-build '<nixpkgs/nixos>' -A config.system.build.toplevel -I nixos-config=/mnt/etc/nixos/configuration.nix

let it complete
and then run sudo nixos-install

@jonringer
Copy link
Contributor

does nix-build '<nixpkgs/nixos>' -A config.system.build.toplevel -I nixos-config=/mnt/etc/nixos/configuration.nix then re-running nixos-install fix the issue?

Curious if flakification efforts of nixos-install caused some regressions.

@jonringer
Copy link
Contributor

oops, just noticed you posted it as well :)

@jonringer jonringer pinned this issue Jun 15, 2021
@jonringer
Copy link
Contributor

Going to pin this issue until there's a better resolution of this, but many people have been having this issue.

@jonringer
Copy link
Contributor

cc @edolstra @jtojnar

@liamwhite
Copy link

Curious if flakification efforts of nixos-install caused some regressions.

Maybe, but it can be reproduced without using nixos-install at all. See nix bug: NixOS/nix#4912

@jonringer
Copy link
Contributor

It's quite possible. The nixos-install script hasn't seen much iteration over the past few months. Much more likely there's a regression in the nix-cli

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/21-05-not-installing/13547/20

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jun 20, 2021

Did anyone figure this out? I've only be able to complete the installation by commeting out sections of the confiuration; once booted into the new system it worked. The problem must be with nixos-install and not nix in general.

@jspaalan
Copy link

jspaalan commented Jun 20, 2021

@rnhmjoj I'm also currently using a similar workaround. By using a minimal configuration the only derivation that is currently causing the issue in my install-phase config is mailcap-2.1.52. I noticed that by finding the derivations in /mnt/nix/store which have .lock files in place point out at least some of such problematic derivations and they can be fixed by nix-store --repair-path.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jun 20, 2021

Interesting, it was mailcap for me too, that can't be a coincidence. There must be something in common with these derivations that's making Nix fail, but only when invoked from nixos-install.

@liamwhite
Copy link

The bug comes from nixos-install invoking nix-store with a --store path that is not /. I strongly believe that this is a nix bug and not a nixos-install bug.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixos-install-failing/13730/3

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixos-21-05-installation-failed-installing-from-an-existing-distro/13627/4

@figsoda
Copy link
Member

figsoda commented Jun 23, 2021

might be related to NixOS/nix#4081

@austinbutler
Copy link
Member

This happened to me with at least beets (but only when overridden with enableExtraFiles) and google-fonts. Using nix-shell indeed worked around it each time. This was with an install script that I used a few months back without issue.

@jonringer
Copy link
Contributor

jonringer commented Jun 29, 2021

Did anyone figure this out? I've only be able to complete the installation by commeting out sections of the confiuration; once booted into the new system it worked. The problem must be with nixos-install and not nix in general.

don't remember where I read the issue, but there may be a regression with nix-build --store or lesser likely with nix-store --extra-substituters, as those are likely to be the only difference between what I said above, and what nixos-install is calling:

        nix-build --out-link "$outLink" --store "$mountPoint" "${extraBuildFlags[@]}" \
            --extra-substituters "$sub" \
            '<nixpkgs/nixos>' -A system -I "nixos-config=$NIXOS_CONFIG" "${verbosity[@]}"

A temporary fix could be just building it twice, once without --store and --extra-substitutes, then again with them supplied. This would essentially be applying the "work-around" listed here.

The drawbacks being:

  • configuration has to be evaluated twice, and from a user's perspective, it seems like repeated work to users (technically it is).
  • Fills up local /nix/store, which for the installation devices is tmpfs + overlay (heavy on ram usage):
    fileSystems."/nix/.rw-store" =
      { fsType = "tmpfs";
        options = [ "mode=0755" ];
        neededForBoot = true;
      };

    fileSystems."/nix/store" =
      { fsType = "overlay";
        device = "overlay";
        options = [
          "lowerdir=/nix/.ro-store"
          "upperdir=/nix/.rw-store/store"
          "workdir=/nix/.rw-store/work"
        ];

thufschmitt added a commit to NixOS/nix that referenced this issue Jul 26, 2021
Otherwise chrooted store will fail because Nix will try to read the
virtual path instead of the physical one

Should fix NixOS/nixpkgs#126141
@thufschmitt
Copy link
Member

@samueldr I couldn’t replicate the exact issue, but I’m fairly confident that it would be fixed by NixOS/nix@89fba5c . Do you mind giving it a try?

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cant-log-in-to-new-install-21-05/14263/5

@samueldr
Copy link
Member

✔️ @regnat verified only against 21.05, but it does fix the issue; Nix finishes the system build.

  • Tested with: 09ffd85 (and Nix back at 2.3.14)

(I do not know if the issue exists on unstable.)

@ElvishJerricco
Copy link
Contributor

Can also confirm that NixOS/nix@89fba5c fixed the issue in my nix-build --store /path test. Though what I don't understand is why I can't reproduce this issue on the master branch of Nix...

@thufschmitt
Copy link
Member

heavy_check_mark @regnat verified only against 21.05, but it does fix the issue; Nix finishes the system build.

Yay! I’ve opened NixOS/nix#5053 so that we can have a proper release with the fix

Though what I don't understand is why I can't reproduce this issue on the master branch of Nix...

NixOS/nix@3dbd83b (the faulty commit) is a backport of NixOS/nix@5985b8b (which is on master), but I had to rework it a little bit as the code had changed in the meantime. And that’s when I introduced the bug.

@samueldr
Copy link
Member

@edolstra will a Nix 2.3.15 release be made soon enough? (before the end of the week)

Or should the patch be applied on 2.3.14 until then?

Given that this is a major blocker and tarnishes experience for new users, I think we should land a fix for this before the end of the week.

@tobiasBora
Copy link
Contributor

tobiasBora commented Jul 29, 2021

As far as I understand/experiment, the proposed temporal fixe downloads everything into the live /nix folder instead of the /mnt/nix/ folder:

nix-build '<nixpkgs/nixos>' -A config.system.build.toplevel -I nixos-config=/mnt/etc/nixos/configuration.nix
sudo nixos-install

The problem is that the livecd does not have a huge space, and it tends to run out of space. Is there a way to download packages in the /mnt/nix store to benefit from a larger space?

-- EDIT --

I also tried to upgrade nix using the unstable channel (I though the bug was not present in master) and upgrade nix with nix-env -iA nixos.nix, but it seems that it is not enough to allow nixos-install to run flawlessly.

@vcunat
Copy link
Member

vcunat commented Jul 30, 2021

So... we update nix then? #132046

@mixmixmix
Copy link

I understand that it is happily fixed @SuperSandro2000 but what do I need to do to install a fresh nixos now? Can we have some explanation for less technical folks?

vcunat added a commit that referenced this issue Jul 31, 2021
... into release-21.05 as a part of fixing #126141.
(I think; I don't know how often the fallback gets used in practice.)
@Artturin
Copy link
Member Author

I understand that it is happily fixed but what do I need to do to install a fresh nixos now? Can we have some explanation for less technical folks?

You don't have to reinstall

@mixmixmix
Copy link

I got a fresh install image and updated channels but still run into this problem, that's why I asked what to do :). Ultimately I see that I just needed to run what you suggested in initial post:
nix-store --repair-path /nix/store/rya2s79k5ncqbas09rwhq43lrbr4s3m0-mailcap-2.1.52

@Artturin
Copy link
Member Author

no isos have been built with the pr yet
https://nixpk.gs/pr-tracker.html?pr=132046
backport pr https://nixpk.gs/pr-tracker.html?pr=132073

@vcunat
Copy link
Member

vcunat commented Jul 31, 2021

Latest 21.05 ISOs should have all the fixes in them now.

@jonringer
Copy link
Contributor

Just waiting on https://nixpk.gs/pr-tracker.html?pr=132046 to finish, then I'll unpin

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-16/14379/1

@domenkozar
Copy link
Member

I've used 21.05 and haven't spotted this bug.

@vcunat
Copy link
Member

vcunat commented Aug 3, 2021

All maintained channels and ISOs should be fixed now. (or at least contain those nix updates)

@jonringer
Copy link
Contributor

I've used 21.05 and haven't spotted this bug.

It only occurs if you add new packages to your nixos configuration that don't exist in the image. If your initial install is a subset of the image, you're fine.

@ElvishJerricco
Copy link
Contributor

Yep, the issue only happens if you attempt to copy a fixed output derivation from a substituter into a chroot store. It's kind of rare but very unpleasant for people who try to do this thing that should work during installation.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixos-install-cant-find-iana-etc/15390/2

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/having-trouble-installing-nixos/15431/3

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/substituters-on-a-remote-builder-for-a-flake-causes-build-to-fail-with-no-such-file/32140/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet