Rocky Linux to Microsoft WSL 2

Assumption, you have WSL 1 installed.  You want to upgrade to WSL 2 but get a “WSL 2 requires an update to its kernel component.” error.

  • Download and run the WSL2 Linux kernel update. https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
  • From the Microsoft Store, install the “AlmaLinux 8 WSL”.
  • From the Microsoft Store, install “Windows Terminal” (optional)
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V

wsl --set-version AlmaLinux-8 2
wsl --set-default-version 2

dnf install docker git
git clone https://github.com/Smalls1652/wsl2-rockylinux.git

bash createRockyLinuxImage.sh
wsl.exe --import "RockyLinux-8" "C:\path\to\dir\" "C:\path\to\rockylinux-latest.tar"
wsl.exe -d RockyLinux
wsl.exe --setdefault RokcyLinux-8
wsl.exe 

Source(s)

  • https://github.com/microsoft/WSL/issues/5363
  • https://blogs.iuvotech.com/linux-version-8-on-windows-subsystem-for-linux
  • https://github.com/Smalls1652/wsl2-rockylinux
  • https://www.configserverfirewall.com/windows-10/wsl-2-requires-an-update-to-its-kernel-component/
  • https://www.microsoft.com/en-us/p/almalinux-8-wsl/9nmd96xjj19f?activetab=pivot:overviewtab
  • https://docs.microsoft.com/en-us/windows/wsl/use-custom-distro
  • https://winaero.com/set-default-wsl-linux-distro-windows-10/