4

I just ran a fresh installation of Ubuntu Mate 15.10 on my laptop and currently I need to install "build-essential". I ran:

sudo apt-get install build-essential

and got this error:

daniel@daniel-VGN-NR230FE:~$ sudo apt-get install build-essential 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
build-essential : Depends: libc6-dev but it is not going to be installed or
                        libc-dev
               Depends: g++ (>= 4:5.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I don't know if it has anything to do with this, but during the installation, I skipped some packages, since installing then would take forever (300 min or so).

Before doing the build-essential thing, I installed all the updates available via Software Updater and the incomplete language packs, but then again, got this error.

techraf
  • 3,316

4 Answers4

4

I would start by verifying if you distro's main sources are enabled, If it's 15.10 your code name should be wily.

  1. Open your sources file:

    $sudo gedit /etc/apt/sources.list

  2. Look for the following lines and uncomment them, save the file:

    ###### Ubuntu Main Repos
    deb http://us.archive.ubuntu.com/ubuntu/ wily main
    deb-src http://us.archive.ubuntu.com/ubuntu/ wily main

    ###### Ubuntu Update Repos
    deb http://us.archive.ubuntu.com/ubuntu/ wily-security main
    deb http://us.archive.ubuntu.com/ubuntu/ wily-updates main
    deb-src http://us.archive.ubuntu.com/ubuntu/ wily-security main
    deb-src http://us.archive.ubuntu.com/ubuntu/ wily-updates main

  3. Update sources & retry installation:

    $sudo apt-get update
    sudo apt-get install build-essential

1

This could be docker specific for me. But you can try if it works for you normally. I got the same problem on a docker image of Ubuntu 16.04. I tried to install libc6-dev, it gives this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: libc6-dev : Depends: libc6 (= 2.23-0ubuntu10) but 2.23-0ubuntu11 is to be installed E: Unable to correct problems, you have held broken packages.

This is actually asking to downgrade libc6. After downgrading it by:

apt-get install libc6=2.23-0ubuntu10

I could finally install build-essential

1

I had a similar issue.I resolve it by doing this:

Before starting,if you don't have aptitude, you can install it by following these instructions:[aptitude documentation][1]

If you have it already,you can move on. First you need to run:

sudo aptitude install g++
Accept this solution? [Y/n/q/?]

You must select n.

It will suggest you to downgrade the package, and it will be ask this:

Accept this solution? [Y/n/q/?]

This time select Y.

It will downgrade the package. After it is done,you can now install build-essential by doing this:

sudo aptitude -f install build-essential
Accept this solution? [Y/n/q/?]

You must select Y.

It will install it. After it is done, you can run this command to check it:

sudo aptitude search build-essential

if you see this line in the result:

> i   build-essential                 - Informational list of build-essential pack

it means that the installation was successful, but if you don't see it then you have look for another solution in order to resolve it. [1]: https://doc.ubuntu-fr.org/aptitude

fany
  • 11
  • Hey, thanks! That worked for me. I looked at least a half dozen answer on SO; none of them worked, but this one did. – Najeeb Feb 07 '24 at 22:38
1

Encountered similar issue, resolved it by running

sudo apt-get update
sudo apt-get install -y gcc
msovani
  • 11
  • 1