Home Ubuntu How to Fix “E: Unable to locate Package” Error on Ubuntu

How to Fix “E: Unable to locate Package” Error on Ubuntu

Brief: This article explains the possible causes and fixes to the Ubuntu Linux error “E: Unable to locate package name”

Understanding “E: Unable to locate Package” Error on Ubuntu

The Linux command line environment has many functionalities. One of its primary roles is the installation and management of Linux software packages. There are several approaches to installing packages on Ubuntu Linux.

One of them is via the apt package manager, which is used to install a Linux package and may or may not always yield results. Due to various to-be-explained reasons, package installation failure via apt may yield the error message E: Unable to locate the package.

The usage of apt for package installation is highlighted by the following syntax:

$ sudo apt install package_name 

Consider using apt to install a Linux package called a tree.

$ sudo apt install tree
APT Install Package in Ubuntu
APT Install Package in Ubuntu

The above screen capture confirms that the installation of this package was a success.

Consider the use of an apt package manager to install a package named vcl.

$ sudo apt install vcl
E: Unable to locate package error on Ubuntu
E: Unable to locate package error on Ubuntu

Possible solutions to the error message E: Unable to locate package can be broken down into the following sections:

1. Check the Ubuntu Linux Package Name

Make sure the name of the package to be installed does not have any typo(s) associated with it. For example, a Linux package like vlc or tree might be mistyped as vcl or trie during package installation attempts.

$ sudo apt install vcl
OR
$ sudo apt install trie
Unable to locate package errors
Unable to locate package errors

Also, it is worth mentioning that Linux commands are attributed as case-sensitive. For example, Vim and vim are totally different packages.

$ sudo apt install Vim
$ sudo apt install vim
Install Package with Case-Sensitivity
Install Package with Case-Sensitivity

Check on the case sensitivity of the targeted package name before issuing the apt installation command.

Alternatively, confirm the package name’s existence in the apt database using the following syntax.

$ apt search package_name

For example, we can search for the existence of a package like vlc with the following command:

$ apt search vlc
Search for Package in Ubuntu
Search for Package in Ubuntu

If the package name does not exist in the apt database, we will get an output similar to the following.

$ apt search notepad
Unsuccessful Package Search in Ubuntu
Unsuccessful Package Search in Ubuntu

The output of the above search result does not provide a match for the notepad package we are trying to install.

2. Have an Up-to-Date Ubuntu Repository Cache

This step is recommended for new users with freshly installed Ubuntu Linux. It however applies to all Ubuntu users. These users need to run the update and upgrade commands:

$ sudo apt update && sudo apt upgrade -y
Update Ubuntu Repository Cache
Update Ubuntu Repository Cache

The execution of the above-stated command builds a local cache that accommodates Ubuntu packages (existing and new) viable for installation. Therefore, if the repository cache was out-of-date, new packages and their version information are downloaded by apt and included in the repository cache. In other words, apt installable packages should reside within the repository cache.

After updating the repository cache, try re-installing the targeted package.

3. Check Package Compatibility with Ubuntu

If you are certain of the Linux package’s existence, yet still unable to install it, consider this step. The first assumption here is that the Linux package is accessible in a universe repository not enabled on your Ubuntu system.

A universe repository holds packages not officially supported by the default repository cache. Such packages do not receive security updates and enabling the universe repo grants apt access to these packages.

The second assumption is that the Ubuntu version you are using does not avail of the package. To fix this issue, first, check the Ubuntu version you are using:

$ lsb_release -a 
Check Ubuntu Version
Check Ubuntu Version

Take note of the Release and/or Codename entries. In the above case, it’s 22.04 and jammy respectively.

Visit the Ubuntu packages website: https://packages.ubuntu.com/

Scroll to the following screen section of the website and fill in the appropriate package-related details.

Search Ubuntu Package Directories
Search Ubuntu Package Directories

The above search confirms that the vlc package is available in Ubuntu jammy 22.04 under the Universe repository.

Ubuntu Package Results
Ubuntu Package Results

It can therefore be installed from the Linux command line environment. To enable this universe repository on your Ubuntu system, run:

$ sudo add-apt-repository universe multiverse 

This command adds the universe and multiverse repositories to our Ubuntu system.

Enable Universe Repository in Ubuntu
Enable Universe Repository in Ubuntu

The repository cache needs to be aware of this newly added repository.

$ sudo apt update 

Now try to install the vlc package again to fix the installation error.

$ sudo apt install vlc

4. Check Your Ubuntu System Release Status

Ubuntu releases are either regular (9 months of support) or LTS (Long Term Support) with a span of 5 years. Unable to locate package error on Ubuntu sometimes arises when the system is at its end-of-life. This instance makes it impossible to install new packages.

To check the end-of-life date for your Ubuntu system, run:

$ hwe-support-status --verbose 
Check End of Life Ubuntu
Check End of Life Ubuntu

If the system is at its end of life, you might need to consider upgrading to the latest Ubuntu release via the following command sequence:

$ sudo apt autoremove
$ sudo apt update && sudo apt upgrade -y
$ sudo apt dist-upgrade

Alternatively, you could use the following command sequence:

$ sudo apt install update-manager-core
$ sudo do-release-upgrade 

From here, you should be able to comfortably test the installation of the targeted Ubuntu package.

$ sudo apt install package_name

To avoid compromising your system, always stick to Ubuntu-provided packages and not random Personal Package Archive (PPA). Also, not all packages are available for installation via an apt package manager.

In such cases, visit the packages’ official web pages for their associated installation instructions. With that said, I hope this article guide solves your “unable to locate package” error on Ubuntu.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.