Skip to content

Instantly share code, notes, and snippets.

@573
Last active August 7, 2024 07:54
Show Gist options
  • Save 573/c9fb93c4bee9db47f952127f3eab0cbb to your computer and use it in GitHub Desktop.
Save 573/c9fb93c4bee9db47f952127f3eab0cbb to your computer and use it in GitHub Desktop.
nixos-wsl fatal error NixOS-WSL wsl WSL nix
sudo -i nix-store --gc

but then i. e. nix shell --no-substitute --option binary-caches '' .#nixosConfigurations.DANIELKNB1.pkgs.hello again gives:

error:
… while setting up the build environment

  error: getting attributes of path '/nix/store/w0cpwqkiim2b3cd8k0j5j1cz0s8kz87q-qemu-aarch64-binfmt-P-x86_64-unknown-linux-musl':  

No such file or directory

and when I sudo -i nix-store --repair-path /nix/store/w0cpwqkiim2b3cd8k0j5j1cz0s8kz87q-qemu-aarch64-binfmt-P-x86_64-unknown-linux-musl and then repeat nix shell --no-substitute --option binary-caches '' .#nixosConfigurations.DANIELKNB1.pkgs.hello I get:

error:
… while setting up the build environment

  error: getting attributes of path '/run/binfmt': No such file or directory  

and back to top of this gist...

Also:

wsl
thread 'main' panicked at src/shell_wrapper.rs:105:10:
called Result::unwrap() on an Err value: When initializing journal logger

Caused by:
No such file or directory (os error 2)
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

But after complete system off / start nix shell .#nixosConfigurations.DANIELKNB1.pkgs.hello works.

Warning

Still got that error from time to time:

this derivation will be built:
  /nix/store/xhfd3k3y9288fb53ax6zpkcaa6aw69lw-setup.drv
error:
       … while setting up the build environment

       error: getting attributes of path '/nix/store/w0cpwqkiim2b3cd8k0j5j1cz0s8kz87q-qemu-aarch64-binfmt-P-x86_64-unknown-linux-musl':
 No such file or directory

Even after PC restart it persisted, so I did:

sudo -i nix-store --repair-path /nix/store/w0cpwqkiim2b3cd8k0j5j1cz0s8kz87q-qemu-aarch64-binfmt-P-x86_64-unknown-linux-musl

Then it worked again:

nix run .#setup --show-trace -vv --builders '' -j2

One more possibility when nix-daemon not started error

Leave nixos-wsl vm
from admin pwsh run (https://stackoverflow.com/a/75408523):

taskkill /F /FI "IMAGENAME eq wsl.exe"
taskkill /F /FI "IMAGENAME eq wslhost.exe"
taskkill /F /FI "IMAGENAME eq wslservice.exe"

nixos-wsl vm should now work again

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