E: Sub-process /usr/bin/dpkg returned an error code (1)解决过程

   

在NanoPi2上更新包时让运行apt-get -f install,运行之后报错:

#apt-get -f install
...
(Reading database ... 35 files and directories currently installed.)
Preparing to unpack .../libperl5.22_5.22.1-9ubuntu0.6_armhf.deb ...
Unpacking libperl5.22:armhf (5.22.1-9ubuntu0.6) over (5.22.1-9) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/libperl5.22_5.22.1-9ubuntu0.6_armhf.deb (--unpack):
 cannot copy extracted data for './usr/lib/arm-linux-gnueabihf/perl/5.22.1/auto/Encode/TW/TW.so' to '/usr/lib/arm-linux-gnueabihf/perl/5.22.1/auto/Encode/TW/TW.so.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
 /var/cache/apt/archives/libperl5.22_5.22.1-9ubuntu0.6_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

网上的解决方案如下:

cd /var/lib/dpkg 
sudo mv info info.bak #做备份 
sudo mkdir info
sudo apt-get install python-imaging --reinstall #重新安装cmake包
sudo rm -rf info
sudo mv info.bak info #还原info
然后再sudo apt-get install python-imaging就不会出现上面的错误了

试过了完全行不通,发现报错涉及/var/cache/apt/archives/libperl5.22_5.22.1-9ubuntu0.6_armhf.deb,尝试删掉试试,竟然行得通,我的解决方案如下:

#mv /var/cache/apt/archives/libperl5.22_5.22.1-9ubuntu0.6_armhf.deb /var/cache/apt/archives/libperl5.22_5.22.1-9ubuntu0.6_armhf.deb.bak

然后在运行apt-get -f install就不会报错了。

发表评论