TL;DR: Follow this guide someone has kindly posted.
Trying to install Rust and failing on WSL1 on Windows 11 led me to needing to upgrade from WSL1 to WSL2.
As you can see in my powershell
I'm running version 1 of the wsl:
PS > wsl -l -v
NAME STATE VERSION
* Ubuntu Running 1
First, step is downloading and installing the new kernel package.
Secondly, enabling Virtual Machine feature:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Remember to run powershell as an admin!
Error: 740
Elevated permissions are required to run DISM.
Use an elevated command prompt to complete these tasks.
Success:
Deployment Image Servicing and Management tool
Version: 10.0.22000.1
Image Version: 10.0.22000.556
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
You maybe also need to enable in BIOS as well depending on your PC manufacturer. Windows 11 on Lenovo apparently has this enabled by default.
Now time to install the new kernel we downloaded in step 1:
It turns out I also needed to restart my computer for the virtualization enablement to take affect:
PS C:\WINDOWS\system32> wsl --set-default-version 2
Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.
For information please visit https://aka.ms/wsl2-install
Now to set to version 2:
PS C:\WINDOWS\system32> wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The operation completed successfully.
Oddly enough this didn't work - possibly because I needed to specify which linux distribution I would like to use wsl2?
PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 1
PS C:\WINDOWS\system32> wsl --set-version ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 2
Can I finally install Rust on Ubuntu on WSL 2?
Something something about running scripts through a cURL
request but it's from rust-lang.org
and you can always take a look at the script from https://sh.rustup.rs
:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Rust is installed now. Great!
$ rustup -V
rustup 1.24.3 (ce5817a94 2021-05-31)
$ rustc --version
rustc 1.60.0 (7737e0b5c 2022-04-04)
$ cargo --version
cargo 1.60.0 (d1fd9fe 2022-03-01)
ayy!
Top comments (0)