[Windows] WSL2 installation and related environment debugging

Preface

The old Mac seems to be a bit laggy. I replaced it with a high-performance Windows laptop. The Windows laptop requires a Linux-related environment, probably only by installing WSL2. I heard that this thing is also based on the Linux kernel. Okay. Let’s go into details today. Write down how to install this stuff.


specific process

  1. First of all, you need to search for the Linux system you need in the Windows store. What I chose here is. There Ubuntuare 2 versions for us to choose from. They are ubuntu 18and ubuntu 20.
    Insert image description here
    Insert image description here
    I chose the one that is more commonly used ubuntu 18. The version is slightly different. It's a bit older, but it doesn't affect our daily development and use.

  2. Solving errors 0x8007019e
    In fact, I have installed it once before on the company's computer. During this process, the most torturous part was troubleshooting. You see, as soon as we opened it, he reported an error to us, and then included the error code 0x8007019e. Then just use this code to search.

Insert image description here

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007019e
The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again.
See https://aka.ms/wslinstall for details.
Press any key to continue...

Solutions & Problems:

WSL is Windows Subsystem for Linux. Search for WSL in the Microsoft store in the Windows operating system to download linux distributions such as ubuntu, kali, opensuse, etc. However, when running after installation, if an error of 0X8007019E is reported, you need to select "Enable or close Windows" Enable Windows Subsystem for Linux at "Feature" to solve the error problem. You can also execute Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem -Linux under powershell.

To modify the root password, you can execute the command ubuntu config –default-user root under powershell to configure the root password.
Solution to WSL error 0X8007019E

The actual method is not written in the above article. Some experience tells us that we need "Control Panel" --> "Uninstall a program" --> "Enable or disable Windows programs" --> "Select a subroutine suitable for Linux" System” --> “Restart the computer”
Insert image description here
Insert image description here
Insert image description here
How to turn on the Windows subsystem for Linux in Win10

Failed to start Windows Subsystem for Linux.
Restarting computer... To be continued.


  1. Resolve errors0x800701bc

Good guys. After restarting, the error changed. Let’s continue the installation.

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x800701bc
Error: 0x800701bc WSL 2 ?????????????????? https://aka.ms/wsl2kernel

Press any key to continue...

Insert image description here
The query found that wsl is not the latest version.
How to solve the following problems when installing the ubuntu subsystem on win11?

Insert image description here
This means that you need to use administrator rights to run wsl --updatethe command.
Insert image description here
You will see the prompt. wsl --shutdown. Force restart.


  • Troubleshooting0x80370102
    Insert image description here
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 ???????????????????

Press any key to continue...

As you can see, the error has changed again.

To solve this problem. First, it seems that you need to check whether BIOS virtualization is enabled.
Insert image description here
https://blog.csdn.net/qq_39757730/article/details/117431647
https://zhuanlan.zhihu.com/p/147233604?from_voters_page=true

  • Sand sculpture Windows 11 Home Edition. This function has been castrated. Simply find a script to download.
    Note that it needs to be opened with administrator rights.
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL

Windows 11 does not have Hyper-V solution

Insert image description here

Insert image description here
Insert image description here


Ubuntu initialization

Insert image description here

After all installations are completed, ubuntuyou will be asked to initialize your account and password. We can complete this by entering them in sequence.


Additional questions

  • The attempted operation is not supported by the referenced object type. (The attempted operation is not supported for the type of object referenced.)

Here. In my case, it was caused by using a VPN proxy. Other problems. You can refer to this blog to
solve the problem of "The referenced object type does not support the attempted operation" when using WSL2.


密码遗忘如何重新设置密码We will add ubuntu文件挂载在什么地方, 如何ubuntu内使用Windows内容these two questions later .

Guess you like

Origin blog.csdn.net/u010416101/article/details/121326057