2019獨角獸企業重金招聘Python工程師標準>>>
Unfortunately I've deleted?dpkg?directory while removing the lock. By mistake I typed
root@sam:~$ rm -r /var/lib/dpkg
Now 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/status
Now, let's see if your dpkg is working (start praying):
apt-get download dpkg
sudo dpkg -i dpkg*.deb
If everything is "ok" then repair your base files too:
apt-get download base-files
sudo dpkg -i base-files*.deb
Now try to update your package list, etc.:
dpkg --audit
sudo apt-get update
sudo apt-get check
Now, 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.