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

Attempting to install via wsl --import fails #606

Open
jarrodsfarrell opened this issue Dec 14, 2024 · 3 comments · May be fixed by #608
Open

Attempting to install via wsl --import fails #606

jarrodsfarrell opened this issue Dec 14, 2024 · 3 comments · May be fixed by #608
Labels
bug Something isn't working

Comments

@jarrodsfarrell
Copy link

Bug description

Attempting to install a fresh copy of NixOS-WSL fails with wsl emitting help-text. Tried creating ~\NixOS\ myself then running the command with no change.

To Reproduce

PS ~> wsl --install --no-distribution
The operation completed successfully.
PS ~\Downloads> cd .\Downloads\
PS ~\Downloads> wsl --import NixOS $env:USERPROFILE\NixOS\ nixos-wsl.tar.gz --version 2
[wsl help text, no errors given]

WSL version

WSL version: 2.3.26.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.19045.5247
PS ~> wsl
[Ubuntu MOTD]
jarrod@Gamma:/mnt/~/Downloads$ sha256sum nixos-wsl.tar.gz
576f2dda94b0dde278cd9ebbdf04b53bd9c174fba5dd4e98bd9af227dd97fc24  nixos-wsl.tar.gz

Corresponds to this release

@jarrodsfarrell jarrodsfarrell added the bug Something isn't working label Dec 14, 2024
@jarrodsfarrell jarrodsfarrell changed the title Attempting to Install Fails Attempting to install via wsl --import fails Dec 14, 2024
@nzbr
Copy link
Member

nzbr commented Dec 16, 2024

I am unfortunately not able to reproduce that (with the same hash for nixos-wsl.tar.gz, I am however already on WSL 2.4.5.0). Usually when WSL just prints its help text, that means that there's some sort of error with the syntax of the command you ran, not with a distro. I copy-pasted your command (just replaced the name, because NixOS is already taken on my system) and that run through just fine:

󰍲  nzbr@PULSAR
PS T:\> sha256sum.exe .\nixos-wsl.tar.gz
\576f2dda94b0dde278cd9ebbdf04b53bd9c174fba5dd4e98bd9af227dd97fc24 *.\\nixos-wsl.tar.gz

󰍲  nzbr@PULSAR
PS T:\> wsl --import nix-dbg $env:USERPROFILE\NixOS\ nixos-wsl.tar.gz --version 2
Der Vorgang wurde erfolgreich beendet.

As this seems to be a general WSL problem to me, rather than a NixOS one, you could try opening an issue in microsoft/WSL. Maybe someone there knows what might be the problem here

@jarrodsfarrell
Copy link
Author

Figured it out and it's a subtle syntax issue. So this command does not work:

wsl --import NixOS $env:USERPROFILE\NixOS\ nixos-wsl.tar.gz --version 2

But this one does.

wsl --import NixOS $env:USERPROFILE\NixOS nixos-wsl.tar.gz --version 2

It's the leading backslash that causes wsl to fail. I'll do a quick online PR to fix it.

jarrodsfarrell added a commit to jarrodsfarrell/NixOS-WSL that referenced this issue Dec 16, 2024
If there is a leading backslash `wsl` will fail with help-text.

Fixes nix-community#606
@jarrodsfarrell jarrodsfarrell linked a pull request Dec 16, 2024 that will close this issue
@jarrodsfarrell
Copy link
Author

Originally I thought this was an issue with my name containing a space, but nope after removing the leading backslash it works fine. No surrounding with quotes needed either if I'm using $env:USERPROFILE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants