Problem:
Some users may run into an Unable to locate package
response when using the apt
package manager on Ubuntu and Debian-based images on CircleCI to fetch a package.
Running sudo apt install somepackage=12.3.4 -y
results in the following message:
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package
Solutions:
- Update Before Install
- This can be a result of an out-of-date apt update cache.
- The most common solution for this is to update
apt
usingsudo apt update
prior to running thesudo apt install
command.
- Confirm the package name matches the package hosted on the
apt
package manager- There are times when a package name does not match the name of the app/dependency it belongs to - some examples:
- Docker's Package is called
docker.io
rather than just Docker - VSCode's package is called
code
rather than VSCode
- Docker's Package is called
- There are times when a package name does not match the name of the app/dependency it belongs to - some examples:
- Ensure that there are no typos within the package name or version
- If the package name is misspelled or using a version that does not exist on the
apt
package manager, theapt install
command will not be able to locate the package
- If the package name is misspelled or using a version that does not exist on the
- Ensure that the package is available and compatible with the version being used in your pipelines
- Not all packages might be available or compatible for all versions of Ubuntu
Outcome:
This issue can be considered resolved once the apt
packages required by your team's projects all install successfully using the apt install
command. If you are still encountering difficulties, please try all the solutions offered on this page.
Comments
Article is closed for comments.