E: Unable to locate package

Fix E: Unable to Locate Package on Debian, Ubuntu, and Kali

This error means apt can't find the package in any of its configured repos. Usually it's a missing repo entry, stale package lists, or a typo in the name.

Quick answer: run sudo apt update, check your sources with cat /etc/apt/sources.list, enable the right component (universe/contrib/multiverse), then verify the package name with apt-cache search.

What's actually happening here is that apt never queried the internet for your package. It looked at its local cache of package indexes in /var/lib/apt/lists/, found nothing matching the name you typed, and gave up. The message is literal — apt has no idea what you're talking about because nothing in its current view of the world mentions that package. Common real-world triggers: a fresh Docker ubuntu:22.04 image before you run apt update, a Kali container missing the kali-rolling repo, or someone typing pip3 install python3-pip on a Debian box.

Nine times out of ten it's one of four things: stale indexes, a disabled repo component, a wrong package name, or a package that only exists in a repo you haven't added yet. Work through these in order.

Fix steps

  1. Refresh the package indexes. This is the single most common cause, especially on fresh VMs, Docker images, and WSL installs.

    sudo apt update

    If you see errors here about failed connections or GPG signatures, stop and fix those first — the rest of this article assumes apt update completes cleanly.

  2. Confirm the exact package name. Debian and Ubuntu names are not the same as the binary or the upstream project. apt-cache search queries the local index by regex:

    apt-cache search openssh
    apt-cache search --names-only '^python3-pip$'
    apt search ripgrep

    If nothing shows up, the package genuinely isn't in your configured repos. Don't guess at variants like openssh-server-dev — search.

  3. Check which repositories you actually have. On Ubuntu 22.04+ the sources are split between /etc/apt/sources.list and the .sources files in /etc/apt/sources.list.d/. On Debian 12, the modern format is deb822 under /etc/apt/sources.list.d/debian.sources.

    cat /etc/apt/sources.list
    ls /etc/apt/sources.list.d/
    grep -rE '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/

    On Kali, you should see exactly one repo line pointing at http://http.kali.org/kali with the main contrib non-free non-free-firmware components. If a Kali install shows Debian's repos, someone installed the wrong base image and you'll chase phantoms for hours.

  4. Enable the missing component. On Ubuntu, packages like build-essential live in main, but zsh extras, ffmpeg, and lots of fonts live in universe. A minimal cloud image usually has only main enabled. Edit the sources and add it:

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

    On Debian, contrib and non-free aren't enabled by default — add them to the Components: line in debian.sources if you need firmware or codecs.

  5. Add a third-party repo if the package came from upstream. Docker, Node.js, PostgreSQL, and Google Chrome all maintain their own apt repos. Installing docker-ce from Ubuntu's universe will fail because Canonical doesn't ship it. Follow the vendor's keyring + sources setup, then re-run apt update.

  6. Verify the architecture matches. If you're on arm64 (Raspberry Pi, Apple Silicon VM, Graviton instance), some packages are amd64-only and won't appear in the index at all.

    dpkg --print-architecture
    uname -m

    An amd64 package on an arm64 host produces exactly this error with no mention of architecture, which is genuinely misleading.

If the package still won't show up

  • Clear a corrupted index. If apt update half-succeeded after a network drop, the lists can be inconsistent:
sudo rm -rf /var/lib/apt/lists/*
sudo apt clean
sudo apt update
  • Check for held or pinned packages that might be masking the name in search output:
apt-mark showhold
cat /etc/apt/preferences.d/* 2>/dev/null
  • On WSL, the default Ubuntu image ships without universe and with a stale mirror. Run sudo apt update first, then re-check. If DNS is broken in WSL, apt silently can't reach archive.ubuntu.com — cat /etc/resolv.conf should show a nameserver, not an empty file.
  • Grab the .deb directly. As a last resort, download from packages.debian.org or packages.ubuntu.com and install with sudo apt install ./file.deb. The ./ prefix matters — without it apt treats the argument as a package name and you're back to the same error.

Prevention

Run sudo apt update before every install session, not after. Keep your container base images pinned to a tag you've actually tested, and when you write a Dockerfile, put apt-get update && apt-get install -y pkg on the same RUN line — splitting them bakes a stale index into the layer cache and produces this exact error months later when someone builds without --no-cache. On your workstation, periodically run apt list --upgradable so you notice repo problems while they're still small.

Related Errors in Linux & Unix
wine64: cannot find '/path/to/executable': No such file or directory (or similar Fix Wine Cannot Find wine64 Loader Error on Ubuntu 22.04 sudo: command not found Fix 'sudo: command not found' on Linux (quick & dirty) Battery Icon Gone in Linux System Tray? Fix It Fast Permission denied Fix 'Permission denied' on Linux when you know you have access

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.