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
aptusingsudo apt updateprior to running thesudo apt installcommand.
-
Confirm the package name matches the package hosted on the
aptpackage 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.iorather than just Docker - VSCode's package is called
coderather 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
aptpackage manager, theapt installcommand 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.