nix-community / NixOS-WSL

NixOS on WSL(2) [maintainer=@nzbr]
Apache License 2.0
1.93k stars 120 forks source link

Unable to run on Windows ARM with Snapdragon X Elite #534

Open cwhite92 opened 3 months ago

cwhite92 commented 3 months ago

Bug description

NixOS imports fine on Windows ARM but when attempting to run NixOS via wsl -d NixOS the following error is thrown on Windows ARM with a Snapdragon X Elite (Microsoft Surface 7):

Catastrophic failure
Error code: Wsl/Service/E_UNEXPECTED

Happy to get more detailed logs if needed (not sure how though). Not sure if it's relevant but Ubuntu and Kali Linux both seem to work fine.

To Reproduce

  1. Follow Quick Start instructions in README to import NixOS into WSL
  2. Attempt to run NixOS via wsl -d NixOS
  3. Above error is given

Logs

Catastrophic failure
Error code: Wsl/Service/E_UNEXPECTED

WSL version

WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.26100.1591
RoadRoller01 commented 3 months ago

me too

RoadRoller01 commented 3 months ago

i got wsl logs via collect-wsl-logs and i am analyze it right now

nzbr commented 3 months ago

Just to be sure: Did you build your own tarball targeting aarch64-linux? The one from our releases is for x86_64 and will not run on ARM

RoadRoller01 commented 3 months ago

@nzbr cool, but how?, i have nix on my other x86 machine, so how i can force it to build for aarch64?

RoadRoller01 commented 3 months ago

hello i build via debian arm wsl, with this commit #530 and it still did not work, the error it appear to cause the problem is

PartA_PrivTags : 16777216
code : 
failurecount : 10
file : D:\a\1\s\src\windows\wslcore\lib\WslCoreInstance.cpp
function : 
hr : 0x8000FFFF
linenumber : 384
message : D:\a\1\s\src\windows\wslcore\lib\WslCoreInstance.cpp(474)\wslservice.exe!00007FF6FCC919CC: (caller: 00007FF6FCB756A0) Exception(10) tid(45f8) 8000FFFF Catastrophic failure
    Msg:[Expected 12 bytes, but received 0] 

threadid : 17912
wslVersion : 2.2.4.0
RoadRoller01 commented 3 months ago

also there was an error that it did not found swap.vhdx so i copied debian swap.vhdx to it path , and it got fixed WslCoreInstance error was always there before and after the fix

malik-n commented 2 months ago

@nzbr cool, but how?, i have nix on my other x86 machine, so how i can force it to build for aarch64?

If you are using a flake based config it should be something like

outputs = { self } @inputs:
  nixosConfigurations.<hostname> = {
    /* ... */
    system = "aarch64-linux";
  };

Or are you talking about cross compiling?

nzbr commented 2 months ago

@RoadRoller01 where did you get those logs from? What does dmesg say (run it in another distro)

RoadRoller01 commented 2 months ago

i got the logs from wsl, via https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1

RoadRoller01 commented 2 months ago

dmesg? do you mean the dmesg of the distro i am building the repository on? idk how it will help you yet i will tell you

nzbr commented 2 months ago

The VM is shared, so dmesg in any distro on the same machine will show the kernel logs for all other distros as well

RoadRoller01 commented 2 months ago

oooh okay 👍, i can’t do it right now, so i will send it tomorrow.

RoadRoller01 commented 2 months ago

dmesg.txt @nzbr that's it

TophC7 commented 2 months ago

I tried using this https://nix-community.github.io/NixOS-WSL/building.html to build an arm image but it did not work i still got the catastrophic failure I changed the hosts configuration to system = "aarch64-linux"; as well so what am I missing how can I build this tar for wsl?

nzbr commented 1 month ago

dmesg.txt @nzbr that's it

Thanks. Unfortunately there's no crash message from our systemd shim there, so this doesn't really help either. It probably doesn't get far enough to set that up

thashepherd commented 1 month ago

WslLogs-2024-10-17_13-20-21.zip I'm running into this issue as well. Note that I didn't attempt to rebuild for aarch64-linux or anything like that.