[Debconf-devel] Bug#1061480: debconf should automatically be noninteractive if input is /dev/null
Josh Triplett
josh at joshtriplett.org
Sat Mar 8 15:17:29 GMT 2025
On Fri, 7 Mar 2025 18:02:01 +0000 Colin Watson <cjwatson at debian.org> wrote:
> On Sun, Dec 29, 2024 at 01:25:38PM -0800, Josh Triplett wrote:
> >Colin Watson wrote:
> >> It would be helpful for me to have a reproducer for this. If I just try
> >> `env -u TERM apt install tzdata </dev/null`, I get behaviour that, while
> >> somewhat buggy, is not the same as what you reported and doesn't result
> >> in a hang:
> >
> >I'll follow up with the right transcript.
>
> Ping - I can't seem to find anything from you with the right transcript
> for this?
Sorry for the greatly delayed follow-up! Didn't get it done before going on
vacation, and lost track of it while on vacation.
It's difficult to construct a reproduction environment for this unless
you *specifically don't have any access to a terminal*, because several
of the pieces of software involved try very hard to reopen or create
one. Combinations of `setsid` and `nohup` don't suffice, for instance.
(I originally reproduced this using a VM-based batch environment with no
access to a terminal, with stdin coming from /dev/null, and stdout and
stderr going to UNIX sockets.)
I did manage to find a recipe for reproducing this on a stock Debian
system running systemd, by using `systemd-run`. I'm using the package
`wireshark-common` for the example, as it's a convenient package that
wasn't installed and has a debconf question. I had the latest debconf
(1.5.90), apt (2.9.31), and dpkg (1.22.17) installed, and
wireshark-common *not* installed (and its debconf answers not present in
/var/cache/debconf/config.dat).
Given that, the following command will reproduce this, and show the
output to the terminal:
systemd-run -P apt -y install wireshark-common </dev/null 2>&1 | cat
This produces:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Installing:
wireshark-common
Installing dependencies:
libbcg729-0 libsmi2t64 libwireshark18 libwsutil16
libcares2 libwireshark-data libwiretap15
Suggested packages:
snmp-mibs-downloader geoip-database-extra wireshark-doc
geoipupdate libjs-leaflet
geoip-database libjs-leaflet.markercluster
Recommended packages:
wireshark | tshark
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
Summary:
Upgrading: 0, Installing: 8, Removing: 0, Not Upgrading: 94
Download size: 0 B / 22.8 MB
Space needed: 139 MB / 1155 GB available
Selecting previously unselected package libbcg729-0:amd64.
(Reading database ... 236549 files and directories currently installed.)
Preparing to unpack .../0-libbcg729-0_1.1.1-3_amd64.deb ...
Unpacking libbcg729-0:amd64 (1.1.1-3) ...
Selecting previously unselected package libcares2:amd64.
Preparing to unpack .../1-libcares2_1.34.4-2.1_amd64.deb ...
Unpacking libcares2:amd64 (1.34.4-2.1) ...
Selecting previously unselected package libsmi2t64:amd64.
Preparing to unpack .../2-libsmi2t64_0.4.8+dfsg2-17+b1_amd64.deb ...
Unpacking libsmi2t64:amd64 (0.4.8+dfsg2-17+b1) ...
Selecting previously unselected package libwireshark-data.
Preparing to unpack .../3-libwireshark-data_4.4.5-1_all.deb ...
Unpacking libwireshark-data (4.4.5-1) ...
Selecting previously unselected package libwsutil16:amd64.
Preparing to unpack .../4-libwsutil16_4.4.5-1_amd64.deb ...
Unpacking libwsutil16:amd64 (4.4.5-1) ...
Selecting previously unselected package libwiretap15:amd64.
Preparing to unpack .../5-libwiretap15_4.4.5-1_amd64.deb ...
Unpacking libwiretap15:amd64 (4.4.5-1) ...
Selecting previously unselected package libwireshark18:amd64.
Preparing to unpack .../6-libwireshark18_4.4.5-1_amd64.deb ...
Unpacking libwireshark18:amd64 (4.4.5-1) ...
Selecting previously unselected package wireshark-common.
Preparing to unpack .../7-wireshark-common_4.4.5-1_amd64.deb ...
Unpacking wireshark-common (4.4.5-1) ...
Setting up libsmi2t64:amd64 (0.4.8+dfsg2-17+b1) ...
Setting up libbcg729-0:amd64 (1.1.1-3) ...
Setting up libcares2:amd64 (1.34.4-2.1) ...
Setting up libwireshark-data (4.4.5-1) ...
Setting up libwsutil16:amd64 (4.4.5-1) ...
Setting up libwiretap15:amd64 (4.4.5-1) ...
Setting up libwireshark18:amd64 (4.4.5-1) ...
Setting up wireshark-common (4.4.5-1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
Configuring wireshark-common
----------------------------
Dumpcap can be installed in a way that allows members of the "wireshark" system
group to capture packets. This is recommended over the alternative of running
Wireshark/Tshark directly as root, because less of the code will run with
elevated privileges.
For more detailed information please see
/usr/share/doc/wireshark-common/README.Debian.gz once the package is installed.
Enabling this feature may be a security risk, so it is disabled by default. If
in doubt, it is suggested to leave it disabled.
Should non-superusers be able to capture packets? [yes/no]
Use of uninitialized value $_[1] in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 112.
Use of uninitialized value $val in substitution (s///) at /usr/share/perl5/Debconf/Format/822.pm line 84, <GEN6> line 1.
Use of uninitialized value $val in concatenation (.) or string at /usr/share/perl5/Debconf/Format/822.pm line 85, <GEN6> line 1.
Processing triggers for libc-bin (2.41-3) ...
Processing triggers for man-db (2.13.0-1) ...
Processing triggers for shared-mime-info (2.4-5+b2) ...
Processing triggers for hicolor-icon-theme (0.18-2) ...
The problem with this, compared to the noninteractive frontend, is that
1) it produces errors (and shows the question in the terminal log), and
2) it treats the question as "seen", when it really hasn't been.
I imagine that the errors could be fixed to handle a lack of input, with
a change similar to the fix for https://bugs.debian.org/723843 .
However, that wouldn't address the underlying problem that this
shouldn't be using the teletype frontend because it has no source of
input; that's what the patch I sent handles.
I hope the reproducer helps with this.
More information about the Debconf-devel
mailing list