“sudo apt autoremove”指令不起作用(“/var/cache/debconf/config.dat 被另一個程序鎖定”)

“sudo apt autoremove”指令不起作用(“/var/cache/debconf/config.dat 被另一個程序鎖定”)

我嘗試過諸如編輯panasoniclpd.init文件之類的解決方案,但它也不起作用。每當我嘗試從 CLI 更新或安裝時,都會顯示此問題

sudo apt autoremove
[sudo] password for lahlohi: 
Sorry, try again.
[sudo] password for lahlohi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 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 unattended-upgrades (1.1ubuntu1.18.04.14) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package unattended-upgrades (--configure):
 installed unattended-upgrades package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 unattended-upgrades
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

如果無法重新啟動並且您可以存取計算機,請嘗試以下操作:

1)從錯誤訊息中找到鎖定檔案的進程ID:

$ sudo lsof /var/cache/debconf/config.dat
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
frontend 44515 root 4uW REG 252,0 60012 55592027 /var/cache/debconf/config.dat

2)透過以下方式檢查流程ps

$ sudo ps auxf | grep 44515
root 44515 0.0 0.0 60700 2196 pts/0 S+ Feb18 0:00 | _ /usr/bin/perl -w 
/usr/share/debconf/frontend /var/lib/dpkg/info/postfix.postinst configure 3.1.0-3ubuntu0.2

3)殺死進程。

$ sudo kill -9 44515

4)apt再次嘗試您的命令。

相關內容