误删除/var/lib/dpkg的解决方案

上一篇介绍了apt-get update更新出错的解决方案

当List终于Done了以后...我们在下载需要的软件时,可能会出现找不到/var/lib/dpkg的情况

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
masoud@masoud-PC:~$ sudo apt-get upgrade 
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

经过一下操作,可以修复我们手动误删的 /var/lib/dpkg

1. 新建dpkg文件夹:

sudo mkdir -p /var/lib/dpkg/{alternatives,info,parts,triggers,updates}
2.恢复一些备份:
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
3.查看dpkg是否正常:
apt-get download dpkg
sudo dpkg -i dpkg*.deb
4.如果上一步正常,接着修复一些基本文件:
apt-get download base-files
sudo dpkg -i base-files*.deb
5.最后尝试更新软件包列表:
dpkg –audit
sudo apt-get update
sudo apt-get check

经过这些操作基本上dpkg就恢复过来啦~

然后就阔以自行下载需要的软件辽(真的可以了!因为我一手误删,VLC下了我一个下午。。。。)

你可能感兴趣的:(linux)