修复删除/var/lib/dpkg目录后,无法使用apt-get命令问题
2019獨角獸企業重金招聘Python工程師標準>>>
Unfortunately I've deleted?dpkg?directory while removing the lock. By mistake I typed
root@sam:~$ rm -r /var/lib/dpkgNow when I am trying to install/uninstall packages it shows me following error.
E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory)What should I do now?
解決:
?
You removed 5 directories, the status file, etc. So, lets try to fix the stuff. First, create the directory:
sudo mkdir -p /var/lib/dpkg/{alternatives,info,parts,triggers,updates}Recover some backups:
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/statusNow, let's see if your dpkg is working (start praying):
apt-get download dpkg sudo dpkg -i dpkg*.debIf everything is "ok" then repair your base files too:
apt-get download base-files sudo dpkg -i base-files*.debNow try to update your package list, etc.:
dpkg --audit sudo apt-get update sudo apt-get checkNow, let's take a deep breath. Phew. Do?ls -l /var/lib/dpkg?and compare with the above list. If some?-old?file is not present don't worry it will be there tomorrow.
轉載于:https://my.oschina.net/u/2525089/blog/1913800
總結
以上是生活随笔為你收集整理的修复删除/var/lib/dpkg目录后,无法使用apt-get命令问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 汇新杯┃拼多多黄峥:普通的创业者,不普通
- 下一篇: 构建Squid代理服务器-传统代理、透明