1

I have a Debian Stretch 9.3 image with a modified rootfs (not by me) with less packages than usual to prevent an increased footprint, i.e., graphical environment.

I am trying to figure out what is preventing new packages from installing.

Here is a sample output:

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)

Errors like BEGIN: not found and Syntax error: "(" unexpected appear no matter what package I try to install.

I have tried comparing the outputs of systemd-analyze blame and systemd-analyze critical-chain with the working image but I did not find anything strange so far.

3 Answers3

3

You have broken /usr/bin/perl on your system somehow. It comes from the perl-base package, which is marked "essential". Removing "essential" packages is intentionally made more difficult by the tools. If someone nevertheless went to the lengths of removing that "essential" package on the grounds of it being "graphical" as you say, you can explain to xem that this is why that was wrong to do.

JdeBP
  • 68,745
  • Alternatively the first line of /usr/share/debconf/frontend is no longer #!/usr/bin/perl -w which causes the script to be run by shell and not perl. I'd expect the error to be about perl if perl was broken. – wurtel Jan 29 '19 at 07:50
  • Two perl scripts are both failing in the question, and you need to refresh your memory of the fallback when a script is not directly executable by the kernel and the p versions of the library functions are being used or the shell is involved in spawning things. We have questions and answers about it, such as https://unix.stackexchange.com/questions/268766/ , https://unix.stackexchange.com/questions/489628/ , and https://unix.stackexchange.com/questions/346209/ just for starters. – JdeBP Jan 29 '19 at 08:28
1

There is something broken on your setup. So it is difficult to solve the problem.

You may want to use a live distribution (the same version and architecture [and bits] of your distribution) and boot from there. You may be required to copy some files to your filesystem (for this reason you must find the same distribution).

Alternatively you may put in third line of /usr/sbin/dpkg-preconfigure

exit 0;

This will make stop preconfiguration (which is allowed, e.g. if there are problem with perl, see the next block).

For such cases, I recommend to use directly dpkg and not apt (and other higher level interfaces). Go to /var/cache/apt/archives/ (you will see recently downloaded packages.

First thing first: try dpkg --configure --pending.

Try to reinstall essential packages (you get the list with aptitude search ~E, see Finding all "essential" packages with apt). Try again step 1. If it is all OK, remove the 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.

0

I appreciate your answers, it helped me look deeper into it.

By trying to execute both perl and bash scripts, I got an error:

cannot execute binary file: Exec format error

Nevertheless, file inspection confirmed the right architecture.

I got into the kernel configuration file and noticed that some of the lines under Userspace binary formats were commented out. My best guess was to uncomment it and , gladly, it worked. Here is the current working configuration file:

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
  • You should put this as new question. This site is a reference site: we are not just helping you, but we are building a database of problems that other people will encounter. By having a question per question (page) really helps google Your error is much worse then expected. Or you edited a binary file (and text removed some characters) or your file is corrupted. (it happens). It is not a problem of configuration. Try with command file + executable name, and you will get which kind of format that file have. – Giacomo Catenazzi Jan 29 '19 at 13:19