修复dpkg返回错误代码1的问题

apt安装中断后出现Sub-process /usr/bin/dpkg returned an error code (1)
之后无论用apt install -f 或apt autoremove 都不行。
sudo dpkg --configure -a
sudo apt install -f
sudo apt remove --purge package_name
sudo apt autoremove

不行再继续往下看
删除 post file
sudo ls –l /var/lib/dpkg/info | grep –i package_name
sudo rm /var/lib/dpkg/info/package_name.*
重写package file
如果不知道实际的package name,可以执行以下命令
ls /var/cache/apt/archies/*package_name*
sudo dpkg –i ––force–overwrite /var/cache/apt/archives/full_name_of_package

sudo apt remove --purge package_name

其他方法:

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
cd /var/lib/dpkg/updates
sudo rm *
sudo apt update

参考:https://blog.csdn.net/u013832707/article/details/113104006
https://cn.linux-console.net/?p=15195