One of the most frequent hurdles encountered by both newcomers and experienced administrators in Ubuntu is attempting to install software via the terminal, only for the Advanced Package Tool (APT) to terminate abruptly with the notice: “E: Unable to locate package <package_name>”. Whether you are trying to install everyday utilities like curl, development libraries, or proprietary media codecs, this error halts software deployment immediately.
Contrary to what the message might suggest, this error does not usually mean the software is incompatible with Linux. Instead, it indicates that Ubuntu’s local package index does not recognise the package name in its active catalog. The underlying cause typically falls into one of four categories: an outdated local package list, disabled official software repositories (such as Universe or Multiverse), a slight misspelling or case-sensitivity discrepancy in the package name, or a required 32-bit architecture component missing from your system configuration. This step-by-step guide explains how to identify the cause and resolve the error efficiently.
Method 1: Update the Local APT Package Index Cache
When you execute sudo apt install, Ubuntu does not query remote server repositories in real time. Instead, it searches an offline database located in /var/lib/apt/lists/. On newly installed systems or systems that have not run maintenance recently, this index may be empty or outdated, rendering APT blind to available software.
- Open your terminal by pressing Ctrl + Alt + T.
- Refresh your system package index by executing:
sudo apt update - Enter your administrative password when prompted.
- Observe the terminal output to ensure the package lists are fetched successfully from official mirrors (e.g., Hit or Get lines without Failed or Err warnings).
- Once the update completes, retry installing your desired package:
sudo apt install package-name
Method 2: Enable Universe, Multiverse, and Restricted Repositories
Ubuntu organizes its official software ecosystem into four primary components: Main (officially supported, open-source), Restricted (supported, proprietary hardware drivers), Universe (community-maintained, open-source), and Multiverse (unsupported, proprietary or legally restricted software). Many popular tools reside in Universe or Multiverse. If these components are toggled off in your software sources, APT will report that the package cannot be located.
- To enable the Universe repository (housing thousands of open-source packages), enter:
sudo add-apt-repository universe - To enable the Multiverse repository (housing proprietary drivers and codecs), enter:
sudo add-apt-repository multiverse - To enable the Restricted repository, enter:
sudo add-apt-repository restricted - Modern versions of Ubuntu automatically refresh package indices after adding a repository. If running an older release, run
sudo apt updatemanually. - Attempt the package installation once more.
Method 3: Search the Official Package Cache for Exact Naming
Linux package names are strictly lowercase and frequently include prefixes, suffixes, or version numbers (e.g., python3-pip rather than pip, or libssl-dev rather than openssl-dev). If you guess an incorrect name, APT cannot guess your intent.
- Use the
apt-cache searchcommand to scan package descriptions for your target keyword:apt-cache search keyword - Filter dense output using the
grepcommand. For example, to find the exact package name for Node.js development tools:apt-cache search nodejs | grep dev - Alternatively, install and run
apt-fileto locate packages that contain a specific binary executable:sudo apt install apt-file && sudo apt-file update apt-file search bin/commandname - Install the package using the exact verified string discovered in the search output.
Method 4: Enable Multiarch Support for 32-bit Architecture Packages
Certain legacy applications, gaming tools (such as Steam and Wine), and embedded cross-compilers require 32-bit (i386) library packages. If your 64-bit (amd64) Ubuntu installation has not enabled multiarch support, APT will state that 32-bit library dependencies cannot be located.
- Check which architectures are currently registered on your machine:
dpkg --print-foreign-architectures - If the output does not list
i386, add multiarch architecture support by running:sudo dpkg --add-architecture i386 - Update your package index so APT downloads the newly available 32-bit package catalogues:
sudo apt update - Now proceed with installing the required package (e.g.,
sudo apt install wine32).
Method 5: Add a Personal Package Archive (PPA) or External Mirror
Software packages that are not hosted inside official Canonical archives—such as bleeding-edge application builds or specialized developer utilities—require adding an authorized Personal Package Archive (PPA) or an external vendor repository.
- Ensure the software properties common tools are installed:
sudo apt install software-properties-common - Add the vendor-recommended PPA (for example, the official Git PPA):
sudo add-apt-repository ppa:git-core/ppa - Confirm the prompt by pressing Enter.
- Run
sudo apt updateto integrate the newly added PPA archive metadata. - Install the updated package cleanly.
Ubuntu APT Package Troubleshooting Reference Table
Refer to the diagnostic summary table below to address common repository and package installation errors:
| Observed Error Scenario | Underlying Root Cause | Standard Resolution Command |
|---|---|---|
| “E: Unable to locate package” on new system | Unpopulated local cache database | sudo apt update |
| Package missing on vanilla server installation | Universe / Multiverse repositories disabled | sudo add-apt-repository universe && sudo apt update |
| Package name guessed from online documentation | Case mismatch or altered package name in Debian/Ubuntu | apt-cache search <query> |
| Package:i386 cannot be found on 64-bit OS | Foreign 32-bit architecture not enabled | sudo dpkg –add-architecture i386 && sudo apt update |
| “The repository no longer has a Release file” | Ubuntu release has reached End of Life (EOL) | Update /etc/apt/sources.list to use old-releases.ubuntu.com |
Handling End-of-Life (EOL) Ubuntu Releases
If you are administering an older Ubuntu release that has passed its official End of Life (EOL) date—such as Ubuntu 21.10 or 19.04—Canonical removes those package repositories from the main distribution servers. Running sudo apt update will return 404 Not Found errors, causing all package installations to fail with “Unable to locate package”.
To restore package installation capabilities on an unsupported release, edit your sources list by running sudo nano /etc/apt/sources.list and replace all instances of archive.ubuntu.com and security.ubuntu.com with old-releases.ubuntu.com. Save the file, execute sudo apt update, and software installations will resume functioning normally.