How do I fix an error with libc6-dev-armhf-cross in Ubuntu 18.04 when trying to apt upgrade?
Today while attempting to upgrade based on Ubuntu Software suggestion, I see the following errors. This is the first time I see this error. My 18.04 system has been working just fine for many months now.
Any help is appreciated.
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libc6-armel-cross libc6-armhf-cross libc6-dev-armel-cross libc6-dev-armhf-cross
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/5,871 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 388166 files and directories currently installed.)
Preparing to unpack .../libc6-dev-armel-cross_2.27-3ubuntu1cross1.1_all.deb ...
Unpacking libc6-dev-armel-cross (2.27-3ubuntu1cross1.1) over (2.27-3ubuntu1cross1) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-dev-armel-cross_2.27-3ubuntu1cross1.1_all.deb (--unpack):
unable to open '/usr/arm-linux-gnueabi/lib/Mcrt1.o.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
Preparing to unpack .../libc6-armel-cross_2.27-3ubuntu1cross1.1_all.deb ...
Unpacking libc6-armel-cross (2.27-3ubuntu1cross1.1) over (2.27-3ubuntu1cross1) ...
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
Preparing to unpack .../libc6-dev-armhf-cross_2.27-3ubuntu1cross1.1_all.deb ...
Unpacking libc6-dev-armhf-cross (2.27-3ubuntu1cross1.1) over (2.27-3ubuntu1cross1) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-dev-armhf-cross_2.27-3ubuntu1cross1.1_all.deb (--unpack):
unable to open '/usr/arm-linux-gnueabihf/lib/Mcrt1.o.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
Preparing to unpack .../libc6-armhf-cross_2.27-3ubuntu1cross1.1_all.deb ...
Unpacking libc6-armhf-cross (2.27-3ubuntu1cross1.1) over (2.27-3ubuntu1cross1) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-armhf-cross_2.27-3ubuntu1cross1.1_all.deb (--unpack):
unable to open '/usr/arm-linux-gnueabihf/lib/ld-2.27.so.dpkg-new': No such file or directory
No apport report written because MaxReports is reached already
Errors were encountered while processing:
/var/cache/apt/archives/libc6-dev-armel-cross_2.27-3ubuntu1cross1.1_all.deb
/var/cache/apt/archives/libc6-armel-cross_2.27-3ubuntu1cross1.1_all.deb
/var/cache/apt/archives/libc6-dev-armhf-cross_2.27-3ubuntu1cross1.1_all.deb
/var/cache/apt/archives/libc6-armhf-cross_2.27-3ubuntu1cross1.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
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.