It is inside. In the previous article, I introduced the procedure Enable windows subsystem for linux (WSL1) which became a standard function of windows 10 to run kali linux. .. This time I would like to enable WSL2 which can be used in "Windows 10 Insider Preview Build" released on June 12 and use ubuntu.
As usual, we will emphasize ** awareness ** rather than comprehensibility, and introduce it in a way that does not use the GUI as much as possible.
** Software that did not work on WSL1 works! ** **
I mentioned in the previous article that WSL1 will not be able to run all software on Linux, but the Linux kernel is not working mechanically, and a function call to the kernel is made to lxcore.sys. And lxss.sys are working by converting them into function calls to the Windows kernel, and the incomplete implementation of system calls for these kernel drivers is also due to some software not working. In that respect, WSL2 runs the ** Linux kernel on ** Hyper-V, so most programs will run.
--nmap and tcpdump that couldn't be used with wsl1 are now working. --If you use wsl2, wsl1 will not be disabled, and you can select it for each OS you run on. For example, kali-linux can be run on wsl1 and ubuntu-18.04 can be run on wsl2. --You can convert ubuntu originally installed in wsl1 to wsl2 with the wsl command. --Since wsl1 is running on windows, the IP address seen from the linux side was shared with the ip address on the windows side, Since wsl2 runs on the vm and the network components are also virtualized, it is assigned a different IP address than the windows host. --Until now, enabling hyper-v on windows 10 was only possible with windows 10 Pro or Enterprise, The hyper-v based virtualization technology for wsl2 is now available at Home as well. Instead, if Hyper-v is used, VMWare and VirtualBox 6 and earlier versions cannot be executed. --It's easy to speculate that startup would have been slower because of virtualization, but it's rather faster.
--Because it uses Hyper-V technology, it is necessary to meet the requirements of Hyper-V, such as 64-bit version and virtualization technology support at the BIOS level. --Install "Windows 10 Insider Preview Build".
As of March 2020, WSL2 is only available in the "Windows 10 Insider Preview Build", and WSL2 will be available as the default feature from the feature update version provided in May 2020.
In the first place, "Windows 10 Insider Preview Build" is a mechanism to quickly obtain the functions currently under development that will be released as a stabilizer in the future, so there is a trade-off that stability will be lost. In fact, since I installed the Preview build and used wsl2, I've experienced many times that windows itself restarts automatically due to a bug that hasn't happened before. ** **
So, first of all, make a backup of your system.
This procedure is on microsoft official, so install the Preview build quickly.
** Point: By default, the frequency of receiving preview builds is "fast ring", This means that new features will be installed on a weekly basis after that, and the computer will be updated and restarted each time. It is recommended to select slowing (every month) as it will increase the amount of time it will be unavailable. ** **
After that, launch a command prompt and check that it is Windows 10 build 18917 or later with the following command.
command prompt:
C:\Users\uchi>ver
Microsoft Windows [Version 10.0.19037.1]
Run powershell as administrator.
And below, execute the command to enable the virtualization function of windows
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Please restart your computer for activation after execution.
If you are enabling wsl for the first time, including wsl1, ** Enter the following command in the started powershell. ** **
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
All you have to do is launch the microsoft store, search for ubuntu and perform the installation. This time, I added the Ubuntu 18.04 LTS version. command prompt:
C:\Users\uchi>start ms-windows-store:
Convert the installed ubuntu to wsl2. When installed, the ubuntu version of wsl is 1, so start powershell and convert it to 2.
** Check wsl version ** powershell:
PS C:\Users\uchi> wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 1
kali-linux Stopped 1
** Version conversion ** powershell:
PS C:\Users\uchi> wsl --set-version Ubuntu-18.04 2
** Reconfirm wsl version ** powershell:
PS C:\Users\uchi> wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
kali-linux Stopped 1
Now you can run kali-linux on wsl1 while running Ubuntu-18.04 on wsl2.
Left: Running tcpdump on kali linux on wsl1 and failing diagram Right: Figure of executing tcpdump with ubuntu-18.04 on wsl2
The source of wsl2's linux kernel is released on github below. WSL2-Linux-Kernel
--If you use wsl2, you will be able to use various commands and programs that were not available in wsl1. ――But at the moment, it is only provided in Windows 10 Insider Preview build, so windows will be unstable. ――So take a backup. ――Wsl1 and 2 can live together, so it's convenient to use them properly.
Recommended Posts