参考:https://jingyan.baidu.com/article/647f0115d248ae7f2148a8a3.html
安装软件的时候,无论什么软件都装不了,最后报错:Sub-process /usr/bin/dpkg returned an error code (1)
进入目录;删除文件;重新创建:
cd /var/lib/dpkg && sudo mv info info.baksudo && mkdir info
然后重新安装目标软件。
报错:dpkg: warning: files list file for package ‘build-essential’ missing; assuming package has no files currently installed
参考:https://www.bbsmax.com/A/kjdw8lgwzN/
for package in $(apt-get upgrade 2>&1 |\ grep "warning: files list file for package '" |\ grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do apt-get install --reinstall "$package"; done
然鹅依然存在少量报错。
cd /var/lib/dpkg sudo mv info info2 sudo mv info.baksudo info.baksudo2 sudo mv info.baksudo2 info sudo cp -R info2 info
即将新生成的覆盖到出错时的info目录下。