dpkg-preconfigure 在安裝任何軟體包時拋出語法和未找到錯誤
我有一個 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 解釋這就是為什麼這樣做是錯誤的。
您的設置有問題。所以很難解決這個問題。
您可能想要使用實時發行版(相同的版本和架構
$$ and bits $$您的發行版)並從那裡啟動。您可能需要將一些文件複製到您的文件系統(因此您必須找到相同的發行版)。 或者,您可以放入第三行
/usr/sbin/dpkg-preconfigure
exit 0;
這將停止預配置(這是允許的,例如,如果 perl 有問題,請參閱下一個塊)。
對於這種情況,我建議直接使用
dpkg
而不是apt
(以及其他更高級別的介面)。轉到/var/cache/apt/archives/
(您將看到最近下載的軟體包。第一件事:嘗試
dpkg --configure --pending
。嘗試重新安裝必要的軟體包(您可以通過 獲取列表
aptitude search ~E
,請參閱使用 apt 查找所有“必要”軟體包)。重試第 1 步。如果一切正常,請刪除exit 0;
.Try to install the correct one (you may try with perl, if there is one recently or some other base and essential packages (you may check packages.debian.org site). it is not easy, there is no hard rule. Alternatively you may try
dpkg dpkg -BOGiE *
on that directory (but you have few packages, and I do not see a smoking gun, so I think the essential part is the most important point)Note: servers usually do not have graphical interface. I always install Debian without X (and often in a reduced way) for my servers. So you should be able to do it, without removing files or removing essential packages. If you want to find the minimum, you must have two systems and you try to remove packages in one. Ev. you add them again.