我没有运行任何包安装,但是当我尝试安装DEB包时出现以下错误。我考虑过重新启动系统,但这可能会损坏数据库。而且以前也发生过。
sudo dpkg -i slack-desktop-2.1.2-amd64.deb
dpkg: error: dpkg status database is locked by another process
sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Hit:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:7 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [188 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [94.2 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [387 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [383 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [147 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [326 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [323 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [113 kB]
Fetched 2,058 kB in 5s (360 kB/s)
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?
尝试使用
sudo lsof /var/lib/dpkg/lock
查看哪个进程锁定了更新程序。您也可以使用
ps -ax | grep dpkg
,或者ps -ax | grep apt
还有软件中心和自动更新程序,它们可能会阻止进程,此时您可以使用kill <process id number>
.如果这些方法不起作用,请在此处查看更多可以尝试的方法无法锁定管理目录 (/var/lib/dpkg/) 是另一个使用它的进程吗?
输入以下行以查找进程 ID:
然后使用它显示的 PID 运行此命令: