0

I am trying to use "sudo apt-get install build-essential" but it gives an 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: build-essential : Depends: libc6-dev but it is not going to be installed or libc-dev Depends: gcc (>= 4:7.2) but it is not going to be installed Depends: g++ (>= 4:7.2) but it is not going to be installed Depends: dpkg-dev (>= 1.17.11) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

So I tried to install the dependent packages (libc6-dev) etc but it ends up with

The following packages have unmet dependencies: libc6-dev : Depends: libc6 (= 2.27-3ubuntu1) but 2.27-3ubuntu1.2 is to be installed E: Unable to correct problems, you have held broken packages.

So I try to install libc6

Reading package lists... Done Building dependency tree
Reading state information... Done libc6 is already the newest version (2.27-3ubuntu1.2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

When I use aptitude instead

The following NEW packages will be installed: build-essential dpkg-dev{ab} fakeroot{a} g++{a} g++-7{ab} gcc{a} gcc-7{ab} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} libalgorithm-merge-perl{a} libasan4{ab} libatomic1{ab} libc-dev-bin{a} libc6-dev{ab} libcilkrts5{ab} libfakeroot{a} libgcc-7-dev{ab} libitm1{ab} liblsan0{ab} libmpx2{ab} libquadmath0{ab} libstdc++-7-dev{ab} libtsan0{ab} libubsan0{ab} linux-libc-dev{a} manpages-dev{a} 0 packages upgraded, 26 newly installed, 0 to remove and 0 not upgraded. Need to get 26.6 MB of archives. After unpacking 116 MB will be used. The following packages have unmet dependencies: libgcc-7-dev : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed libmpx2 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed libc6-dev : Depends: libc6 (= 2.27-3ubuntu1) but 2.27-3ubuntu1.2 is installed libitm1 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed libcilkrts5 : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed libasan4 : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed libquadmath0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed libstdc++-7-dev : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed libtsan0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed libubsan0 : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed g++-7 : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed gcc-7 : Depends: cpp-7 (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is installed liblsan0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed libatomic1 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed dpkg-dev : Depends: libdpkg-perl (= 1.19.0.5ubuntu2) but 1.19.0.5ubuntu2.3 is installed The following actions will resolve these dependencies: Keep the following packages at their current version:

  1.  build-essential [Not Installed]                    
    
  2.  dpkg-dev [Not Installed]                           
    
  3.  g++ [Not Installed]                                
    
  4.  g++-7 [Not Installed]                              
    
  5.  gcc [Not Installed]                                
    
  6.  gcc-7 [Not Installed]                              
    
  7.  libasan4 [Not Installed]                           
    
  8.  libatomic1 [Not Installed]                         
    
  9.  libc6-dev [Not Installed]                          
    
  10. libcilkrts5 [Not Installed]                        
    
  11. libgcc-7-dev [Not Installed]                       
    
  12. libitm1 [Not Installed]                            
    
  13. liblsan0 [Not Installed]                           
    
  14. libmpx2 [Not Installed]                            
    
  15. libquadmath0 [Not Installed]                       
    
  16. libstdc++-7-dev [Not Installed]                    
    
  17. libtsan0 [Not Installed]                           
    
  18. libubsan0 [Not Installed]
    

Accepting the solution gives:

No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used.

Any help will be greatly appreciated

2
  • 2
    Look backward: What was the last deb-based software, from any source, that you tried to install? Regardless of success or failure, that is the most likely cause. If you do not remember, refresh your memory using /var/log/apt/history.log and /var/log/apt/term.log – user535733 Jan 15 at 5:44
  • 1
    Could you open Software Sources and see if under the Updates tab that both the updates and security sources are enabled. If not, enable them, reload your sources (or sudo apt update) & see if better.. – doug Jan 15 at 11:33
0

Let's see if we can find the the broken packages.

In a terminal, type:

$ sudo apt-mark showhold

If it returns something, then we can do this:

$ sudo apt-mark unhold {package_name}

From there, you should be able to retry the installation:

$ sudo apt autoremove
$ sudo apt clean
$ sudo apt update
$ sudo apt install build-essential

If this doesn't work, aptitude might resolve the issue.

1
  • showhold returns nothing retrying installation returns same error you can see from my original post that aptitude is unable to resolve my error either. thanks for the attempt – Xuhua Leong Jan 15 at 7:43

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.