尝试进行apt升级时,如何解决Ubuntu 18.04中libc6-dev-armhf-cross的错误?


22

今天,在尝试根据Ubuntu软件建议进行升级时,我看到以下错误。这是我第一次看到此错误。我的18.04系统已经运行了好几个月了。

任何帮助表示赞赏。

$ 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)

某些下载的软件包似乎出了问题。尝试运行sudo apt clean,然后再次运行升级。
克里斯托弗·艾夫斯

1
我确实尝试清除程序包缓存并重新下载程序包,但是还是出现了同样的问题。
Urivan Flores '18 October 1'2

Answers:


16

尝试重新安装libc6-dev-armhf-cross(对进行相同操作libc6-dev-armel-cross

sudo apt remove libc6-dev-armhf-cross 其次是 sudo apt install libc6-dev-armhf-cross

apt install --reinstall似乎不起作用)

请注意,运行sudo apt remove可能会删除依赖于它的软件包。请参阅下面的Olek Wojnar答案,以了解如何在不删除依赖包的情况下执行此操作


嗨,Woofas,我也尝试过--reinstall,但不认为remove和install有什么区别。我刚刚尝试过,现在可以正确安装了。谢谢!
Urivan Flores '18

1
这几乎是为我工作,我不得不删除所有这些,然后reinstall-libc6-dev-armhf-cross libc6-armel-cross libc6-dev-armel-cross libc6-armhf-cross
AT

1
您可能需要重新安装由于依赖关系而被删除的其他软件包,例如gcc,请参阅下面的文章。
John JJ '18年

如John所说,您需要考虑已删除的软件包。看看我的回答,以一种非常干净的方式来解决这个问题。
Olek Wojnar '18

37

我能够通过Gen.Stack使用的方法的变体彻底解决此问题。接受的解决方案的问题在于,它删除了相关软件包的依赖关系,但无法还原它们。该解决方案避免了该问题。

首先,删除有问题的软件包并清除其配置,而不删除依赖项:

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

清理程序包缓存:

sudo apt clean

更新包装清单:

sudo apt update

修复损坏的依赖项(应自动安装两个已删除的软件包):

sudo apt -f install

最后,安装其余两个软件包:

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

这将使系统恢复工作状态。


3
工作正常。从ubuntu 14.04到ubuntu 18.04的升级
ravi.zombie

3
谢谢,我也解决了相同的问题Ubuntu 14.04、16.04至18.04。
减少

2
惊人。从Ubuntu 16.04升级到18.04后,我的软件包管理器是如此损坏。我尝试了命令行推荐的所有方法以及各种其他解决方案。这个似乎运作良好。谢谢Olek Wojnar!
evanrmurphy,

1
我喜欢一个行之有效的好解决方案!谢谢。
Whome

1

当使用上面的apt remove / install方法时,依赖项可能会导致apt超出您的预期。您可能还需要重新安装其他软件包。我还重新安装了以下内容。

其中一些已经可以自动重新安装,但是复制已删除软件包的列表并使其易于确定需要做什么比较容易。

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 \

我喜欢您已经在答案中确定了删除依赖项的问题。不幸的是,您的解决方案会将所有这些软件包标记为手动安装,因此,将来在不必要时不会自动将其删除。
Olek Wojnar

1

为了防止删除过多的依赖项,请尝试dpkg -P --force-depends

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

然后再次更新,获取并安装这些软件包:

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
[...]

因此,无论是通过--reinstall依赖关系手动安装还是使用手动重新安装都没有运气dpkg -[P|i] --force-depends

2018-10-09:由于这些软件包仍然损坏,但看不到更新,我将它们全部删除了,以便能够使用apt(卸载)安装软件包。保持现状意味着无法安装或删除软件包。我正在使用本地安装的工具链来满足我的要求。

编辑:有关删除所有有问题的程序包和依赖项的说明。


@Olek:Thx用于编辑。但是不,它对我不起作用。这就是为什么我像以前那样离开该职位。即使现在您进行编辑,也无法为我提供此问题的解决方案。您介意恢复编辑吗?谢谢。
Gen.Stack

奇怪的是,它在您的计算机上不起作用。我遇到了完全相同的问题,我的解决方案将其修复。基于apt的工作原理,我很困惑为什么它对您不起作用。也许对您来说还有另一个问题吗?无论如何,我创建了自己的答案。祝您好运,解决您的问题!
Olek Wojnar '18

@OlekWojnar是的,很奇怪。到目前为止,我忽略了根本原因。我不会再深入了解其他工具链,也不需要库存。如果有一天我意识到如何解决此问题,我将进行更新。thx
Gen.Stack

0

我在Ubuntu 18.04中使用突触软件包管理器解决了该错误,方法是删除有问题的软件包并在以后重新安装它们。


-1

安装libc6-dev-armel-cross_2.27-3ubuntu1cross1.1_all.deblibc6-armel-cross_2.27-3ubuntu1cross1.1_all.deb打包并运行时出现相同的错误

apt -f install 

没用。我libc6-dev-armel-cross_2.27-3ubuntu1cross1_all.deb and libc6-armel-cross_2.27-3ubuntu1cross1_all.deb从Ubuntu软件包镜像下载了,并使用

dpkg -i *.deb 

它解决了我的问题。


就像Woofas提到的,帕特里克·帕特里克(Patrick)感谢您删除并安装此问题。
Urivan Flores '18
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.