How to Fix ‘E: Unable to locate package’ in Ubuntu

Attempting to install a software tool, library, or development utility on Ubuntu using sudo apt install [package_name] frequently terminates with the terminal rejection: E: Unable to locate package [package_name]. Whether you are attempting to install system tools like build-essential, media codecs, or third-party server applications, the Advanced Package Tool (APT) aborts the installation immediately. This error is standard on newly deployed Ubuntu systems, minimal server installations, and cloud VPS containers, where software repositories are restricted or local package indexes have not been synchronised.

Resolving ‘Unable to locate package’ requires synchronising local repository caches, enabling Universe and Multiverse software repositories, verifying package naming standards, and configuring third-party PPAs.

Why Does APT Fail to Locate Packages?

APT queries a local database index stored under /var/lib/apt/lists/ to discover packages available across Ubuntu mirrors. The command fails due to several specific configuration bottlenecks:

  • Uninitialised APT Package Index: On fresh installations of Ubuntu, the local package cache is empty. APT does not query the internet in real time; it only searches its local index until sudo apt update is executed.
  • Missing Universe or Multiverse Repositories: Canonical divides Ubuntu software into four main components: Main (free and supported), Restricted (proprietary drivers), Universe (community maintained), and Multiverse (restricted copyright). Many popular packages reside in Universe, which is disabled on minimal server builds.
  • Typographical or Package Naming Discrepancies: Package names on Debian and Ubuntu often differ from general software names (e.g., python3-pip instead of pip, or apache2 instead of httpd).
  • Unsupported Ubuntu Architecture or Release: The requested package is compiled only for 64-bit AMD64 architectures while running an ARM64 server, or the package was deprecated in modern Ubuntu releases (such as Ubuntu 24.04 LTS).

Method 1: Update the Local APT Package Lists (Primary Fix)

Running an update synchronises your computer’s package lists with Canonical’s servers:

  1. Open your terminal.
  2. Execute the package update command:
    sudo apt update
  3. Wait for APT to read all package lists and fetch index files from archive.ubuntu.com.
  4. Attempt to install your desired package again:
    sudo apt install [package_name]

Method 2: Enable the Universe, Restricted, and Multiverse Repositories

If your package belongs to community-maintained open-source repositories:

  1. Enable the Universe repository:
    sudo add-apt-repository universe
  2. Enable the Multiverse repository:
    sudo add-apt-repository multiverse
  3. Enable the Restricted repository:
    sudo add-apt-repository restricted
  4. Update your package lists to pull in indexes from the newly enabled sources:
    sudo apt update
  5. Run your apt install command again.

Method 3: Search for the Correct Package Name Using apt-cache

If you are uncertain of the exact syntax or version suffix of a package:

  1. Search the local APT cache using keywords:
    apt-cache search [keyword]

    (For example: apt-cache search python | grep pip)

  2. Review the output list to locate the exact Debian package identifier.
  3. Install using the confirmed package name.

Method 4: Handling Deprecated or Third-Party Software

If the package is not part of official Ubuntu distribution mirrors:

  • Install via Snap: Many modern software tools (such as Node.js, Spotify, or Nextcloud) are distributed via Canonical Snap store. Check availability by running snap find [package_name] and install using sudo snap install [package_name].
  • Add Official Vendor PPA or Repository: For tools like Google Chrome, Docker, or VirtualBox, follow the vendor documentation to import their GPG keyring into /etc/apt/keyrings/ and add their dedicated repository definition file to /etc/apt/sources.list.d/.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.