当我试图在Ubuntu 20.04上安装git时,我遇到了一个错误。我使用了以下命令:
sudo apt-get install git
并且它生成了一个错误:
dpkg: warning: old mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
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.27-0ubuntu0.20.04.1_amd64.deb (--unpack):
new mysql-server-8.0 package pre-removal 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:
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-8.0_8.0.27-0ubuntu0.20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
如图所示,这意味着config.dat文件被另一个进程使用,您需要终止它。
sudo fuser -v -k /var/cache/debconf/config.dat
这将直接扼杀其他进程。
然后您可以重试安装命令。