Monday, July 24, 2017

Downgrade a package to fix package dependency issue

I've got the following error message when I tried to install g++ on ubuntu 17.10.

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

After checking that dependency using following command:
apt-cache policy libc6-dev

It looks like it depends on an earlier version.
  Installed: (none)
  Candidate: 2.24-9ubuntu2
  Version table:
     2.24-9ubuntu2 500
        500 artful/main amd64 Packages

So I went ahead to downgrade this package
sudo apt install libc6=2.24-9ubuntu2
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Suggested packages:
The following packages will be DOWNGRADED:

dpkg: warning: downgrading libc6:amd64 from 2.24-9ubuntu2.2 to 2.24-9ubuntu2

After this downgrading this package, I can install the g++ again!

No comments: