当我安装 xdm 时出现此错误,但我使用 --purge 修复了它,但现在我正在安装 mysql-server-8.0 并且出现此错误:
skynet@project-skynet3:/var/cache/apt/archives$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
mysql-server-8.0
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
27 not fully installed or removed.
1 standard security update
Need to get 0 B/1,282 kB of archives.
After this operation, 1,488 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: warning: files list file for package 'mysql-common' missing; assuming package has no files currently installed
(Reading database ... 134655 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.25-0ubuntu0.20.04.1_amd64.deb ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing archive /var/cache/apt/archives/mysql-server-8.0_8.0.25-0ubuntu0.20.04.1_amd64.deb (--unpack):
new mysql-server-8.0 package pre-installation script subprocess returned error exit status 1
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error while cleaning up:
new mysql-server-8.0 package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-8.0_8.0.25-0ubuntu0.20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我删除 .deb 文件时,无论我采取什么操作,它都会重新出现。我被这个问题困扰了好几个小时,真的需要帮助,谢谢。
答案1
第一步是确定哪个进程正在锁定文件config.dat
。你可以这样做:
sudo fuser -v /var/cache/debconf/config.dat
只要文件仍然被锁定,您就会得到如下内容:
USER PID ACCESS COMMAND
/var/cache/debconf/config.dat:
root 90210 F.... dpkg-preconfigu
如果您识别出该命令并看到它在另一个终端窗口中运行(或由您知道正在运行的另一个进程运行),那么您将需要等待命令完成。但是,如果该进程被锁定,您可以像这样“终止”它:
sudo kill -9 90210
笔记:确保90210
用第一个命令报告的实际 PID 替换。
或者,如果您不关心锁定了什么config.dat
而只是想安装软件,则可以像这样同时执行两个命令:
sudo fuser -v -k /var/cache/debconf/config.dat
该-k
标志将终止任何锁定该文件的进程。