中断 apt-get,无法使用 apt/dpkg

中断 apt-get,无法使用 apt/dpkg

我正在使用命令安装 lamp-server^

sudo apt-get install lamp-server^

当它挂在此部分时:

Setting up mysql-server-5.7 (5.7.15-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto                          mode
Renaming removed key_buffer and myisam-recover options (if present)

我试过 ctrl+c,但毫无效果,然后出于习惯按了 ctrl-z,结果暂停了。使用 fg 后,dpkg 立即退出,但处于奇怪的锁定状态。

我试过,

sudo dpkg --configure -a

之前和之后

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock

但无济于事。如果我尝试 --configure -a 或 apt-get upgrade,我会得到以下结果:

theelous3@compoopr:/var/lib/dpkg/updates$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
11 not fully installed or removed.
After this operation, 0 B 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
Setting up mysql-server-5.7 (5.7.15-0ubuntu0.16.04.1) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up php7.0-common (7.0.8-0ubuntu0.16.04.3) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package php7.0-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of php7.0-json:
 php7.0-json depends on php7.0-common (= 7.0.8-0ubuntu0.16.04.3); however:
  Package php7.0-common is not configured yet.

dpkg: error processing package php7.0-json (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php7.0-opcache:
 php7.0-opcache depends on php7.0-common (= 7.0.8-0ubuntu0.16.04.3); however:
  Package php7.0-common is not configured yet.

dpkg: error processing package php7.0-opcache (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php7.0-readline:
 php7.0-readline depends on php7.0-common (= 7.0.8-0ubuntu0.16.04.3); however:
  Package php7.0-common is not configured yet.

dpkg: error processing package php7.0-readline (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php7.0-cli:
 php7.0-cli depends on php7.0-common (= 7.0.8-0ubuntu0.16.04.3); however:
  Package php7.0-common is not configured yet.
 php7.0-cli depends on php7.0-json; however:
  Package php7.0-json is not configured yet.
 php7.0-cli depends on php7.0-opcache; however:
  Package php7.0-opcache is not configured yet.
 php7.0-cli depends on php7.0-readline; however:
  Package php7.0-readline is not configured yet.

dpkg: error processing package php7.0-cli (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libapache2-mod-php7.0:
 libapache2-mod-php7.0 depends on php7.0-cli; however:
  Package php7.0-cli is not configured yet.
 libapache2-mod-php7.0 depends on php7.0-common (= 7.0.8-0ubuntu0.16.04.3); however:
  Package php7.0-common is not configured yet.
 libapache2-mod-php7.0 depends on php7.0-json; however:
  Package php7.0-json is not configured yet.
 libapache2-mod-php7.0 depends on php7.0-opcache; however:
  Package php7.0-opcache is not configured yet.

dpkg: error processing package libapache2-mod-php7.0 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libapache2-mod-php:
 libapache2-mod-php depends on libapache2-mod-php7.0; however:
  Package libapache2-mod-php7.0 is not configured yet.

dpkg: error processing package libapache2-mod-php (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php7.0-mysql:
 php7.0-mysql depends on php7.0-common (= 7.0.8-0ubuntu0.16.04.3); however:
  Package php7.0-common is not configured yet.

dpkg: error processing package php7.0-mysql (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php-mysql:
 php-mysql depends on php7.0-mysql; however:
  Package php7.0-mysql is not configured yet.

dpkg: error processing package php-mysql (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.7
 php7.0-common
 php7.0-json
 php7.0-opcache
 php7.0-readline
 php7.0-cli
 libapache2-mod-php7.0
 libapache2-mod-php
 mysql-server
 php7.0-mysql
 php-mysql
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

您留下了一些未配置的软件包。您需要删除 debconf 留下的锁定文件,并修复未配置的软件包。

sudo rm /var/cache/debconf/*.dat sudo apt-get install -f

相关内容