![Dpkg 无法加载“/usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so”](https://linux22.com/image/162051/Dpkg%20%E6%97%A0%E6%B3%95%E5%8A%A0%E8%BD%BD%E2%80%9C%2Fusr%2Flib%2Farm-linux-gnueabihf%2Fperl%2F5.28%2Fauto%2FFcntl%2FFcntl.so%E2%80%9D.png)
当我尝试在sudo apt upgrade
我的 Raspberry Pi 系统上运行 Raspbian Buster 时,dpkg
在配置以下内容时出错openssh-server
:
$ sudo apt upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
rpi.gpio-common
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
debconf: Perl may be unconfigured (Can't load '/usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so' for module Fcntl: /usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so: invalid ELF header at /usr/share/perl/5.28/XSLoader.pm line 93.
at /usr/lib/arm-linux-gnueabihf/perl/5.28/Fcntl.pm line 11.
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/Seekable.pm line 11.
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/Seekable.pm line 11.
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/File.pm line 10.
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/File.pm line 10.
Compilation failed in require at /usr/share/perl/5.28/FileHandle.pm line 9.
Compilation failed in require at (eval 1) line 3.
BEGIN failed--compilation aborted at (eval 1) line 3.
) -- aborting
Setting up openssh-server (1:7.9p1-10+deb10u1) ...
Can't load '/usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so' for module Fcntl: /usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so: invalid ELF header at /usr/share/perl/5.28/XSLoader.pm line 93.
at /usr/lib/arm-linux-gnueabihf/perl/5.28/Fcntl.pm line 11.
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.28/POSIX.pm line 11.
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.28/POSIX.pm line 17.
Compilation failed in require at /usr/share/perl5/Debconf/Template.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Template.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Question.pm line 8.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Question.pm line 8.
Compilation failed in require at /usr/share/perl5/Debconf/Config.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Config.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at /usr/share/perl5/Debconf/Db.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Db.pm line 7.
Compilation failed in require at /usr/share/debconf/frontend line 6.
BEGIN failed--compilation aborted at /usr/share/debconf/frontend line 6.
dpkg: error processing package openssh-server (--configure):
installed openssh-server package post-installation script subprocess returned error exit status 255
dpkg: dependency problems prevent configuration of ssh:
ssh depends on openssh-server (>= 1:7.9p1-10+deb10u1); however:
Package openssh-server is not configured yet.
dpkg: error processing package ssh (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
openssh-server
ssh
E: Sub-process /usr/bin/dpkg returned an error code (1)
在看到错误中建议配置问题的行后,我尝试了sudo dpkg --configure -a
,只是再次获得相同的输出:
$ sudo dpkg --configure -a
Setting up openssh-server (1:7.9p1-10+deb10u1) ...
Can't load '/usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so' for module Fcntl: /usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so: invalid ELF header at /usr/share/perl/5.28/XSLoader.pm line 93.
at /usr/lib/arm-linux-gnueabihf/perl/5.28/Fcntl.pm line 11.
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.28/POSIX.pm line 11.
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.28/POSIX.pm line 17.
Compilation failed in require at /usr/share/perl5/Debconf/Template.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Template.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Question.pm line 8.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Question.pm line 8.
Compilation failed in require at /usr/share/perl5/Debconf/Config.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Config.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at /usr/share/perl5/Debconf/Db.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Db.pm line 7.
Compilation failed in require at /usr/share/debconf/frontend line 6.
BEGIN failed--compilation aborted at /usr/share/debconf/frontend line 6.
dpkg: error processing package openssh-server (--configure):
installed openssh-server package post-installation script subprocess returned error exit status 255
dpkg: dependency problems prevent configuration of ssh:
ssh depends on openssh-server (>= 1:7.9p1-10+deb10u1); however:
Package openssh-server is not configured yet.
dpkg: error processing package ssh (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
openssh-server
ssh
当谈到Linux的包配置和openssh-server
包的模糊性时,我是一个十足的菜鸟。我无法在网上找到任何描述类似问题和可行解决方案的文献或论坛帖子。我该如何解决这个明显的库冲突?
编辑:
$ sudo apt --reinstall install perl-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
rpi.gpio-common
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 1,352 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror.os6.org/raspbian/raspbian buster/main armhf perl-base armhf 5.28.1-6 [1,352 kB]
Fetched 1,352 kB in 1s (1,069 kB/s)
debconf: Perl may be unconfigured (Can't load '/usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so' for module Fcntl: /usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so: invalid ELF header at /usr/share/perl/5.28/XSLoader.pm line 93.
at /usr/lib/arm-linux-gnueabihf/perl/5.28/Fcntl.pm line 11.
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/Seekable.pm line 11.
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/Seekable.pm line 11.
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/File.pm line 10.
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.28/IO/File.pm line 10.
Compilation failed in require at /usr/share/perl/5.28/FileHandle.pm line 9.
Compilation failed in require at (eval 1) line 3.
BEGIN failed--compilation aborted at (eval 1) line 3.
) -- aborting
(Reading database ... 43627 files and directories currently installed.)
Preparing to unpack .../perl-base_5.28.1-6_armhf.deb ...
Unpacking perl-base (5.28.1-6) over (5.28.1-6) ...
Setting up perl-base (5.28.1-6) ...
Setting up openssh-server (1:7.9p1-10+deb10u1) ...
Can't load '/usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so' for module Fcntl: /usr/lib/arm-linux-gnueabihf/perl/5.28/auto/Fcntl/Fcntl.so: invalid ELF header at /usr/share/perl/5.28/XSLoader.pm line 93........................]
at /usr/lib/arm-linux-gnueabihf/perl/5.28/Fcntl.pm line 11........................................................]
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.28/POSIX.pm line 11............................]
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.28/POSIX.pm line 17........................]
Compilation failed in require at /usr/share/perl5/Debconf/Template.pm line 7........................................]
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Template.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Question.pm line 8.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Question.pm line 8.
Compilation failed in require at /usr/share/perl5/Debconf/Config.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Config.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at /usr/share/perl5/Debconf/Db.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Db.pm line 7.
Compilation failed in require at /usr/share/debconf/frontend line 6.
BEGIN failed--compilation aborted at /usr/share/debconf/frontend line 6.
dpkg: error processing package openssh-server (--configure):
installed openssh-server package post-installation script subprocess returned error exit status 255
dpkg: dependency problems prevent configuration of ssh:
ssh depends on openssh-server (>= 1:7.9p1-10+deb10u1); however:
Package openssh-server is not configured yet.
dpkg: error processing package ssh (--configure):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.8.5-2) ...
Illegal instruction
Errors were encountered while processing:
openssh-server
ssh
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ ls /usr/bin/ -lah | grep perl
-rwxr-xr-x 2 root root 2.8M Mar 31 2019 perl
-rwxr-xr-x 2 root root 2.8M Mar 31 2019 perl5.28.1
-rwxr-xr-x 1 root root 5.5K Mar 31 2019 perl5.28-arm-linux-gnueabihf
-rwxr-xr-x 2 root root 46K Mar 31 2019 perlbug
-rwxr-xr-x 1 root root 125 Mar 31 2019 perldoc
-rwxr-xr-x 1 root root 11K Mar 31 2019 perlivp
-rwxr-xr-x 2 root root 46K Mar 31 2019 perlthanks
答案1
看起来这个问题是由 perl 和 perl 之间的先有鸡还是先有蛋的问题引起的德布会议。德布会议是一项可选功能,允许软件包在开始时而不是在安装过程中获取配置问题:它并不重要,因此可以将其移走。
在 Debian 9 或 10 系统上,其调用配置如下/etc/apt/apt.conf.d/70debconf
:
// Pre-configure all packages with debconf before they are installed. // If you don't like it, comment it out. DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
所以只需注释掉DPkg::Pre-Install-Pkgs
上面的行即可。
从错误消息来看,我认为该包libperl5.28
可能有损坏的内容。perl-base
要么重新安装它易于:
apt-get --fix-broken --reinstall install perl-base libperl5.28
或者如果易于还需要 Perl 和扼流圈)直接尝试包装袋自下载以来:
dpkg -i /var/cache/apt/archives/libperl5.28_5.28.1-6_armhf.deb
如果您遇到更多错误,这可能意味着系统之前发生了其他事情,但问题中没有解释。了解系统之前发生了什么错误可以帮助修复它。
一旦 perl 恢复工作,您可以取消注释上一行以启用德布会议后退。