Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Fix "Unable to locate package" in Kali Linux

apt cannot find the package you asked for. Check the name, the package list, the repositories and your network.

VPS and Cloud Servers2 min read4 steps2 screenshots

Why it happens

  1. Wrong package name. A typo or a name that does not exist in Kali.
  2. Old package list. The local list is out of date.
  3. Wrong repositories. sources.list is missing the Kali repository.
  4. Network problems. apt cannot reach the repository.

Steps

1. Check the name for typos. Search for the package:

apt search package_name
Searching for a package

2. Update the package list

sudo apt-get update
sudo apt-get upgrade

3. Check the repository file

cat /etc/apt/sources.list
The Kali sources list

For Kali Linux, it should contain this line:

deb https://http.kali.org/kali kali-rolling main contrib non-free

Newer Kali releases also use non-free-firmware. If the line is missing or wrong, edit the file:

sudo nano /etc/apt/sources.list

4. Add or update the repository key. The key of the Kali archive can expire. The current method puts the key in a keyring:

sudo wget https://archive.kali.org/archive-keyring.gpg -O /usr/share/keyrings/kali-archive-keyring.gpg

Then run sudo apt update again.

5. Clean the apt cache

sudo apt clean

6. Test your network

ping google.com

7. Try aptitude. It can give better hints:

sudo apt-get install aptitude
sudo aptitude search package_name
sudo aptitude install package_name

For example, to find an office suite, run apt search office.

Quick recap

  • Check the name, then run apt update.
  • Make sure sources.list has the Kali repository.
  • Renew the archive key and test the network.