1

I had build-essential installed when I was using 16.04, as well as multiple versions of gcc and g++ on my system and they were working fine.

After the system upgrade, they are apparently not even installed.

I tried a few solutions, most common was to use aptitude which recommends to revert back to the old version but I am not getting that option. As you can see it suggests to keep everything at their current versions, packages that are not even installed.

 sudo aptitude install gcc

[sudo] password for ubuntu: 

The following NEW packages will be installed:

  cpp{a} cpp-9{ab} gcc gcc-9{ab} libasan5{ab} libatomic1{ab} libgcc-9-dev{ab} libisl21{a} libubsan1{ab} 

0 packages upgraded, 9 newly installed, 0 to remove and 2 not upgraded.

    Need to get 22.2 MB of archives. After unpacking 76.8 MB will be used.

    The following packages have unmet dependencies:

     cpp-9 : Depends: gcc-9-base (= 9.2.1-9ubuntu2) but 9.3.0-10ubuntu2~16.04 is installed
     libasan5 : Depends: gcc-9-base (= 9.2.1-9ubuntu2) but 9.3.0-10ubuntu2~16.04 is installed
     libubsan1 : Depends: gcc-9-base (= 9.2.1-9ubuntu2) but 9.3.0-10ubuntu2~16.04 is installed
     gcc-9 : Depends: gcc-9-base (= 9.2.1-9ubuntu2) but 9.3.0-10ubuntu2~16.04 is installed
     libatomic1 : Depends: gcc-9-base (= 9.2.1-9ubuntu2) but 9.3.0-10ubuntu2~16.04 is installed
     libgcc-9-dev : Depends: gcc-9-base (= 9.2.1-9ubuntu2) but 9.3.0-10ubuntu2~16.04 is installed
    open: 33; closed: 170; defer: 16; conflict: 25                                                                                        .The following actions will resolve these dependencies:

         Keep the following packages at their current version:
    1)     cpp [Not Installed]                                
    2)     cpp-9 [Not Installed]                              
    3)     gcc [Not Installed]                                
    4)     gcc-9 [Not Installed]                              
    5)     libasan5 [Not Installed]                           
    6)     libatomic1 [Not Installed]                         
    7)     libgcc-9-dev [Not Installed]                       
    8)     libubsan1 [Not Installed]                          



    Accept this solution? [Y/n/q/?]
  • Please add the output of apt-cache policy cpp cpp-9 gcc gcc-9 to the question. – N0rbert Jun 8 at 12:21
  • @N0rbert Thanks for replying but I figured out the solution. I have posted it as an answer. If the output [of a now fixed system] can still help others out, let me know. Cheers! – Maxsash Jun 8 at 12:25
1

Found a solution that worked for me here. Just in case the link goes down, the solution:

The problem of broken package was in the dpkg status file.

$ sudo vim /var/lib/dpkg/status

Locate the corrupt package, and remove the whole block of information about it and save the file. In my case, I removed gcc-9 related two paragraphs of information. After that I ran

sudo aptitude install gcc

This gave me the option to downgrade packages now which resolved all further issues.

| improve this answer | |
  • 1
    Editing internal dpkg/APT database may lead to a mess in the future. Do not use such methods next time. They are dangerous. And mask real problem. – N0rbert Jun 8 at 12:28
  • @N0rbert I went ahead with it since every output pointed to the fact that those packages don't exist at all except here. Which lead me to believe there is probably some false metadata somewhere. – Maxsash Jun 8 at 14:38

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.