apt-get dpkg lock 和 debconf 问题

Posted RainDream

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apt-get dpkg lock 和 debconf 问题相关的知识,希望对你有一定的参考价值。

 

一:

在用sudo apt-get install 安装软件时,由于速度太慢,想换个软件源,直接关闭了终端,apt-get但进程没有结束,结果终端提示

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?
E: 无法获得锁 /var/lib/dpkg/lock – open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?

 

解决办法如下:
1 终端输入 ps -aux | grep apt,列出进程。找到含有apt的进程,直接sudo kill PID。解决。
2 强制解锁,命令

sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

 

 

二:

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: 资源暂时不可用

 

Setting up shim-signed (1.19~16.04.1+0.8-0ubuntu2) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package shim-signed (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 shim-signed

 

解决方法:

$ sudo lsof /var/cache/debconf/config.dat
lsof: WARNING: cant stat() fuse.gvfs-fuse-daemon file system /home/amw/.gvfs
      Output information may be incomplete.
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
frontend 3350 root    4uW  REG    7,0    40347 2966 /var/cache/debconf/config.dat
$ sudo kill 4250
$ sudo apt-get autoclean
$ sudo apt-get clean
$ sudo apt-get autoremove 
$ sudo apt-get update

 

然后可以试着用apt-get安装软件。

以上是关于apt-get dpkg lock 和 debconf 问题的主要内容,如果未能解决你的问题,请参考以下文章

解决apt-get /var/lib/dpkg/lock-frontend 问题

解决ubuntu apt-get install出现E:Clould not get lock /var/lib/dpkg/lock

apt-get install xxx时,报错信信息: Could not get lock /var/lib/dpkg/lock-frontend - open ……

apt-get 安装时,提示lock被占用

linux 问题一 apt-get install 被 lock

unable to lock the administration directory (/var/lib/dpkg/) is another process using it