Open In App

How to fix unable to locate package in Ubuntu?

Last Updated : 10 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Encountering the “E: Unable to locate package” error in Ubuntu can be frustrating, but it’s often caused by a few common reasons and can be resolved with straightforward steps. Here are possible ways to identify the cause and resolve this error.

unable-to-find-package

How to Fix E: Unable to Locate Package Error On Ubuntu?

To fix unable to locate package in Ubuntu, we have presented five possible resons and how to fix this error.

Fix 1: Double-Check the Package Name

Ubuntu packages are case sensitive. Typos and incorrect casing are common issues by which one can face this error. Ensure the package name is spelled precisely and matches the official name found in repositories.

Tip: You can use apt search command to search for correct package name in terminal.

Syntax: sudo apt search {package_name}

Example:

command: sudo apt search cmatri
searching_package

searching package using apt search command

In this example, we found that our package name was not complete, and that’s why we were getting that error.

Fix 2: Update Package List and Repository Cache

Outdated package list can lead to errors, this may be caused by not updating repository cache and package list after adding new repository to sources. To update package list and repository cache, use apt update command.

command: sudo apt update -y
updating_package_list_and_repository

Updating repository cache and package list

This will refresh the list of available packages and their locations.

Fix 3: Verify Package Availability For Your Ubuntu Version

Not all packages are compatible with every Ubuntu version. Check the official package repositories or the software’s website to confirm compatibility with your specific version (e.g., Ubuntu 20.04 LTS).

availability_check

Checking package availability for installed Ubuntu version

Also Check: How to Check Your Ubuntu Version: A Guide

Fix 4: Ensure Your Ubuntu Version is Active

Unsupported versions no longer receive updates or have access to new packages. Check your system’s status using the following command:

command: lsb_release -a

Note: Ubuntu version below 14.04 LTS are not active anymore as of 2024

checking_ubuntu_version

Checking Ubuntu version

Fix 5: Consider Adding Trusted Third-Party Repositories (PPAs)

PPA stands for Personal Package Archive. It’s a type of software repository that allows users to install software that isn’t available in the official Ubuntu repositories. If the package is not available in the default repositories, you might need to add a trusted third-party repository (PPA) that provides it.

3rd_party_ppa

3rd party ppa for google chrome

Conclusion

Encountering the “E: Unable to locate package” error while installing software on Ubuntu can be frustrating, but by following the steps above, you should be well-equipped to troubleshoot and resolve the issue. Always prioritize using trusted sources and official repositories for your software needs.

Also Read

Frequently Asked Questions

What is “E: unable to locate package error” in Ubuntu?

This error usually occurs when the package name is misspelled, the package list is outdated, or the necessary repositories are not enabled. It can also happen if the package is not available for your specific Ubuntu version.

How do I fix the error “Unable to Locate a Package”?

This error can be fixed using following methods:

  • Double-check the package name: Ensure it’s spelled correctly and matches the exact case.
  • Update your package list: Run sudo apt update in your terminal.
  • Check package availability: Search for the package on official site and check whether package is available for your Ubuntu version or not.
  • Consider trusted PPAs: If unavailable in official repositories, add a trusted third-party PPA (use with caution!).

How to check the Ubuntu package version?

We can check package version using following command:

Syntax: dpkg -l <package_name>

What are PPAs?

PPAs (Personal Package Archives) are repositories containing software not available in the official Ubuntu repositories. They often offer newer versions, pre-release software, or software not deemed suitable for the main repositories.

Are PPAs safe to use?

While PPAs expand software options, use them cautiously. They are not officially endorsed by Ubuntu and might have security or stability risks. Only add PPAs from trusted sources like well-established developers or projects. Check how to Use PPA in Linux – GeeksforGeeks



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads