Hi Colin,

On 2021-09-10 16:51, Colin Watson wrote:
> On Fri, Sep 10, 2021 at 04:02:06PM +0100, Neil Williams wrote:
> > This is related to #984533 - in my case, there was no effect on the 
> > initramfs.
> > 
> > I am attaching the section of the apt log. (gzipped)
> > I am also attaching the dpkg -l output for the package list (after upgrade).
> > 
> > The apt log includes the details of the --purge autoremove operation I 
> > completed
> > after a reboot, so those packages were also installed on buster too.
> > 
> > This was an upgrade from buster to bullseye.
> > apt upgrade worked fine (first part of the log).
> > 
> > When dist-upgrade started, I got:
> > 
> > Preparing to unpack .../92-libc6_2.31-13_amd64.deb ...
> > debconf: unable to initialize frontend: Dialog
> > debconf: (No usable dialog-like program is installed, so the dialog based 
> > frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm 
> > line 78.)
> > debconf: falling back to frontend: Readline
> > Checking for services that may need to be restarted...
> > Checking init scripts...
> > Do you want to upgrade glibc now?
> > 
> > Running services and programs that are using NSS need to be restarted,
> > otherwise they might not be able to do lookup or authentication any more.
> > The installation process is able to restart some services (such as ssh or
> > telnetd), but other programs cannot be restarted automatically.  One such
> > program that needs manual stopping and restart after the glibc upgrade by
> > yourself is xdm - because automatic restart might disconnect your active
> > X11 sessions.
> > 
> > This script detected the following installed services which must be
> > stopped before the upgrade: postgresql 
> > 
> > If you want to interrupt the upgrade now and continue later, please
> > answer No to the question below.
> > 
> > Do you want to upgrade glibc now? [Y/n] y
> > Y
> 
> The code in libc.preinst that attempts to fall back to text mode,
> introduced in 2.31-10, is clearly incorrect; apologies for not noticing
> this earlier.  It sources the debconf confmodule and then conditionally
> sets USE_DEBCONF; but since the debconf confmodule has already been
> sourced by this point, text mode won't work properly since standard
> input and output refer to the debconf frontend.  (In particular, reading
> from stdin can't work.)

Thanks for the fast analysis, and apologies for introducing that bug.

> The only way to fix what libc.preinst is currently trying to do would
> be:
> 
>  * Fetch the current debconf frontend *without* first sourcing the
>    confmodule, e.g. using something like "echo GET debconf/frontend |
>    debconf-communicate" which I *think* is safe as long as you haven't
>    sourced the confmodule yet;
> 
>  * Decide whether to use debconf based on this and other information;
> 
>  * Only source the confmodule if you've positively decided to use it.

debconf-communicate might be safe, but its manpage explicitly says it
should not be used in maintainer scripts. 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.

> But a simpler approach might be to update debconf in buster with the
> change from 1.5.76 to check whether whiptail/dialog is usable before
> trying to use it, and then remove at least some of this fragile and
> broken code from libc.preinst.  At the very least, USE_DEBCONF=1 must
> always be set if (and only if) the debconf confmodule has been sourced.

While it is probably a good idea to backport that change in buster to
limit to reduce the risk, we don't require people to upgrade to the
latest buster release before starting an upgrade.

On the other hand, given that bullseye has a fixed debconf, I fully
agree that we should drop that fragile code for bookworm.

> I'm currently seeing if I can construct a reduced reproduction recipe
> based on Neil's logs, since it evidently depends on exactly which order
> apt chooses to unpack things early on, and it would be very helpful to
> be able to test fixes properly.

Thanks, tell me if you need help on that.

Regards,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurel...@aurel32.net                 http://www.aurel32.net

Reply via email to