2

I've been trying to install some programs in Debian and it's my first time using Linux so I'm having some trouble. When I try installing build-essential with:

sudo apt-get install build-essential

or other similar command it says that there's no "installation candidate"

I've searched for the answer in other questions like this one, but I can't find a solution.

4

The following error E: Package 'build-essential' has no installation candidate mean that you don't have the main repo on your sources.list

The build-essential package is available on the main repository.

Firdt, you should edit your sources.list :

sudo apt edit-sources

add the following lines ( sample sources.list with main and contrib component):

deb http://httpredir.debian.org/debian jessie main contrib
deb-src http://httpredir.debian.org/debian jessie main contrib

deb http://httpredir.debian.org/debian jessie-updates main contrib
deb-src http://httpredir.debian.org/debian jessie-updates main contrib

deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib 

Save and run the following commands to install the build-essential package:

sudo apt update
sudo apt upgrade
sudo apt install build-essential
0

In order for Apt to know about available packages, it needs a valid configuration in /etc/apt/sources.list (usually this is initialized correctly when you install your distro) and it needs to successfully download the Packages files from the configured network locations. Common error scenarios include

  • Obsolete configuration. If you are attempting to use a distro which is no longer supported, the once-correct URLs in /etc/apt/sources.list no longer work. The symptom is "File not found" errors or "No route to host" if the entire server has gone away.
  • Firewall issues which prevent Apt from downloading the Packages files, with similar symptoms. If you are able to connect to the Apt-configured locations from elsewhere, perhaps you need to use a proxy?
  • Transient server errors which usually go away by themselves after a few minutes or hours.
  • Failure to run apt-get update. If the local copies of the Packages files are too old, they will point to package versions which no longer exist in the archive on the server.

Less common but thinkable problem causes would be zapping the configuration files by mistake (restore from backup? Include enough information in your question so we can tell you the common defaults for your distro?), physical connectivity problems (the interface is up and you are able to connect to e.g. Google with curl or similar?) and local disk problems (corrupted Packages files? Disk mounted read-only?). If you installed from a DVD, it's also possible that only the DVD is configured in Apt as a package source.

For troubleshooting in more detail, any error message or other symptom would be useful for identifying the error, but understanding the system at this level is often sufficient for diagnosing it yourself.

A minor annoyance is that the configuration URLs are not plainly visible from the regular Apt output; the cofiguration looks like

deb http://example.net/path distribution section another

and Apt itself fills in some parts to construct a full URL path to one or more Packages files on the server. With the --print-uris option, you can see what exactly it's trying to fetch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.