[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#994042: libc6: debconf text fallback failed to accept input, had to be killed leading to broken dist-upgrade



On Fri, Sep 10, 2021 at 09:59:44PM +0200, Aurelien Jarno wrote:
> On 2021-09-10 20:39, Colin Watson wrote:
> > On Fri, Sep 10, 2021 at 09:03:32PM +0200, Aurelien Jarno wrote:
> > > I gave a try with debconf-show instead. I have attached a totally
> > > untested patch to check that we agree on the way to do it.
> > 
> > I think you forgot to attach the patch?
> 
> Dooh. Please find a new version attached.

The general idea of this looks good to me.  I've left some detailed
review comments below, and IMO we should test it against my reproducer
(especially since this preinst patch needs to end up in bullseye).

> > I managed to reproduce the reported bug by taking Neil's full package
> > list, mangling it to roughly make sense on buster, installing all of
> > that, and then doing "apt upgrade && apt full-upgrade" (my own habit is
> > just to do "apt full-upgrade", but in this case the initial "apt
> > upgrade" is crucial).  I'm now trying to more or less bisect the package
> > list to find something rather more minimal; this is a slow process, but
> > no roadblocks so far, and I'll let you know when I have something.
> 
> Thanks a lot for your help.

OK, it took much longer than I expected because I wasn't able to do it
by just bisecting the package list, but here's a reproducer.  I ran this
in a fresh container produced by "lxc launch images:debian/buster"; I
expect other container tools can be made to exhibit this too, though it
may be sensitive to exactly which packages are in the base image.

  # apt update && apt -y install gimp libc6-dev postgresql whiptail
  # cat >/etc/apt/sources.list <<EOF
  deb http://deb.debian.org/debian bullseye main
  deb http://security.debian.org/debian-security bullseye-security main
  # apt update && apt -y upgrade && apt -y dist-upgrade

Removing any of those initial packages, or even disabling installation
of Recommends, seems to evade the bug.  I don't fully understand why
this particular package selection has this effect on apt's ordering, and
it's certainly possible that it can be pared down further, but this
seemed a reasonable place to stop.  To test a fixed preinst, obviously
the new libc6 can't just be installed using dpkg without invalidating
the test, but adding another source to sources.list before starting the
upgrade should work fine.

> diff --git a/debian/debhelper.in/libc.preinst b/debian/debhelper.in/libc.preinst
> index d679db4f..e7808a44 100644
> --- a/debian/debhelper.in/libc.preinst
> +++ b/debian/debhelper.in/libc.preinst
> @@ -21,23 +21,22 @@ kfreebsd_compare_versions () {
>  
>  if [ "$type" != abort-upgrade -a -z "$DPKG_ROOT" ]
>  then
> -    # Load debconf module if available and usable
> +    # Check if the debconf module is available and usable

I'd suggest initializing "USE_DEBCONF=" here to avoid potential
weirdness in case somebody happens to have that variable set in their
environment for some reason.

>      if [ -f /usr/share/debconf/confmodule ]; then
>          # cdebconf has a working fallback mechanism in case dialog
>          # is not usable, so do not try to do anything smart here
>          if [ "$DEBCONF_USE_CDEBCONF" ] ; then
> -            . /usr/share/debconf/confmodule
>              USE_DEBCONF=1
>          # debconf requires perl
>          elif perl -e "" 2>/dev/null ; then
> -            . /usr/share/debconf/confmodule
>              # Check that the selected frontend will work
>              if [ -n "$DEBIAN_FRONTEND" ] ; then
>                  frontend="$DEBIAN_FRONTEND"
>              else
> -                db_version 2.0
> -                db_get debconf/frontend || RET="Dialog"
> -                frontend="$RET"
> +                # Query the frontend without first sourcing the confmodule to avoid
> +                # loosing control of the tty. This snipped must not be copied blindly.

s/loosing/losing/, and s/snipped/snippet/.

> +                frontend="$(echo 'GET debconf/frontend' | debconf-communicate | sed '/^0 /!d;s/^0 //')"
> +                frontend="${frontend:-Dialog}"
>              fi
>              frontend=`echo $frontend | tr '[:upper:]' '[:lower:]'`
>              case "$frontend" in
> @@ -61,6 +60,11 @@ then
>          fi
>      fi
>  
> +    # Load debconf module if available and usable
> +    if [ "$USE_DEBCONF" ]

This needs a "; then".

Thanks,

-- 
Colin Watson (he/him)                              [cjwatson@debian.org]


Reply to: