DPKG:错误:DPKG状态数据库已被另一个过程锁定
删除更新以: CD/var/lib/dpkg/更新 Sudo RM *
尝试更新和升级: sudo apt更新 Sudo APT升级
仍然说: E:无法获得锁定/var/lib/dpkg/lock 这意味着某些程序正在阻止系统或安装新软件。
检查是否有任何程序锁定DPKG文件:
PS AUX | grep -i apt
尝试查看哪些现有锁定
sudo lsof/var/lib/dpkg/lock sudo lsof/var/lib/apt/lists/lock sudo lsof/var/cache/apt/archives/lock
删除它们
尝试使用: sudo rm/var/lib/apt/lists/lock sudo rm/var/cache/apt/archives/lock sudo rm/var/lib/dpkg/锁 再试一次:
sudo dpkg -configure -A 它应该起作用。
再次尝试安装:
sudo apt更新 sudo apt升级 这应该恢复过程并保持一切稳定。
这样,它解决了我的dbpkg问题已锁定
Delete the updates with:
cd /var/lib/dpkg/updates
sudo rm *
Tried to update and upgrade:
sudo apt update
sudo apt upgrade
Still it says that:
E: Could not get lock /var/lib/dpkg/lock
This means that some program is blocking the system or installing a new software.
Check if any programs is locking dpkg file:
ps aux | grep -i apt
try to see which are existing locks
sudo lsof /var/lib/dpkg/lock
sudo lsof /var/lib/apt/lists/lock
sudo lsof /var/cache/apt/archives/lock
Try to delete them using:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
Try again:
sudo dpkg --configure -a
It should work.
Try again to installing with:
sudo apt update
sudo apt upgrade
This should resume the process and keep everything stable.
this way it resolved my issue of dbpkg is locked
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用列出锁:
然后检查是否有任何进程正在运行:
如果有任何进程正在运行,则杀死它:
#wait
Kill PID
删除锁定文件:
修复 dpkg :
这样就解决了问题。
List locks using:
Then check if any process is running:
If any process is running kill it:
#wait
kill PID
Remove the lock file:
Fix dpkg :
This way it resolved the issue.
通过确保不应该运行安装过程,这个问题已为我解决。
我是通过 dpkg 命令安装 vscode 的。
也通过终端安装。于是我停止了vs code的终端安装过程。
This issue is fixed for me by making ensure there should be no installation process running.
I was installing vscode by dpkg command.
also installing via terminal. So I stopped the terminal installation process of vs code.