无法在 Debian Jessie 上安装 Apache2

无法在 Debian Jessie 上安装 Apache2

我启动 apt-get,sudo apt-get install apache2它提供了这个:

The following extra packages will be installed:
   apache2
Suggested packages:
   apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils
The following NEW packages will be installed:
   apache2
0 upgraded, 1 newly installed, 0 to remove and 435 not upgraded.
11 not fully installed or removed.
Need to get 192 kB of archives.
After this operation, 503 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.us.debian.org/debian/ jessie/main apache2 amd64 2.4.7-1 [192 kB]
Fetched 192 kB in 0s (242 kB/s)  
(Reading database ... 266945 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.7-1_amd64.deb ...
/var/lib/dpkg/tmp.ci/preinst: line 118: a2query: command not found
dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.7-1_amd64.deb (--unpack):
    subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
    /var/cache/apt/archives/apache2_2.4.7-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我已经研究过 a2query,但没有找到有关它的任何信息。

答案1

一篇关于ctheroux 演示如何解决这个问题基本上,以 root 身份运行以下命令:

dpkg --fsys-tarfile /var/cache/apt/archives/apache2_2.4.7-1ubuntu4_amd64.deb | tar xOf - ./usr/sbin/a2query > /usr/sbin/a2query
chmod 755 /usr/sbin/a2query

答案2

a2query 位于您尝试安装的 apache2 包本身内,但它是预安装阶段所必需的,这确实很尴尬。

查看预安装阶段,如果软件包认为您实际上是在从 Squeeze 进行升级,则运行 a2query。需要进行一些检查才能意识到这种情况正在发生,其中第一个(也是最简单的)检查是检查“/etc/apache2”目录是否存在。我猜想也许您的系统出于某种原因有该目录,因此我建议首先删除(或重命名)/etc/apache2(如果系统中存在)。

否则,您可以暂时手动将 /usr/sbin/a2query 从 .deb 提取到您的系统中,然后尝试这样做。

相关内容