rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.1k stars 877 forks source link

Install rust on WSL 2 of Win 11 brings Green screen of Death #2887

Open kimlimjustin opened 2 years ago

kimlimjustin commented 2 years ago

Problem Installation of Rust went smooth on Windows 11 and Ubuntu itself, but when trying to install it on the Ubuntu subsystem of Windows 11, my computer went into Green screen of Death with the error code MEMORY_MANAGEMENT

Steps

  1. Use windows 11 insider build
  2. Install Ubuntu WSL
  3. Open the WSL
  4. Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh to install
  5. Just wait and Green Screen of Death will come up

Notes The Green Screen of Death stays on 0% for hours and forcing the electricity to went out and boot it again won't give you another Green Screen of Death, it will boot into Windows 11 smoothly. After login in into WIn 11, running rustc --version won't give any output,

image WhatsApp Image 2021-10-31 at 11 45 05

NervosaX commented 2 years ago

I get the exact same issue, exact same steps. The install will suddenly crash windows and restart. If I proceed to uninstall:

rustup self uninstall

and then repeat the curl above, the error repeats.

kinnison commented 2 years ago

While this is definitely irritating for you; it's not a bug in Rustup. It should not be possible for a userland program inside a VM inside a modern OS to cause a kernel failure. It would be good if you can report this bug in Windows 11. I'll leave this issue open short-term so that people who encounter this know we're aware; but there's nothing for us to do right now.

workingjubilee commented 2 years ago

Is this WSL1 or WSL2? I have seen other reports of lots of GSoDs on WSL1.

kimlimjustin commented 2 years ago

Is this WSL1 or WSL2? I have seen other reports of lots of GSoDs on WSL1.

WSL2

rbtcollins commented 2 years ago

@NervosaX @kimlimjustin how much memory do your Windows machines have in them ? What does free -h report within WSL ?

Rustup is aggressive about using memory reported as available. It is likely a problem with ballooning pages in the hypervisor interface.

For instance, on my WSL 2 here:

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           62Gi       759Mi        61Gi       0.0Ki       113Mi        61Gi
Swap:          16Gi          0B        16Gi
rbtcollins commented 2 years ago

After installing rustup (no crash) I have:

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           62Gi       772Mi        60Gi       0.0Ki       1.2Gi        61Gi
Swap:          16Gi          0B        16Gi

Note the jump in cache. Memory pressure peaked at 1G during rustup toolchain add stable - so about 240MB being used by rustup.

rbtcollins commented 2 years ago

Last question, does this happen on non-insiders builds? Anything on an insiders build is default-assumed to be the builds problem ;)

kimlimjustin commented 2 years ago

Oh yeah, forgot to update, some days ago, I decided to reinstall the wsl and the ubuntu subsystem, and after reinstalling, finally, it works!

What does free -h report within WSL ?

              total        used        free      shared  buff/cache   available
Mem:           31Gi       212Mi        30Gi       0.0Ki       371Mi        30Gi
Swap:         8.0Gi          0B       8.0Gi

Last question, does this happen on non-insiders builds? Anything on an insiders build is default-assumed to be the builds problem ;)

Idk, I can't try on non-insider builds tho cuz I got no other machine and the spaces in my computer is not enough for building another virtual machine again.

NervosaX commented 2 years ago

I was on WSL1, I didn't realize it stayed on 1 after upgrading to Windows 11. Moving to WSL2 fixed the issue for me.

Others can check in cmd/powershell with:

wsl -l -v for the version of wsl they have.

You can use wsl --set-version ubuntu 2 to upgrade (if you're using ubuntu).

kimlimjustin commented 2 years ago

I'm pretty sure that's on wsl2

workingjubilee commented 2 years ago

Do we have a FAQ for troubleshooting advice? I believe that "move to WSL2" and "have you tried uninstalling and reinstalling?" should go on such a thing for WSL.

kinnison commented 2 years ago

For now I'm going to pin this issue so that people notice it (hopefully), but otherwise there's nothing to be done I think

PranavRNambiar commented 2 years ago

I was on WSL1, I didn't realize it stayed on 1 after upgrading to Windows 11. Moving to WSL2 fixed the issue for me.

Others can check in cmd/powershell with:

wsl -l -v for the version of wsl they have.

You can use wsl --set-version ubuntu 2 to upgrade (if you're using ubuntu).

Yeah this worked for me, to be exact use ' wsl --set-version Ubuntu-20.04 2'

LordOfTheDings commented 2 years ago

Unfortunately, using Windows 11, I am not able to install an Ubuntu distribution on WSL2. Any attempt results in me getting this error message: image

Virtualization is active on as you can see here: image

So in conclusion: Attempting to install Rust on WSL1 ends up giving me the blue screen of death and WSL2 is not available for some unknown reason, which is leaving me pretty clueless.

rbtcollins commented 2 years ago

We will need folk suffering this to debug the problem themselves:

If you have a problem with WSL1 on Windows 11, please file a new bug.

@LordOfTheDings the message you're getting about WSL2 is not related to rustup - you'll need to debug that with Microsoft support.

LordOfTheDings commented 2 years ago

I have since managed to install Ubuntu on WSL 2 after many unsuccessful attempts, simply by disabling Hyper-V, Virtual Machine and Windows Subsystem for Linux and enabling them again after a restart. I have no idea why this fixed the problem, since all options were fully enabled in the first place. Installing Rust on WSL2 worked as expected, therefore some related factor definitely seems to have an impact on the installation process.

TheFriendlyCoder commented 2 years ago

I just tried installing rust on WSL a couple of days ago (ubunutu-20.04 kernel) and hit this problem. It took some time for me to find this bug report, but thank goodness I did. After reading the comment threads I discovered I was running wsl1. After upgrading my ubuntu environment to wsl2 I was able to successfully install the rust toolchain. Just wanted to add my two cents to the mix here in case it helps.

In case it's relevant, I was on Windows 10 for a while - and had installed wsl + ubuntu while on Windows 10 - but just recently updated to Windows 11. I hadn't tried to install Rust on wsl before I upgraded so I have no reference for comparison, but maybe something broke in wsl1 during the Windows 11 upgrade. Just mentioning it in case it helps someone in the community debug this further.

legion2002 commented 2 years ago

I just tried installing rust on WSL a couple of days ago (ubunutu-20.04 kernel) and hit this problem. It took some time for me to find this bug report, but thank goodness I did. After reading the comment threads I discovered I was running wsl1. After upgrading my ubuntu environment to wsl2 I was able to successfully install the rust toolchain. Just wanted to add my two cents to the mix here in case it helps.

In case it's relevant, I was on Windows 10 for a while - and had installed wsl + ubuntu while on Windows 10 - but just recently updated to Windows 11. I hadn't tried to install Rust on wsl before I upgraded so I have no reference for comparison, but maybe something broke in wsl1 during the Windows 11 upgrade. Just mentioning it in case it helps someone in the community debug this further.

Yes this solution worked for me, thanks a lot!

soundslocke commented 2 years ago

The situation described by @TheFriendlyCoder is exactly what I dealt with tonight. I upgraded from Windows 10 to Windows 11 and was still on WSL 1. Running rustup continually caused a blue screen of death for me.

The process for upgrading to WSL 2 was as follows:

  1. Enable CPU virtualization in the system BIOS (this differs depending on your hardware). This seemingly wasn't necessary for me to previously run WSL 1! I didn't have it enabled and this was necessary to get the commands below to run.

  2. Download and install the Linux kernel update package: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

  3. Enable the Windows 11 virtualization feature/component with administrator PowerShell:

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  4. Upgrade WSL and set default version with administrator PowerShell:

    wsl --set-version Ubuntu-20.04 2
    wsl --set-default-version 2
    1. Check that things look correct in PowerShell:
      wsl -l -v

      Should output something like:

      NAME            STATE           VERSION
      * Ubuntu-20.04    Stopped         2

The steps above are an assortment of steps from a couple Microsoft articles:

kanedaaaa commented 2 years ago

Can confirm that upgrading to WSL2 solved it. image

Thanks @soundslocke

rbtcollins commented 2 years ago

I'm locking this now as folk are continually missing the details of this bug and its generating noise, please grab us on the rust Discord in the wg-rustup channel if you have some relevant data (windows 11 + WSL2 + green screen failure).

Issues with WSL1 should be a new bug please.

rbtcollins commented 2 years ago

I've also unpinned this - we pinned it because WSL2 being broken on Windows 11 was scary, but that doesn't seem to be happening systematically, so this is an attractive nuisance today.