Sunday, February 25, 2024

Unable to turn on WSL feature on a Hyper-V Windows VM

 The issue was due to the Virtualization Extension is not enable by default. Every time I tried running WSL after installing the WSL package, i am getting an error that Virtualization is not enabled on BIOS. I think this is a default error. It will not say to you, "Opps, you are running under Hyper-V, enable it first". So after several google, you have to invoke the command as Admin via power shell.


Command:



wsl --helpSet-VMProcessor -VMName mytestmv01 -ExposeVirtualizationExtensions $true



where mytestvm01 is the name of the VM i need to enable WSL and needs virtualization (seems like nested) extension like you do on your bios for none virtualized machine.


Then reconnect to your VM, you should be able to run now your WSL, ubuntu or what ever flavor of linux you like to enable or install that is available from MS.



WSL - Windows Subsystem for Linux networking issue - cannot connect to network when windows is connected to VPN

 I have this issue on WSL on windows 11, when enabling this feature, by default the NetworkingMode is equal to NAT. No issue when connecting to internet from the bash CLI, but when you are connected to a VPN, like on a corporate VPN, the net setup will not allow you to connect to the internal resources. This is not a problem with WSL on Windows 10 though.

So to fix this, I need to set the NetworkingMode to mirrored. This way, what ever the IP you windows get, will have the same IP on your WSL or Linux Terminal.


To make your WSL networkingmode to mirrored, create a config file under your windows user profile.


If my username is windows.user01, then put the config under C:\Users\windows.user01\

File: .wslconfig

Content of file below:


[wsl2]

networkingMode=mirrored


Or if you are on your bash command line, you can just do


vim /mnt/c/Users/oliver.jagape/.wslconfig

and enter below: then save.

[wsl2]

networkingMode=mirrored


Shutdown WSL

--shutdown


Then open back bash, or if you have windows terminal installed, just type bash, and it will open to Linux bash terminal.