On Ubuntu 20.04, and trying to install ROS2 Galactic, requires the following package: sudo apt install -y libpython3-dev However, this returns the following:

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 resolve the situation: The following packages have unmet dependencies: libpython3-dev : Depends: libpython3.8-dev (>= 3.8.2-1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages

I tried installing libpython3.8-dev , which returns an unmet dependency of

The following packages have unmet dependencies: libpython3.8-dev : Depends: libexpat1-dev but it is not going to be installed Recommends: libc6-dev but it is not going to be installed or libc-dev

This chain continues for a while.

Eventually leads to:

libc6-dev : Depends: libc6 (= 2.31-0ubuntu9) but 2.31-0ubuntu9.2 is to be installed Then libc6 is already the newest version (2.31-0ubuntu9.2).

I have tried:

  • sudo apt autoremove
  • Main, universe and multiverse are all selected as PPAs
  • sudo dpkg --configure -a
  • sudo apt-get -f install
  • sudo apt-get autoclean
  • sudo apt-get -u dist-upgrade

Seems to me like apt is broken, its a relatively new install of Ubuntu 20.04, so not sure why. I've had similar broken apt problems, and I ended up just reinstalling Ubuntu to save time. But I want to figure out the problem this time. Any help is appreciated.

-- Output of sudo apt update

Hit:1 https://brave-browser-apt-release.s3.brave.com stable InRelease Hit:2 http://ca.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:4 http://archive.canonical.com/ubuntu focal InRelease
Hit:5 http://packages.ros.org/ros2/ubuntu focal InRelease Reading package lists... Done Building dependency tree
Reading state information... Done All packages are up to date.

  • 1
    Keep following that chain. At the end of the chain is the list of packages that are actually in conflict. Show us that complete output in your question above. Also add to your question above the complete output of sudo apt update
    – user535733
    Oct 30, 2021 at 21:16
  • @user535733 Thanks, edited.
    – huss987
    Oct 30, 2021 at 21:24

1 Answer 1


After some more looking around, I was able to pinpoint the problem, thanks to this question.

It seems libc6-dev needs an outdated version of libc6. So I ran:

sudo apt install libc6=2.31-0ubuntu9 libc-bin=2.31-0ubuntu9

To downgrade libc6, and it fixed the problem. Not sure if this is a long term solution, but it seems to work now.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .