![安装任何软件包时 dpkg-preconfigure 抛出语法和未找到错误](https://linux22.com/image/147154/%E5%AE%89%E8%A3%85%E4%BB%BB%E4%BD%95%E8%BD%AF%E4%BB%B6%E5%8C%85%E6%97%B6%20dpkg-preconfigure%20%E6%8A%9B%E5%87%BA%E8%AF%AD%E6%B3%95%E5%92%8C%E6%9C%AA%E6%89%BE%E5%88%B0%E9%94%99%E8%AF%AF.png)
我有一个 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
与工作图像进行比较,但到目前为止我没有发现任何奇怪的地方。
答案1
/usr/bin/perl
你的系统不知何故被破坏了。它来自 perl-base 包,该包被标记为“essential”。这些工具故意使删除“基本”软件包变得更加困难。如果有人不遗余力地删除那个“基本”包,因为它是“图形化”的,正如你所说,你可以向 xem 解释说这这就是为什么这样做是错误的。
答案2
您的设置有问题。所以这个问题很难解决。
您可能想要使用实时发行版(与您的发行版相同的版本和架构[和位])并从那里启动。您可能需要将一些文件复制到您的文件系统(因此您必须找到相同的发行版)。
或者你可以把第三行/usr/sbin/dpkg-preconfigure
exit 0;
这将停止预配置(这是允许的,例如,如果 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(并且通常以简化的方式)。因此,您应该能够做到这一点,而无需删除文件或删除必要的软件包。如果您想找到最小值,您必须有两个系统,并尝试删除其中一个系统中的软件包。埃文。你再次添加它们。
答案3
我很欣赏你的回答,它帮助我更深入地了解它。
通过尝试执行 perl 和 bash 脚本,我收到一个错误:
cannot execute binary file: Exec format error
尽管如此,文件检查确认了正确的架构。
我进入内核配置文件,注意到用户空间二进制格式下的一些行被注释掉了。我最好的猜测是取消注释,很高兴,它起作用了。这是当前工作配置文件:
Userspace binary formats
CONFIG_BINFMT_ELF=y
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
# CONFIG_BINFMT_FLAT is not set
# CONFIG_HAVE_AOUT is not set
CONFIG_BINFMT_MISC=y
CONFIG_COREDUMP=y