Saturday, March 19, 2022

Installing Kali Linux on WSL2

In the last post I installed Kali Linux on WSL1, but actually it was not recommended as WSL2 is better than WSL1 obviously.

Here is comparison between WSL1 and WSL2.

And also I realized docker was not able to run on WSL1 linux. So I am re-installed Kali Linux on WSL2.



First WSL default version should be changed to version 2. Just type this command is fine.

wsl --set-default-version 2

PS C:\Users\tmlocal> wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The operation completed successfully.

To confirm the WSL version just typing this below command is OK.

wsl --status

PS C:\Users\tmlocal> wsl --status
Default Version: 2

Windows Subsystem for Linux was last updated on 11/15/2021
WSL automatic updates are on.

Kernel version: 5.10.60.1



Now Kali Linux can be installed on WSL2. Here is the command to install.

wsl --install -d kali-linux

PS C:\Users\tmlocal> wsl --install -d kali-linux
Downloading: Kali Linux Rolling
Installing: Kali Linux Rolling
Kali Linux Rolling has been installed.
Launching Kali Linux Rolling...


In the new window Kali Linux starts running like this.

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: tmlocal
New password:
Retype new password:
passwd: password updated successfully
Installation successful!



Next step is to install the latest versions of all the installed packages. Following 2 commands need to be executed.


sudo apt-get update
sudo apt-get upgrade

Again I got similar error when I installed Kali Linux on WSL1.

tmlocal@local:~$ sudo apt-get update
Get:1 http://ftp.jaist.ac.jp/pub/Linux/kali kali-rolling InRelease [30.6 kB]
Err:1 http://ftp.jaist.ac.jp/pub/Linux/kali kali-rolling InRelease
  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository 
Fetched 30.6 kB in 1s (34.6 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ftp.jaist.ac.jp/pub/Linux/kali kali-rolling InRelease: The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository 
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository 
W: Some index files failed to download. They have been ignored, or old ones used instead.



Hence I downloaded kali-archive-keyring_2022.1_all.deb from this URL and installed.

tmlocal@local:/mnt/c/users/tmlocal/Downloads$ sudo apt install ./kali-archive-keyring_2022.1_all.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'kali-archive-keyring' instead of './kali-archive-keyring_2022.1_all.deb'
The following packages will be upgraded:
  kali-archive-keyring
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/5,140 B of archives.
After this operation, 2,048 B disk space will be freed.
Get:1 /mnt/c/users/tmlocal/Downloads/kali-archive-keyring_2022.1_all.deb kali-archive-keyring all 2022.1 [5,140 B]
(Reading database ... 17118 files and directories currently installed.)
Preparing to unpack .../kali-archive-keyring_2022.1_all.deb ...
Unpacking kali-archive-keyring (2022.1) over (2018.1) ...
Setting up kali-archive-keyring (2022.1) ...
Installed kali-archive-keyring as a trusted APT keyring.

After this update and upgrade was successfully completed.



And there is one more important installation.

sudo apt install libcrypt1

If libcrypt1 is not available Kali linux will lock out user after failing libgcc setup.

Here is example.


Setting up libgcc-s1:amd64 (12-20220313-1) ...
(Reading database ... 17098 files and directories currently installed.)
Preparing to unpack .../libc6_2.33-6_amd64.deb ...
Checking for services that may need to be restarted...
Checking init scripts...
Unpacking libc6:amd64 (2.33-6) over (2.28-10) ...
Setting up libc6:amd64 (2.33-6) ...
/usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
dpkg: error processing package libc6:amd64 (--configure):
 installed libc6:amd64 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 libc6:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)


tmlocal@local:$ sudo -l

Sorry, try again.

Sorry, try again.

sudo: 3 incorrect password attempts


No comments:

Post a Comment

Installing Kali Linux on WSL2

In the last post I installed Kali Linux on WSL1, but actually it was not recommended as WSL2 is better than WSL1 obviously. Here is compari...