Skip to content

Instantly share code, notes, and snippets.

@MooreDerek
Last active October 21, 2023 18:22
Show Gist options
  • Save MooreDerek/23686fc29a22d4e1e88e3dd9055fbb07 to your computer and use it in GitHub Desktop.
Save MooreDerek/23686fc29a22d4e1e88e3dd9055fbb07 to your computer and use it in GitHub Desktop.
Installing Kali on WSL getting apt update error

Installing Kali

wsl --install -d kali-linux

When terminal starts up try running

sudo apt upgrade and get the following error:

Get:1 http://wlglam.fsmg.org.nz/kali kali-rolling InRelease [30.6 kB]
Err:1 http://wlglam.fsmg.org.nz/kali kali-rolling InRelease
  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
Fetched 30.6 kB in 2s (13.7 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://wlglam.fsmg.org.nz/kali kali-rolling InRelease: The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>

Following the steps shown here: https://superuser.com/questions/1644520/apt-get-update-issue-in-kali

will resolve the issue, but you may see the following error:

wget -O kali-archive-keyring_2020.2_all.deb https://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2020.2_all.deb
--2021-10-26 10:24:41--  https://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2020.2_all.deb
Resolving http.kali.org (http.kali.org)... 192.99.200.113, 173.246.100.151, 217.70.187.11, ...
Connecting to http.kali.org (http.kali.org)|192.99.200.113|:443... connected.
ERROR: The certificate of ‘http.kali.org’ is not trusted.
ERROR: The certificate of ‘http.kali.org’ has expired.

This is easily fixed by pulling from http rather than https

wget -O kali-archive-keyring_2020.2_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2020.2_all.deb
@Stef16Robbe
Copy link

holy shit thank you

@victoralcantara75
Copy link

thanks man

@qx-775
Copy link

qx-775 commented Feb 11, 2022

Amazing solution. For Kali Linux beginners in 2022, who don't know how to continue when they got that kali-archive-keyring.deb file you can use this:

wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb
sudo dpkg -i kali-archive-keyring_2022.1_all.deb  

now sudo apt update should work and you can go on your way :)

@Mr-jba
Copy link

Mr-jba commented Feb 13, 2022

Highly Appreciated, any Guide / Manual / Book Suggestion for beginners on Kali ? @MooreDerek @qx-775

@HUGHNew
Copy link

HUGHNew commented Feb 21, 2022

You can check the parent path for lastest package if encounter 404 Not Found.

@eversonmachado
Copy link

Amazing solution. For Kali Linux beginners in 2022, who don't know how to continue when they got that kali-archive-keyring.deb file you can use this:

wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb
sudo dpkg -i kali-archive-keyring_2022.1_all.deb  

now sudo apt update should work and you can go on your way :)

Yesss... You saved my work. Thanks!!

@niallriddell
Copy link

niallriddell commented Jul 6, 2022

So this worked for me:
(thx qx-775)
wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb
sudo dpkg -i kali-archive-keyring_2022.1_all.deb

(thx https://superuser.com/questions/1413065/how-to-fix-sudo-account-validation-failure-is-your-account-locked)
from powershell: wsl -u root -d kali-linux

(thx https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1818037.html)
then
$ cd /tmp
$ apt -y download libcrypt1
$ dpkg-deb -x libcrypt1_1%3a4.4.25-2_amd64.deb .
$ cp -av lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/
$ apt -y --fix-broken install
$ apt apt upgrade -y

@MooreDerek
Copy link
Author

@niallriddell unfortunately, gave this a try and it failed on the download of libcrypt1

/tmp# apt -y install libcrypt1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libcrypt1

@MooreDerek
Copy link
Author

MooreDerek commented Jul 8, 2022

So this worked for me: (thx qx-775) wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb sudo dpkg -i kali-archive-keyring_2022.1_all.deb

(thx https://superuser.com/questions/1413065/how-to-fix-sudo-account-validation-failure-is-your-account-locked) from powershell: wsl -u root -d kali-linux

(thx https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1818037.html) then $ cd /tmp $ apt -y download libcrypt1 $ dpkg-deb -x libcrypt1_1%3a4.4.25-2_amd64.deb . $ cp -av lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/ $ apt -y --fix-broken install $ apt apt upgrade -y

@niallriddell Did a clean install of kali-linux and your steps definitely worked - many thanks. To summarise, the steps are:

Powershell

* wsl --install -d kali-linux       <--- Set up root user and password in spawned terminal, then continue in the Powershell
* wsl -u root -d kali-linux
* cd /tmp 
* wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb
* dpkg -i kali-archive-keyring_2022.1_all.deb
* apt update
* apt -y upgrade
* apt -y download libcrypt1
* dpkg-deb -x libcrypt1_1%3a4.4.27-1.1_amd64.deb .     <------- Note the version has been updated, so you may need to check version if the command fails
* cp -av lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/
* apt -y --fix-broken install
* apt upgrade -y

@christmex
Copy link

Amazing solution. For Kali Linux beginners in 2022, who don't know how to continue when they got that kali-archive-keyring.deb file you can use this:

wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb
sudo dpkg -i kali-archive-keyring_2022.1_all.deb  

now sudo apt update should work and you can go on your way :)

THX man

@sophxe
Copy link

sophxe commented Sep 15, 2022

So this worked for me: (thx qx-775) wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb sudo dpkg -i kali-archive-keyring_2022.1_all.deb
(thx https://superuser.com/questions/1413065/how-to-fix-sudo-account-validation-failure-is-your-account-locked) from powershell: wsl -u root -d kali-linux
(thx https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1818037.html) then $ cd /tmp $ apt -y download libcrypt1 $ dpkg-deb -x libcrypt1_1%3a4.4.25-2_amd64.deb . $ cp -av lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/ $ apt -y --fix-broken install $ apt apt upgrade -y

@niallriddell Did a clean install of kali-linux and your steps definitely worked - many thanks. To summarise, the steps are:

Powershell

* wsl --install -d kali-linux       <--- Set up root user and password in spawned terminal, then continue in the Powershell
* wsl -u root -d kali-linux
* cd /tmp 
* wget -O kali-archive-keyring_2022.1_all.deb http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb
* dpkg -i kali-archive-keyring_2022.1_all.deb
* apt update
* apt -y upgrade
* apt -y download libcrypt1
* dpkg-deb -x libcrypt1_1%3a4.4.27-1.1_amd64.deb .     <------- Note the version has been updated, so you may need to check version if the command fails
* cp -av lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/
* apt -y --fix-broken install
* apt upgrade -y

This worked a treat, ensuring the libcrypt file name was the correct one. Thanks!

@kylefmohr
Copy link

I summarized your initial post + the steps given by @niallriddell here, with credit given to you both. Thanks! I've needed this a couple of times now.

@nichollsc81
Copy link

@qx-775 December 2022, your resolution worked for me nicely.

@binarytrails
Copy link

binarytrails commented Jan 3, 2023

only bump is:

$ apt-get update
Get:1 http://kali.download/kali kali-rolling InRelease [30.6 kB]
Reading package lists... Done
E: Release file for http://http.kali.org/kali/dists/kali-rolling/InRelease is not valid yet (invalid for another 2h 56min 11s). Updates for this repository will not be applied.

anyone who doesn't have time to deal with windows nonsense can use this hack to move along:

apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update

@Yuvraj0157
Copy link

I am getting some other error while trying to install the package through dpkg.
sudo dpkg -i kali-archive-keyring_2022.1_all.deb
dpkg-deb: error: 'kali-archive-keyring_2022.1_all.deb' is not a Debian format archive
dpkg: error processing archive kali-archive-keyring_2022.1_all.deb (--install):
dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
kali-archive-keyring_2022.1_all.deb

@kylefmohr
Copy link

I am getting some other error while trying to install the package through dpkg.
sudo dpkg -i kali-archive-keyring_2022.1_all.deb dpkg-deb: error: 'kali-archive-keyring_2022.1_all.deb' is not a Debian format archive dpkg: error processing archive kali-archive-keyring_2022.1_all.deb (--install): dpkg-deb --control subprocess returned error exit status 2 Errors were encountered while processing: kali-archive-keyring_2022.1_all.deb

Immediately before that command, you should have run wget http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb, can you confirm that command executed successfully?

@ftdot
Copy link

ftdot commented Oct 21, 2023

Thank u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment