dpkg和perl的依賴環境出現錯誤故障解決(磁盤原因)


內核:

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的檢查與修復,而是重做了系統,把出現過錯誤的那塊磁盤掛成了備盤。

至此結案!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM