How do I fix an error with libc6-dev-armhf-cross in Ubuntu 18.04 when trying to apt upgrade?

I was able to cleanly solve this problem with a variation of the approach used by Gen.Stack. The problem with the accepted solution is that it removes dependencies of the packages in question but fails to restore them. This solution prevents that problem.

First, remove the problem packages and purge their configuration without removing dependencies:

sudo dpkg -P --force-depends libc6-armel-cross libc6-armhf-cross libc6-dev-armel-cross libc6-dev-armhf-cross

Clean the package cache:

sudo apt clean

Update the package listing:

sudo apt update

Fix broken dependencies (should automatically install two of the removed packages):

sudo apt -f install

Finally, install the remaining two packages:

sudo apt install libc6-dev-armel-cross libc6-dev-armhf-cross

This will bring your system back into working order.


Try reinstalling libc6-dev-armhf-cross (do the same for libc6-dev-armel-cross)

sudo apt remove libc6-dev-armhf-cross followed by sudo apt install libc6-dev-armhf-cross

(apt install --reinstall doesn't seem to work)

Note that running sudo apt remove may remove packages dependent on it. See Olek Wojnar's answer below on how to do this without removing dependent packages


To prevent too many dependencies from being removed, try dpkg -P --force-depends:

dpkg -P --force-depends libc6-armel-cross libc6-armhf-cross libc6-dev-armel-cross libc6-dev-armhf-cross

Then update, fetch and install those packages again:

apt update
[...]
apt clean
apt install libc6-armel-cross libc6-armhf-cross libc6-dev-armel-cross libc6-dev-armhf-cross
Building dependency tree       
Reading state information... Done
After this operation, 0 B of additional disk space will be used.
Get:1 http://en.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libc6-armel-cross all 2.27-3ubuntu1cross1.1 [1,031 kB]
Get:2 http://en.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6-armhf-cross all 2.27-3ubuntu1cross1.1 [1,005 kB]
Get:3 http://en.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libc6-dev-armel-cross all 2.27-3ubuntu1cross1.1 [1,936 kB]
Get:4 http://en.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6-dev-armhf-cross all 2.27-3ubuntu1cross1.1 [1,899 kB]
Fetched 5,871 kB in 9s (661 kB/s)                                                                                                                                                           
Selecting previously unselected package libc6-armel-cross.
(Reading database ... 760110 files and directories currently installed.)
Preparing to unpack .../libc6-armel-cross_2.27-3ubuntu1cross1.1_all.deb ...
Unpacking libc6-armel-cross (2.27-3ubuntu1cross1.1) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-armel-cross_2.27-3ubuntu1cross1.1_all.deb (--unpack):
 unable to open '/usr/arm-linux-gnueabi/lib/ld-2.27.so.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
[...]

So, no luck with reinstalling neither by --reinstall nor manually with dependencies nor by using dpkg -[P|i] --force-depends.

2018-10-09: As those packages are still broken but w/ no updates in sight I just removed them all to be able to use apt for (un-)installing packages. Leaving the status quo meant not being able to install or remove packages. I am using locally installed toolchains to fullfil my requirements.

edit: note about removing all offending packages and dependencies.

Tags:

Upgrade

Apt

18.04