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

19,645

Solution 1

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

Solution 2

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.

Solution 3

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.

Solution 4

When using the apt remove/install method above, dependencies may cause apt to remove more than you intend. You may also need to reinstall other packages. I also reinstalled the following.

Some of these would already automatically be reinstalled, but it was easier to copy the list of removed packages and let apt figure out what needed to be done.

sudo apt-get install \
  g++-7-arm-linux-gnueabihf g++-7-multilib-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
  gcc-7-arm-linux-gnueabihf gcc-7-multilib-arm-linux-gnueabihf gcc-arm-linux-gnueabihf \
  libasan4-armhf-cross libasan4-dbg-armhf-cross libatomic1-armhf-cross libatomic1-dbg-armhf-cross \
  libc6-armel-armhf-cross libc6-armel-cross libc6-armhf-cross libc6-dev-armel-armhf-cross \
  libc6-dev-armel-cross libc6-dev-armhf-cross libcilkrts5-armhf-cross libcilkrts5-dbg-armhf-cross \
  libgcc-7-dev-armhf-cross libgcc1-armhf-cross libgcc1-dbg-armhf-cross libgomp1-armhf-cross \
  libgomp1-dbg-armhf-cross libsfasan4-armhf-cross libsfatomic1-armhf-cross \
  libsfcilkrts5-armhf-cross libsfgcc-7-dev-armhf-cross libsfgcc1-armhf-cross \
  libsfgomp1-armhf-cross libsfstdc++-7-dev-armhf-cross libsfstdc++6-armhf-cross \
  libsfubsan0-armhf-cross libstdc++-7-dev-armhf-cross libstdc++6-7-dbg-armhf-cross \
  libstdc++6-armhf-cross libubsan0-armhf-cross libubsan0-dbg-armhf-cross \
Share:
19,645

Related videos on Youtube

Urivan Flores
Author by

Urivan Flores

Updated on September 18, 2022

Comments

  • Urivan Flores
    Urivan Flores over 1 year

    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)
    
    • Kristopher Ives
      Kristopher Ives over 5 years
      Something appears wrong with some downloaded packages. Try running sudo apt clean and then run the upgrade again.
    • Urivan Flores
      Urivan Flores over 5 years
      I did tried clearing the package cache and re-download the packages, however the same problem showed up.
  • Urivan Flores
    Urivan Flores over 5 years
    Hi Woofas, I also tried --reinstall but didn't think there would be a difference with remove and install. I just tried and now it is installing properly. Thanks!
  • Urivan Flores
    Urivan Flores over 5 years
    Thanks Patrick, as Woofas mentioned, apt remove and install solved the problem.
  • A T
    A T over 5 years
    That almost worked for me, I had to remove all these—then reinstall—libc6-dev-armhf-cross libc6-armel-cross libc6-dev-armel-cross libc6-armhf-cross
  • John JJ
    John JJ over 5 years
    You may need to reinstall other packages that get removed due to dependencies, such as gcc, see my post below.
  • Gen.Stack
    Gen.Stack over 5 years
    @Olek: Thx for the edit. But no, it does not work for me. That is why I left the post as I did. Even now with your edit this does not provide me with a solution to this problem. Would you mind reverting your edit, please? Thx.
  • Olek Wojnar
    Olek Wojnar over 5 years
    Strange that it didn't work on your machine. I had the exact same problem and my solution fixed it. Based on how apt works, I'm frankly confused why it would not work for you. Perhaps there is another problem at play for you? In any case, I created my own answer. Good luck fixing your problems!
  • Olek Wojnar
    Olek Wojnar over 5 years
    I like that you've identified the problem of removed dependencies in your answer. Unfortunately, your solution would mark all those packages as manually installed and they would therefore not be removed automatically if unnecessary in the future.
  • Gen.Stack
    Gen.Stack over 5 years
    @OlekWojnar yes, it is strange. I ignore the underlying reasons as of now. Won't dig deeper as I got the other toolchain, no need for stock one. If one day I realize how to solve this, I'll update this. thx
  • Olek Wojnar
    Olek Wojnar over 5 years
    As John said, you need to account for the packages that are removed. Take a look at my answer for a fairly clean way of taking care of that.
  • ravi.zombie
    ravi.zombie over 5 years
    works fine. for an upgrade from ubuntu 14.04 to ubuntu 18.04
  • minish
    minish over 5 years
    Thanks, I also resolved for the same problem Ubuntu 14.04, 16.04 to 18.04.
  • evanrmurphy
    evanrmurphy about 5 years
    Amazing. My package manager was so broken after upgrading from Ubuntu 16.04 to 18.04. I tried everything the command line recommended and various other solutions online. This one appears to have worked perfectly. Thank you Olek Wojnar!!
  • Whome
    Whome over 4 years
    I love a good, well laid out solution that works! Thanks.