dpkg和perl的依赖环境出现错误故障解决(磁盘原因)

本文记录了一次使用dpkg安装应用时遇到的Debconf问题及通过apt-get修复未果的情况。作者深入排查后发现是磁盘出现I/O错误导致的Perl模块加载失败,并最终定位为磁盘故障。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

内核:

uname -a

Linux localhost.localdomain 3.4.29-t4 #12 Wed Mar 13 16:50:15 EST 2013 armv7l armv7l armv7l GNU/Linux

dpkg安装应用时遇到问题,提示运行apt-get -f install修复依赖。

apt-get -f install 后提示如下:

debconf: Perl may be unconfigured (Can't locate Debconf/Log.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at (eval 1) line 4.
BEGIN failed--compilation aborted at (eval 1) line 4.

从上面信息看@INC本身并没有什么变化。

既然不能找到Debconf/Log.pm,就安装一下看看,结果perl -MCPAN -e shell “install Debconf::Log” 也出现错误。那到底问题在哪呢?

忽然想起前些天曾在CPAN更新新版perl过程中出现网络中断安装失败,之后又删除了更新半截的~/perl5目录。难道是perl 被错误的switch到一个不存在的路径了?回看了一下@INC并没有我那天删除的那个安装目录。于是想~干脆新装一个perl试试。(最终结果证实这段尝试是一段弯路,不需要安装新版本的朋友可以跳过这段标记=cut......cut的部分)

=cut

安装新的perl,又不想费掉原来的环境,那就做版本共存吧。
实现多个perl版本共存最好的工具是perlbrew,具体操作步骤在我的另外一篇日志里有提到,有不了解perlbrew的朋友,具体可访问http://blog.asiulo.com/post-9.html.

这个安装时间会比较的长,但不需要值守。

装好后记得看下log,没有问题再做switch。具体可参考http://blog.asiulo.com/post-9.html中的流程。

继续之前的apt-get -f install,问题依旧,这个实验倒是证明了我的猜想,既不是版本发生switch的问题,那问题会在哪里呢?

还是仔细再检查下原来的perl环境吧,于是乎执行下列操作切换回旧版perl

source /opt/perl5/perlbrew/etc/bashrc

perlbrew switch-off

cut

perl -V 重新查看perl的详细信息,还是没有发现什么问题。最后我开始把注意力放到了perl的@INC环境变量上。

我开始ls查看他们,

perl -e 'print join "\n",@INC'|awk '{print "ls -l",$0}'|sh

在/usr/share/perl5/发现了问题:

ls: cannot access /usr/share/perl5/Algorithm: Input/output error
ls: cannot access /usr/share/perl5/Net: Input/output error
ls: cannot access /usr/share/perl5/Text: Input/output error
ls: cannot access /usr/share/perl5/Time: Input/output error
ls: cannot access /usr/share/perl5/Debconf: Input/output error
ls: cannot access /usr/share/perl5/Date: Input/output error
ls: cannot access /usr/share/perl5/Debian: Input/output error
ls: cannot access /usr/share/perl5/HTML: Input/output error
ls: cannot access /usr/share/perl5/Class: Input/output error
ls: cannot access /usr/share/perl5/Bundle: Input/output error
ls: cannot access /usr/share/perl5/Git: Input/output error
ls: cannot access /usr/share/perl5/Error: Input/output error

原来是磁盘出现了问题!

dmesg查看了一下系统信息,也发现了nand flash提示CRC校验错误(我把/usr mount到这里了)。

由于是实验环境,以及时间的关系,我最终没有进行fsck.ext4的检查与修复,而是重做了系统,把出现过错误的那块磁盘挂成了备盘。

至此结案!

转载于:https://www.cnblogs.com/gordonchang/p/6681559.html

root@kylin-pc:/home/kylin# apt-get install kdump-tools 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 下列软件包是自动安装的并且现在不需要了: archdetect-deb dmeventd finalrd libaio1t64 libdebian-installer4 libdevmapper-event1.02.1 liblvm2cmd2.03 localechooser-data lvm2 user-setup 使用'sudo apt autoremove'来卸载它(它们)。 将会同时安装下列软件: crash kexec-tools makedumpfile 下列软件包将被升级: crash kdump-tools kexec-tools makedumpfile 升级了 4 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 1 个软件包未被升级。 有 4 个软件包没有被完全安装或卸载。 需要下载 0 B/3,742 kB 的归档。 解压缩后会消耗 11.9 MB 的额外空间。 您希望继续执行吗? [Y/n] y debconf: 无法初始化前端界面:Dialog debconf: (没有安装任何可用的对话框类程序,所以无法使用基于此种形式的界面。 at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 79, <STDIN> line 4.) debconf: 返回前端界面:Readline 正在预设定软件包 ... (正在读取数据库 ... 系统当前共安装有 202973 个文件目录。) 准备解压 .../kexec-tools_1%3a2.0.28-ok1_arm64.deb ... 正在解压 kexec-tools (1:2.0.28-ok1) 并覆盖 (1:2.0.28-ok1) ... dpkg: 处理归档 /var/cache/apt/archives/kexec-tools_1%3a2.0.28-ok1_arm64.deb (--unpack)出错: 无法创建 /sbin/coldreboot.dpkg-new (处理 ./sbin/coldreboot 时): 只读文件系统 dpkg: 清理时出错: 无法删除 /sbin/coldreboot 的新近解压的版本: 只读文件系统 准备解压 .../kdump-tools_1%3a1.10.3-ok1k0.1_arm64.deb ... 正在解压 kdump-tools (1:1.10.3-ok1k0.1) 并覆盖 (1:1.10.3-ok1k0.1) ... dpkg: 处理归档 /var/cache/apt/archives/kdump-tools_1%3a1.10.3-ok1k0.1_arm64.deb (--unpack)出错: 无法创建 /usr/lib/systemd/system/kdump-tools-dump.service.dpkg-new (处理 ./usr/lib/systemd/system/kdump-tools-dump.service 时): 只读文件系统 dpkg: 清理时出错: 无法删除 /usr/lib/systemd/system/kdump-tools-dump.service 的新近解压的版本: 只读文件系统 准备解压 .../crash_8.0.5-ok1_arm64.deb ... 正在解压 crash (8.0.5-ok1) 并覆盖 (8.0.5-ok1) ... dpkg: 处理归档 /var/cache/apt/archives/crash_8.0.5-ok1_arm64.deb (--unpack)出错: 无法创建 /usr/bin/crash.dpkg-new (处理 ./usr/bin/crash 时): 只读文件系统 dpkg: 清理时出错: 无法删除 /usr/bin/crash 的新近解压的版本: 只读文件系统 准备解压 .../makedumpfile_1%3a1.7.5-ok1k0.1_arm64.deb ... 正在解压 makedumpfile (1:1.7.5-ok1k0.1) 并覆盖 (1:1.7.5-ok1k0.1) ... dpkg: 处理归档 /var/cache/apt/archives/makedumpfile_1%3a1.7.5-ok1k0.1_arm64.deb (--unpack)出错: 无法创建 /usr/bin/makedumpfile.dpkg-new (处理 ./usr/bin/makedumpfile 时): 只读文件系统 dpkg: 清理时出错: 无法删除 /usr/bin/makedumpfile 的新近解压的版本: 只读文件系统 在处理时有错误发生: /var/cache/apt/archives/kexec-tools_1%3a2.0.28-ok1_arm64.deb /var/cache/apt/archives/kdump-tools_1%3a1.10.3-ok1k0.1_arm64.deb /var/cache/apt/archives/crash_8.0.5-ok1_arm64.deb /var/cache/apt/archives/makedumpfile_1%3a1.7.5-ok1k0.1_arm64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
最新发布
07-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值