apt-get 在 Ubuntu 18.04 中无法正常工作

apt-get 在 Ubuntu 18.04 中无法正常工作

我中断了安装,现在 apt 和 apt-get 无法使用任何参数。我总是得到相同的错误:

E: dpkg execution was interrupted, you must manually run "sudo dpkg --configure -a" to correct the problem.

编辑:我尝试过sudo dpkg --configure -a,但只成功了

Setting up cento (1.5.181022-373) ...
Making the /var/log/cento directory...
(Re)Starting cento...
^Cdpkg: error processing package cento (--configure):
 installed cento package post-installation script subprocess was interrupted
Setting up ntopng (3.7.181022-5357) ...
Rebuilding ld cache...
(Re)Starting ntopng...
^Cdpkg: error processing package ntopng (--configure):
 installed ntopng package post-installation script subprocess was interrupted
Setting up pfring-dkms (7.3.0) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package pfring-dkms (--configure):
 installed pfring-dkms package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Errors were encountered while processing:
 cento
 ntopng
 pfring-dkms

编辑2:我已经尝试过sudo apt install --reinstall cento,这是出口:

 Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 9 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for cento:amd64

编辑3:我已经做了udo fuser -v /var/cache/debconf/config.dat

                     USUARIO        ORDEN DE ACCESO PID
/var/cache/debconf/config.dat:
                     root       2845 F.... frontend

然后我做了sudo kill 2845(我没有得到答案)
然后我做了sudo kill -9 2845

kill: (2845): No such process

然后我尝试sudo apt autoremove

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up cento (1.5.181022-373) ...
Making the /var/log/cento directory...
(Re)Starting cento...

Progress: [  0%] [.............................................................] 

然后它就停在那里,不再做任何事

答案1

关于此锁定问题的解决方案详见维基百科

sudo fuser -v /var/cache/debconf/config.dat

将显示哪个进程正在持有锁:

USER        PID         ACCESS COMMAND
/var/cache/debconf/config.dat:
root      18210 F.... dpkg-preconfigu

然后你只需要记下 PID 并像这样终止它:

sudo kill PID 
sudo kill -9 PID  # if the first doesn't work

最初由赛义德·贾利勒·哈桑

相关内容