How to Fix Unable to Locate Package in Less Than a Minute

If you are not finding the package in your system and getting the error unable to locate package, then let me show you what to do next.

It’s a clear day with a bright sun, but for my system, it’s still hazy – A frustrated user is not able to find the packages, so let’s have a chat with him.

Anonymous user: It’s really hard to find packages in Ubuntu.

Root user: No, it’s not like that.

Anonymous user: Then why am I not able to install the application on my system?

Root user: There are a number of reasons for it, from a very silly mistake to a really big issue, but all have a solution. You just have to know a few things before you jump to the installation part.

Anonymous user: How can you say silly mistake? I know what I’m doing.

Root user: Nah! Don’t take me wrong. The Ubuntu package manager is not as smart as you and me, so you have to treat them the way they understand.

Anonymous user: Cool…Cool So tell me what I can do to install applications on my Ubuntu machine.

Root user: Sure, why not?

How to Fix Unable to Locate Package in Ubuntu/Debian based Machine

Root user: There are a few methods you can apply to your system to fix the problem. So as not to overwhelm you, I’ll try to give you solutions as we move ahead. Is it okay with you?

Anonymous user: Not an issue, so what is the first thing I should check?

📝 Quick Action

🔗

There are several reasons for “unable to locate packages” in Ubuntu and Debian, but you can solve them easily with the following actions:

🚀 Try to update the repository

First and basic step is to update system repository

$ sudo apt update && sudo apt upgrade

🚀 Check Package Name

Make sure you are typing the correct name and version. To verify the name, make a quick search on the internet, or else you can use the bash completion feature for shell to autocomplete the package name to avoid any typo errors.

🚀 Enable universe, multiverse, restricted repository on Ubuntu

$ sudo add-apt-repository restricted 
$ sudo add-apt-repository universe 
$ sudo add-apt-repository multiverse 

🚀 Add PPA

Try to find the PPA for the application on launchpad.net and install them using the below code:

$ sudo add-apt-repository <ppa:ppa-name/ppa>
$ sudo apt update
$ sudo apt install <package-name>

🚀 Add Source Information of Package

Some applications provide you with source information to add to your system, so please check the respective application website for details.

1

Try to Update System Repository

Root user: The very first thing I would recommend is updating your system repository, especially if you just finished with the Ubuntu installation and are trying to install packages.

A reason for emphasizing this is that when you freshly install the Ubuntu or Debian-based distro, the system repository cache hasn’t yet been created, and due to that, you won’t be able to install applications until you refresh the cache information by running the below command:

$ sudo apt update && sudo apt upgrade

Anonymous User: Okay, I understood, but you used the term system repository cache, I didn’t understand what that meant.

Root user: See, whenever you try to install any application, the APT package manager first checks the package information in the system cache, which is stored in the following path: /var/lib/apt/lists/.

Once the information is fetched from /var/lib/apt/lists/, it’s go online and download and install the package on your system.

Anonymous user: I get your point! But my installation is quite old, so I don’t think I have that problem, but I still try to update the repository to update the cache to see any changes.

Root user: Of course, try it once. If the problem is not solved, we will move on to the next solution.

2

Check Package Name

Anonymous user: 😑 The above method didn’t work for me.

Root user: Ok, now I’ll tell you something you won’t believe that might cause problem.

Anonymous user: What is it?

Root user: Check the package name like you have typed the correct name of the package because sometimes the package name is different than what you presume and also because the package name respects case sensitivity.

For example, if the package name in the Ubuntu repository for xyz application is “package-name,” but you have typed  sudo apt install package-name, which Ubuntu won’t find in their repository, it will throw the E: Unable to locate package error.

Anonymous user: Fair enough, but how can we ensure the package name that I’m typing is correct?

Root user: Hmm. It’s not that difficult. Ubuntu has enabled the bash-completion feature for you, so you can use it while declaring the filename by invoking tab name after giving a few characters.

For instance, if I want to install Postgresql, I can easily start by typing “post” and pressing the tab button to suggest packages that start with post.

Syntax will look similar to this: sudo apt install post<PRESS-TAB>.

However, if the bash-tab-completion feature is not working, check out this article.

Apart from that, you can do a quick search in your favorite browser to get the actual application name.

Anonymous user: 😓 I can’t belive that was the real problem in my end acutally I was typing nettools instead of net-tools.

Root user: It’s great that you figured out the problem.

Anonymous user: Thanks for the help! Is there anything more we can do if some package is not available, so if something similar happens in the future, I will know where to look for it?

Root user: I like that you want to know more about this. So let me tell you a few more methods that you can use to troubleshoot this problem.

3

Search for Package Availabilty to your Installation

Root user: I’m sure you have watched many tutorials or read a blog like mine, and you will find that they suggest you to install an application, but when you try to run the same command on your end, you will not find the application on your system.

Anonymous user: Yes, I heard about that problem from someone. So now how can we know whether the following application is available on my Ubuntu installation or not?

Root user: For this, you can use the below code, and from the output, take note of the codename of your Ubuntu installation.

$ lsb_release -a

Once you have the codename, click here to go to the Ubuntu package website, where you need to select the following changes as per the below image to search for package information related to your system codename.

Here I’m looking for the ubuntu-restricted-extras package, which is very useful when you are not able to get audio in your system due to a missing codec on your Ubuntu machine.

Search for package in Ubuntu Package Webpage
Search for package

As you can see in the below image, the ubuntu-restricted-extras package is available in the Multiverse repository. So if you try to install this application, you won’t find it on your system unless you add the Multiverse repository to your Ubuntu-based machine.

Package information retrived
Package Infomation

Anonymous user: I have never heard of the multiverse repository. Can you tell me what it is?

Root user: Well! If you have never heard of the universe, multiverse, or restricted repository, then you should check out this article for detailed information on this topic.

Now let’s get back to our main topic.

When you are aware that a package is only available in a universe, multiverse, or restricted repository, you can use the following line of code to add the repository information:

$ sudo add-apt-repository universe 
$ sudo add-apt-repository multiverse 
$ sudo add-apt-repository restricted 

After adding the line update system, try to install the application.

$ sudo apt update
$ sudo apt install <package-name>

4

Grab and Add PPA

Anonymous user: Whoa! After adding the above-mentioned repository, I can find numerous sets of applications that were initially not available on my system.

Root user: Not only that, you can also add PPA (Personal Package Archive), which is a third-party repository that can be used as an option when certain applications are not available on your system.

This will also ensure that you have the latest version of the application before it gets added to the Ubuntu repository. It’s like a win-win option to get a package that is not available in the repository and also have the latest version.

But there is a catch: you should never add any random PPA to your system to prevent compromising its stability and security.

So, before adding the repository, make sure to research and verify its reputation, trustworthiness, and whether it is actively maintained or not.

Anonymous user: I’ll make sure of that, but from where can we get PPA?

Root user: To find PPA, you can do a quick search on the internet or else use this link to search for PPA information by entering a search keyword like “application-name ppa”.

Search for PPA information
Search for PPA information

For instance, I searched for the Mozilla PPA and found the following information to add to my system to get the standard version of Mozilla Browser:

$ sudo add-apt-repository ppa:mozillateam/ppa

Once you add the PPA information, try to update the system repository and install the application as shown below.

$ sudo apt update
$ sudo apt install firefox

Anonymous user: Great! I want to know more about PPA. If you can share some sources with me to read, that would be nice of you.

Root user: Of course, read this guide.

5

Add Source Information of Package

Anonymous user: Hey dude! Now I’m figuring out how to install AnyDesk on my Ubuntu system, but I haven’t found it using the above method.

Root user: Certain applications are not available in the repository due to various compliance issues. In that case, try to look at their official site, where you will find information on how to install their application on a Linux machine.

As your concern relates to AnyDesk, which is popular proprietary software for remote desktop, and you want to install it on your system, you have to add source information like repository keys to verify package integrity and the source list to the /etc/apt/sources.list.d/ directory.

$ wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | apt-key add -
$ sudo echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list
apt update

Once you have added the following information, you can finally install the application from your terminal itself.

$ sudo apt install anydesk

Anonymous user: Oho, Now I’m able to install AnyDesk on my system using this method, but can we find the same kind of information for most of the applications?

Root user: In one word “No”. It depends on the developers.

Is there any other way?

Root user: Most likely, if the application is available in the system repository, PPA, or by adding source information, you will definitely find out, but if it is not there, you won’t be able to use it.

Anonymouse user: It means we cannot install it.

Root user: No, there are a few more options available for Linux users to try, like package managers like Snap, Flatpak, and AppImage, or installing applications directly from the .deb binary file.

Also Read: How to Install an Application Graphically in Ubuntu/Debian

If you can manage to install packages from source, then there is one more option available to you, but it’s quite overwhelming for a rookie, and because of that, most people get a “unable to locate package” errors when they try to install applications.

So, it’s better to try to search for applications in the inbuilt software center to look for the application that you want to install.

I think I made my point clear.

Wrap up

That’s all for this guide, where I try to solve the common problem in such a way that every new user who has faced the issue can solve it very easily.

If it helps you fix the problem, then do let me know in the comment section. You can also raise your concern in the comment about the application that you are not getting, and I’ll try to find it for you.

Anyway, if you know of any others to solve the unable to locate package error, feel free to share how you fix them.

I hope you like the article…SEE YOU IN THE NEXT POST.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments