我从 14.04 升级到了 16.04。服务器已启动并正在运行,但 dpkg 有 21 个依赖错误,我无法解决,并且阻止安装新软件包和构建新网站。
我删除了列表
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update
sudo apt-get upgrade
这就是错误开始的地方
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
21 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
Setting up php7.0-common (7.0.11-1+deb.sury.org~xenial+1) ...
dpkg: error processing package php7.0-common (--configure):
subprocess installed post-installation script returned error exit status 10
dpkg: dependency problems prevent configuration of php7.0-json:
php7.0-json depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); 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.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-opcache (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of php7.0-readline:
php7.0-readline depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-readline (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php7.0-cli:
php7.0-cli depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); 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
No apport report written because MaxReports is reached already
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.11-1+deb.sury.org~xenial+1); 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
No apport report written because MaxReports is reached already
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
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php7.0-gd:
php7.0-gd depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-gd (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php-gd:
php-gd depends on php7.0-gd; however:
Package php7.0-gd is not configured yet.
dpkg: error processing package php-gd (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php7.0-xml:
php7.0-xml depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-xml (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php-xml:
php-xml depends on php7.0-xml; however:
Package php7.0-xml is not configured yet.
dpkg: error processing package php-xml (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php-pear:
php-pear depends on php-cli; however:
Package php-cli is not installed.
Package php7.0-cli which provides php-cli is not configured yet.
php-pear depends on php-xml; however:
Package php-xml is not configured yet.
Package php7.0-xml which provides php-xml is not configured yet.
dpkg: error processing package php-pear (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php-gettext:
php-gettext depends on php-pear; however:
Package php-pear is not configured yet.
dpkg: error processing package php-gettext (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php7.0-mbstring:
php7.0-mbstring depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-mbstring (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php-mbstring:
php-mbstring depends on php7.0-mbstring; however:
Package php7.0-mbstring is not configured yet.
dpkg: error processing package php-mbstring (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php7.0-mcrypt:
php7.0-mcrypt depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-mcrypt (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php-mcrypt:
php-mcrypt depends on php7.0-mcrypt; however:
Package php7.0-mcrypt is not configured yet.
dpkg: error processing package php-mcrypt (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php7.0-mysql:
php7.0-mysql depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-mysql (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
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
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of php7.0-curl:
php7.0-curl depends on php7.0-common (= 7.0.11-1+deb.sury.org~xenial+1); however:
Package php7.0-common is not configured yet.
dpkg: error processing package php7.0-curl (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of pkg-php-tools:
pkg-php-tools depends on php-pear; however:
Package php-pear is not configured yet.
pkg-php-tools depends on php-cli; however:
Package php-cli is not installed.
Package php7.0-cli which provides php-cli is not configured yet.
pkg-php-tools depends on php-json; however:
Package php-json is not installed.
Package php7.0-json which provides php-json is not configured yet.
pkg-php-tools depends on php-xml; however:
Package php-xml is not configured yet.
Package php7.0-xml which provides php-xml is not configured yet.
dpkg: error processing package pkg-php-tools (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
php7.0-common
php7.0-json
php7.0-opcache
php7.0-readline
php7.0-cli
libapache2-mod-php7.0
libapache2-mod-php
php7.0-gd
php-gd
php7.0-xml
php-xml
php-pear
php-gettext
php7.0-mbstring
php-mbstring
php7.0-mcrypt
php-mcrypt
php7.0-mysql
php-mysql
php7.0-curl
pkg-php-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
任何想法都将不胜感激
答案1
出现这些错误是因为您删除了 /var/lib/apt/lists/*。
如果您这样做sudo dpkg--configure-a你也会看到这些错误。
如果你这样做sudo apt-get 安装 php7.0你会得到这个:
“正在读取软件包列表...完成构建依赖关系树
读取状态信息...完成 php7.0 已经是最新版本 (7.0.19-1+deb.sury.org~xenial+2)。
以下软件包已自动安装并且不再需要:
libmcrypt4 libpcre3-dev libpcre32-3 shtool xml2
使用“sudo apt autoremove”来删除它们。0 个已升级,0 个新安装,0 个要删除,5 个未升级。[...]”
你应该做:
sudo apt 自动删除 libmcrypt4
你会看到:
“以下软件包将被删除(也):
libmcrypt4 libpcre3-dev libpcre32-3 shtool xml2“
...然后一些触发器进程将自动运行并创建新的配置文件。
现在再做一次sudo dpkg--configure-a并且不会出现任何错误(我认为)。
顺便说一句。更改您的下载服务器。如果没有重新加载,没问题,打开终端并执行sudo apt-get 更新。