“E: Unable to locate package” Error On Ubuntu [Solved]

If you are looking for a fix to get rid of the “Unable to locate package” error on your Linux device, then you have come to the right place. Many Linux Ubuntu users these days are not able to use the full features of their devices due to this “Unable to locate package” error.
E: Unable to locate package

When you want to install any package on Ubuntu Linux, it identifies, locates, and installs the package. But, in some cases, it couldn’t locate the package or couldn’t identify it due to some issue. That’s when you will get the “Unable to locate package” error and the installation will not be successful.

There can be various reasons why this error is appearing. Here, we will show you some of the most effective and useful methods that help in resolving the Unable to locate package error on Ubuntu.

Unable To Locate Package

To install any package on Ubuntu, you must use the apt_get or apt commands. Starting with the first step, this is how you give the command to install the package on Ubuntu.

sudo apt install package_name“.

Most of the time, the installation is done successfully without any interruption. But, if due to any reason the installation was unsuccessful, you will get a message or an error code like this.

  • sudo apt-get install package-name
  • Reading package lists… Done
  • Building dependency tree
  • Reading state information… Done
  • E: Unable to locate package package-name

Any of these error codes mean that Linux can’t locate the package or is unable to locate package that you are trying to install. There can be a list of reasons for your package to not be located. However, you can fix it in no time.

How To Fix Unable To Locate Package Error On Ubuntu

Let’s take a look at how you can easily detect and fix the problem that is causing the package error on Ubuntu. Here, we will show you some useful and easy methods with detailed explaining steps so that you can easily understand and implement them.

Use Correct Package Name

Since Linux works with commands, you must have known already how important it is to enter correct commands. If there was a single mistake even with the letters or characters, you can get an error code.

Therefore, the first thing you must check when your OS can’t locate the package that you are installing is the package name. Make sure that you are using the correct name of the package.

Update Repository Cache

To update the repository cache, the only thing you have to do is give a single command. Just type the command below and press Enter.

sudo apt update

But, before updating the system, you must ensure to follow the given steps below.

  • Go to the “Ubuntu Software” tab.
  • Enable the first four checkboxes on this tab.
  • Now, go to the Updates tab and enable the four repository boxes.
  • Next, click on the “Close” button.
  • Then, click on the “Reload” button to update the cache.
  • Finally, update the system.

Or simply, you can run the following 4 commands to add the repositories.

  1. sudo add-apt-repository main
  2. sudo add-apt-repository universe
  3. sudo add-apt-repository restricted
  4. sudo add-apt-repository multiverse

Once you are done with adding the repositories, run the following two commands to update the system.

sudo apt-get update
sudo apt-get upgrade

Check The Compatibility

If checking the package name and updating are not helping to get rid of the error, then the reason can be this one.

If the package that you are trying to install is not compatible with the Linux version you use, this can also lead to errors in locating the package. Therefore, it is necessary to know if your package and the Ubuntu version are compatible or not.

    • Firstly, run this command “lsb_release -a” on your Ubuntu device to know your device version.
    • Your OS version and codename will be displayed on the screen. Note down the codename.
    • Now, it’s time to know the package codename that you want to install.
    • Go to https://packages.ubuntu.com/ website.
    • Scroll down and find the Search section.
    • In the “Keyword” column, enter your package’s name.
    • In the “Distribution” option set it as your Ubuntu’s codename.
    • Keep the section as “any” and press Enter.

You will get the results if your device OS and the package version are suitable or not. If they aren’t compatible, then you might switch to a package that suits your Ubuntu version. But, if they are clearly compatible and shows a match, then try to update once with this command:

sudo apt update

Now try to install again. If you still get the error message, then try the next method.

Check If You Are Using Active Ubuntu Release

It is important to check whether the Ubuntu you are using is active or dead. You might have already known that there are two kinds of major Ubuntu releases.

The Normal release gives service for nine months whereas the Long term support release gives service for five years. Maybe your Ubuntu got outdated which is the reason why it is showing errors when you want to install a package.

Here is how to check your Ubuntu release is supported or not. Just run this command:

hwe-support-status  –verbose

You will get the details about your Ubuntu is supported or not. If your version is expired, then switch to an active version to get rid of this issue.

But, what if your Ubuntu version is supported, but still showing “Unable to locate package” errors.

If Nothing Works

Well, most probably the above methods will help you to get rid of the unable to locate package error. But, unfortunately, if none of the above solutions fixed your issue, then you can take help from the Linux software customer helpline. Write an e-mail or contact them on the phone. They will tell you a helpful fix for solving this problem.

Conclusion

We hope this article helped you to get rid of the annoying error code: Unable To Locate Package error on your Linux device. This error can trigger due to incorrect package names, compatibility issues, or even the outdated OS version. Hence, try the above methods that we have made as easy as possible for you to understand. For more related articles, visit our website Techly Fire.

Leave a Comment