当前位置: 首页>>技术教程>>正文


dpkg:错误:dpkg状态数据库被另一个进程锁定

,

问题描述

我只是想知道是否有人可以告诉我这意味着什么:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
reidsr@ubuntu:~$ sudo dpkg --configure -a
dpkg: error: dpkg status database is locked by another process
reidsr@ubuntu:~$ 

如何手动运行sudo dpkg --configure -a

最佳解决办法

第一次运行:

lsof /var/lib/dpkg/lock

然后确保该进程未运行:

ps cax | grep PID

如果它正在运行:

kill PID
#wait
kill -9 PID

确保流程完成:

ps cax | grep PID

然后删除锁定文件:

sudo rm /var/lib/dpkg/lock

让dpkg修复自己:

sudo dpkg --configure -a

你之后应该没事:)

次佳解决办法

您无法同时运行多个软件包应用程序/命令/工具。有时,这意味着synaptic,apt-get或包更新工具正在后台运行。只需关闭其他包工具,或等待它们完成。并且dpkg将运行。

第三种解决办法

人们也可以尝试:

sudo apt-get install -f

修复任何损坏的包:

Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to completely correct the problem. The option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system’s dependency structure can be so corrupt as to require manual intervention (which usually means using dselect(1) or dpkg --remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations. Configuration Item: APT::Get::Fix-Broken.

第四种办法

以下应该有所帮助

sudo rm /var/lib/dpkg/lock

sudo dpkg --configure -a

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/1912.html,未经允许,请勿转载。