Like other Linux distribution Kali Linux also needs a dedicated source to download and install the packages we need. By default, Kali Linux doesn't come with the necessary source links.

We need to manually put the list of sources from where we want to install our required packages. If there is no sources list or bad sources list on the Linux system it will result in 'E: unable to locate package' error.

E: Unable to locate package

This problem may comes due to bad internet connection. If the internet connection is not the problem then it might because for the wrong repository. We will solve this problem by going through the processes explained in this article.

First we need to go to our Kali Linux's computer File system and navigate to etc/apt folder.

Right-click on the 'sources.list' text file and open it with any text editor.

editing sources.list on mousepad

Delete if there is anything already wrote on the text file. Then copy and paste following lines there.
deb http://http.kali.org/kali kali-rolling main non-free contrib

Then save and close it.


There is another way to do it more easily. We can use a single command to do all these works. We just need to open a terminal and run the following command:
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee /etc/apt/sources.list

This command may ask the super user password (SuDo password) of the Kali Linux machine and fix the repository.

Now we need to update the system by using following command:
sudo apt-get update

Now it will start update and after update our problem is fixed.

So this is the most simple way to fix unable to locate package in Kali Linux.

It will work for everyone if not then please comment down below. For more tutorial visit our site regularly and follow us on Twitter for quick update.