我有一个 Debian Stretch 9.3 映像,其中包含经过修改的 rootfs(不是我自己),其软件包比平时少,以防止占用空间增加,即图形环境。
我试图弄清楚是什么阻止了新软件包的安装。
这是一个示例输出:
root@var-som-mx7:~# apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates libcurl3 libidn2-0 libnghttp2-14 libpsl5 librtmp1
libunistring0 openssl publicsuffix
The following NEW packages will be installed:
ca-certificates curl libcurl3 libidn2-0 libnghttp2-14 libpsl5 librtmp1
libunistring0 openssl publicsuffix
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,956 kB of archives.
After this operation, 4,052 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ftp.ch.debian.org/debian stretch/main armhf openssl armhf 1.1.0f-3+deb9u2 [703 kB]
Get:2 http://ftp.ch.debian.org/debian stretch/main armhf ca-certificates all 20161130+nmu1+deb9u1 [182 kB]
Get:3 http://ftp.ch.debian.org/debian stretch/main armhf libunistring0 armhf 0.9.6+really0.9.3-0.1 [255 kB]
Get:4 http://ftp.ch.debian.org/debian stretch/main armhf libidn2-0 armhf 0.16-1+deb9u1 [58.8 kB]
Get:5 http://ftp.ch.debian.org/debian stretch/main armhf libnghttp2-14 armhf 1.18.1-1 [69.1 kB]
Get:6 http://ftp.ch.debian.org/debian stretch/main armhf libpsl5 armhf 0.17.0-3 [40.7 kB]
Get:7 http://ftp.ch.debian.org/debian stretch/main armhf librtmp1 armhf 2.4+20151223.gitfa8646d.1-1+b1 [55.1 kB]
Get:8 http://ftp.ch.debian.org/debian stretch/main armhf libcurl3 armhf 7.52.1-5+deb9u8 [264 kB]
Get:9 http://ftp.ch.debian.org/debian stretch/main armhf curl armhf 7.52.1-5+deb9u8 [223 kB]
Get:10 http://ftp.ch.debian.org/debian stretch/main armhf publicsuffix all 20181003.1334-0+deb9u1 [104 kB]
Fetched 1,956 kB in 1min 2s (31.2 kB/s)
/usr/sbin/dpkg-preconfigure: 6: /usr/sbin/dpkg-preconfigure: BEGIN: not found
/usr/sbin/dpkg-preconfigure: 1: eval: qq{: not found
/usr/sbin/dpkg-preconfigure: 8: /usr/sbin/dpkg-preconfigure: use: not found
/usr/sbin/dpkg-preconfigure: 9: /usr/sbin/dpkg-preconfigure: use: not found
/usr/sbin/dpkg-preconfigure: 10: /usr/sbin/dpkg-preconfigure: Syntax error: "(" unexpected
Selecting previously unselected package openssl.
(Reading database ... 18795 files and directories currently installed.)
Preparing to unpack .../0-openssl_1.1.0f-3+deb9u2_armhf.deb ...
Unpacking openssl (1.1.0f-3+deb9u2) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../1-ca-certificates_20161130+nmu1+deb9u1_all.deb ...
Unpacking ca-certificates (20161130+nmu1+deb9u1) ...
Selecting previously unselected package libunistring0:armhf.
Preparing to unpack .../2-libunistring0_0.9.6+really0.9.3-0.1_armhf.deb ...
Unpacking libunistring0:armhf (0.9.6+really0.9.3-0.1) ...
Selecting previously unselected package libidn2-0:armhf.
Preparing to unpack .../3-libidn2-0_0.16-1+deb9u1_armhf.deb ...
Unpacking libidn2-0:armhf (0.16-1+deb9u1) ...
Selecting previously unselected package libnghttp2-14:armhf.
Preparing to unpack .../4-libnghttp2-14_1.18.1-1_armhf.deb ...
Unpacking libnghttp2-14:armhf (1.18.1-1) ...
Selecting previously unselected package libpsl5:armhf.
Preparing to unpack .../5-libpsl5_0.17.0-3_armhf.deb ...
Unpacking libpsl5:armhf (0.17.0-3) ...
Selecting previously unselected package librtmp1:armhf.
Preparing to unpack .../6-librtmp1_2.4+20151223.gitfa8646d.1-1+b1_armhf.deb ...
Unpacking librtmp1:armhf (2.4+20151223.gitfa8646d.1-1+b1) ...
Selecting previously unselected package libcurl3:armhf.
Preparing to unpack .../7-libcurl3_7.52.1-5+deb9u8_armhf.deb ...
Unpacking libcurl3:armhf (7.52.1-5+deb9u8) ...
Selecting previously unselected package curl.
Preparing to unpack .../8-curl_7.52.1-5+deb9u8_armhf.deb ...
Unpacking curl (7.52.1-5+deb9u8) ...
Selecting previously unselected package publicsuffix.
Preparing to unpack .../9-publicsuffix_20181003.1334-0+deb9u1_all.deb ...
Unpacking publicsuffix (20181003.1334-0+deb9u1) ...
Setting up libnghttp2-14:armhf (1.18.1-1) ...
Setting up librtmp1:armhf (2.4+20151223.gitfa8646d.1-1+b1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up publicsuffix (20181003.1334-0+deb9u1) ...
Setting up libunistring0:armhf (0.9.6+really0.9.3-0.1) ...
Setting up openssl (1.1.0f-3+deb9u2) ...
Setting up ca-certificates (20161130+nmu1+deb9u1) ...
/usr/share/debconf/frontend: 5: /usr/share/debconf/frontend: use: not found
/usr/share/debconf/frontend: 6: /usr/share/debconf/frontend: use: not found
/usr/share/debconf/frontend: 7: /usr/share/debconf/frontend: use: not found
/usr/share/debconf/frontend: 8: /usr/share/debconf/frontend: Syntax error: "(" unexpected
dpkg: error processing package ca-certificates (--configure):
subprocess installed post-installation script returned error exit status 2
Setting up libidn2-0:armhf (0.16-1+deb9u1) ...
Setting up libpsl5:armhf (0.17.0-3) ...
Setting up libcurl3:armhf (7.52.1-5+deb9u8) ...
Setting up curl (7.52.1-5+deb9u8) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Errors were encountered while processing:
ca-certificates
E: Sub-process /usr/bin/dpkg returned an error code (1)
无论我尝试安装什么软件包BEGIN: not found
, 都会出现错误。Syntax error: "(" unexpected
我尝试将输出systemd-analyze blame
与systemd-analyze critical-chain
工作图像进行比较,但到目前为止我没有发现任何奇怪的东西。
你已经
/usr/bin/perl
以某种方式破坏了你的系统。它来自标记为“必需”的 perl-base 包。这些工具故意使删除“基本”包变得更加困难。如果有人仍然像你所说的那样,因为它是“图形”而竭尽全力删除那个“基本”包,你可以向 xem 解释这就是为什么这样做是错误的。您的设置有问题。所以很难解决这个问题。
您可能希望使用实时发行版(与发行版相同的版本和架构 [和位])并从那里启动。您可能需要将一些文件复制到您的文件系统(因此您必须找到相同的发行版)。
或者,您可以放入第三行
/usr/sbin/dpkg-preconfigure
这将停止预配置(这是允许的,例如,如果 perl 有问题,请参阅下一个块)。
对于这种情况,我建议直接使用
dpkg
而不是apt
(以及其他更高级别的接口)。转到/var/cache/apt/archives/
(您将看到最近下载的软件包。第一件事:尝试
dpkg --configure --pending
。尝试重新安装必要的软件包(您可以通过 获取列表
aptitude search ~E
,请参阅使用 apt 查找所有“必要”软件包)。重试第 1 步。如果一切正常,请删除exit 0;
.尝试安装正确的(你可以尝试使用 perl,如果最近有一个或其他一些基本和必要的包(你可以查看 packages.debian.org 站点)。这并不容易,没有硬性规定。或者你可以试试
dpkg dpkg -BOGiE *
那个目录(但是你的包很少,而且我没有看到确凿的证据,所以我认为最重要的部分是最重要的一点)注意:服务器通常没有图形界面。我总是为我的服务器安装没有 X 的 Debian(并且通常以简化的方式)。因此,您应该能够做到这一点,而无需删除文件或删除基本软件包。如果你想找到最小值,你必须有两个系统,并尝试在一个中删除包。EV。您再次添加它们。
感谢您的回答,它帮助我更深入地了解它。
通过尝试执行 perl 和 bash 脚本,我得到了一个错误:
尽管如此,文件检查确认了正确的架构。
我进入内核配置文件,注意到用户空间二进制格式下的一些行被注释掉了。我最好的猜测是取消注释它,很高兴它起作用了。这是当前的工作配置文件: