Apt
“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)從錯誤資訊中找到鎖定文件的程序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
- 再次嘗試您的
apt
命令。