Subject: aptitude: DEBIAN_FRONTEND does not affect the debconf invoked by "aptitude

From: "Karl O. Pinc" <[email-masked]>
Date: Thu, 13 Aug 2015 11:04:48 -0500

Package: aptitude
Version: 0.6.11-1+b1
Severity: normal

Hi,

export DEBIAN_FRONTEND=noninteractive
aptitude --quiet=2 update
aptitude --quiet=2 -o Dir::Etc::sourcelist=$tmpsources -y safe-upgrade

Results in an interactive debconf session on jessie.  This was not
the case on wheezy.  (Assuming of course the safe-upgrade results
in a change that invokes debconf.)

Debconf version: 1.5.56

$ debconf-show debconf
debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied
  debconf-apt-progress/info:
* debconf/frontend: Readline
  debconf-apt-progress/title:
  debconf-apt-progress/preparing:
  debconf-apt-progress/media-change:
* debconf/priority: medium

-- Package-specific info:
Terminal: xterm
$DISPLAY not set.
which aptitude: /usr/bin/aptitude

aptitude version information:
aptitude 0.6.11 compiled at Nov  8 2014 13:25:38
Compiler: g++ 4.9.1
Compiled against:
  apt version 4.12.0
  NCurses version 5.9
  libsigc++ version: 2.4.0
  Gtk+ support disabled.
  Qt support disabled.

Current library versions:
  NCurses version: ncurses 5.9.20140913
  cwidget version: 0.5.17
  Apt version: 4.12.0

aptitude linkage:
	linux-gate.so.1 (0xb777b000)
	libapt-pkg.so.4.12 => /usr/lib/i386-linux-gnu/libapt-pkg.so.4.12 (0xb71e4000)
	libncursesw.so.5 => /lib/i386-linux-gnu/libncursesw.so.5 (0xb71a8000)
	libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xb7184000)
	libsigc-2.0.so.0 => /usr/lib/i386-linux-gnu/libsigc-2.0.so.0 (0xb717d000)
	libcwidget.so.3 => /usr/lib/i386-linux-gnu/libcwidget.so.3 (0xb7079000)
	libsqlite3.so.0 => /usr/lib/i386-linux-gnu/libsqlite3.so.0 (0xb6fa0000)
	libboost_iostreams.so.1.55.0 => /usr/lib/i386-linux-gnu/libboost_iostreams.so.1.55.0 (0xb6f88000)
	libxapian.so.22 => /usr/lib/sse2/libxapian.so.22 (0xb6d80000)
	libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb6d64000)
	libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6c72000)
	libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb6c2c000)
	libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6c0f000)
	libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb6a64000)
	libutil.so.1 => /lib/i386-linux-gnu/i686/cmov/libutil.so.1 (0xb6a60000)
	libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb6a5b000)
	libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6a3e000)
	libbz2.so.1.0 => /lib/i386-linux-gnu/libbz2.so.1.0 (0xb6a2b000)
	liblzma.so.5 => /lib/i386-linux-gnu/liblzma.so.5 (0xb6a01000)
	librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xb69f8000)
	libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb69f2000)
	/lib/ld-linux.so.2 (0xb777e000)

-- System Information:
Debian Release: 8.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/1 CPU core)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages aptitude depends on:
ii  aptitude-common           0.6.11-1
ii  libapt-pkg4.12            1.0.9.8
ii  libboost-iostreams1.55.0  1.55.0+dfsg-3
ii  libc6                     2.19-18
ii  libcwidget3               0.5.17-2
ii  libgcc1                   1:4.9.2-10
ii  libncursesw5              5.9+20140913-1+b1
ii  libsigc++-2.0-0c2a        2.4.0-1
ii  libsqlite3-0              3.8.7.1-1+deb8u1
ii  libstdc++6                4.9.2-10
ii  libtinfo5                 5.9+20140913-1+b1
ii  libxapian22               1.2.19-1

Versions of packages aptitude recommends:
ii  aptitude-doc-en [aptitude-doc]  0.6.11-1
ii  libparse-debianchangelog-perl   1.2.0-1.1
ii  sensible-utils                  0.0.9

Versions of packages aptitude suggests:
ii  apt-xapian-index  0.47
pn  debtags           <none>
ii  tasksel           3.31+deb8u1

-- no debconf information

---

From: "Manuel A. Fernandez Montecelo" <[email-masked]>
Date: Sun, 6 Sep 2015 16:15:56 +0100

Control: tags -1 + moreinfo

Hi Karl,

>* debconf/priority: medium

As far as I know, aptitude doesn't have any code handling this variable
or debconf directly.  Why do you think that it is a problem in aptitude?

Also, what does happen if you use apt-get instead?

Cheers.
-- 
Manuel A. Fernandez Montecelo <[email-masked]>

---

From: "Karl O. Pinc" <[email-masked]>
Date: Sun, 6 Sep 2015 14:12:15 -0500

Hi Manual,

On Sun, 6 Sep 2015 16:15:56 +0100

> >debconf: DbDriver "passwords" warning: could not
> >open /var/cache/debconf/passwords.dat: Permission denied
> As far as I know, aptitude doesn't have any code handling this
> variable or debconf directly.  Why do you think that it is a problem
> in aptitude?

Thanks for the reply.

I don't know that it's a problem in aptitude (or what
aptitude's code handles).  I reported the bug to aptitude
because that the only code path I know for sure exhibits
the bug.

I figured you guys would have a better idea of what
the source of the problem is than I do.  Feel free
to reassign the bug to another package that is more
appropriate.

> Also, what does happen if you use apt-get instead?

I don't know.  It's not clear to me how to create
a test environment to reproduce the problem.  It requires
that an installed package get an update put into a repo
and that the update makes changes to a user-modifed
config file (right?) so that debconf is invoked when 
the update is installed.

I'm not apt-savvy enough just now to be able to re-create the
problem on my own.  I'd be willing to try to reproduce
the problem with apt-get but I'd need some help.  I
haven't tried to research the problem but, offhand,
I couldn't even give you a list of steps that would
reach the goal.  My guess would be I'd have to learn
how to create a .deb package, and maybe an apt repo.

My hope was that by reporting the problem somebody
with experience would magically step in and
resolve the issue.  :-)  Please advise.

Regards,

Karl <[email-masked]>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein

---

From: "Manuel A. Fernandez Montecelo" <[email-masked]>
Date: Mon, 7 Sep 2015 22:23:16 +0100

Hello Karl,

>to reassign the bug to another package that is more

I never used that feature of debconf, so I am not familiar at all with
it, sorry.

>config file (right?) so that debconf is invoked when

Perhaps it also work installing some package that you don't need, but it
is harmless, and know for sure that uses debconf?

>resolve the issue.  :-)  Please advise.

I could try to reproduce it, but as I said above, I never used it so I
don't know how it would look like, and even then I wouldn't know if it's
the problem that you observed.

If you cannot test with the suggestion above, I think that it's better
to reassign to debconf package itself, let me know if you want me to do
this.

Cheers.

---

From: "Karl O. Pinc" <[email-masked]>
Date: Tue, 8 Sep 2015 21:25:42 -0500

Hi Manual,

On Mon, 7 Sep 2015 22:23:16 +0100
"Manuel A. Fernandez Montecelo" <[email-masked]> wrote:

> Perhaps it also work installing some package that you don't need, but
> it is harmless, and know for sure that uses debconf?

I don't think that installing is going to reproduce the
problem -- it's on upgrade that debconf really wants
to ask questions when a new config is incompatible with
a user-modified config.

Per a suggestion on IRC #debian I tried (because I saw
the problem with apache2):

dpkg-i \
 /var/cache/apt/archives/apache2_2.4.10-10+deb8u1_i386.deb \
 /var/cache/apt/archives/apache2-bin_2.4.10-10+deb8u1_i386.deb \
 /var/cache/apt/archives ^M/apache2-data_2.4.10-10+deb8u1_all.deb

I believe this would get me back to the version which, on upgrade,
I saw the problem.  But I could not reproduce the problem.

My current apache2 version is: 2.4.10-10+deb8u3

Note that the apache2 changelog says:

apache2 (2.4.10-10+deb8u2) jessie; urgency=medium

  [ Stefan Fritsch ]
  * Fix upgrade logic: When upgrading from wheezy with apache2.2-common
    but without apache2 installed to jessie, part of the conffile
  handling logic would not run, causing outdated conffile content to be
  kept. This is part of the solution for bug #794933. The other part
  will be included in the upgrade to Debian 9 (stretch).
<snip>
 -- Stefan Fritsch <[email-masked]>  Thu, 27 Aug 2015 19:52:37 +0200

Seems to me that whatever fix was made to the upgrade logic
is what triggered the problem, but that's a guess.

> to reassign to debconf package itself, let me know if you want me to
> do this.

Since I'm kinda stuck reproducing the problem I think you'd
better reassign this to the debconf package.  Maybe they'll
be able to help.

For the sake of completeness I've found the log output
which prompted this report.  It
dates to: Sun,  2 Aug 2015 06:26:00 -0500 (CDT)

(Now you know what the problem looks like.  :-)

(FYI: Although aptitude is being invoked with --quiet=2
it's outputting it's dynamic progress report.  A change
from Wheezy and something I should put into another
bug report.)

------------------------<snip>-------------------------
The following packages will be upgraded:
  apache2 apache2-bin apache2-data apache2-mpm-prefork apache2-utils 
  libicu52 
6 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 8,384 kB of archives. After unpacking 7,168 B will be freed.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 86260 files and directories currently installed.)
Preparing to
unpack .../apache2-mpm-prefork_2.4.10-10+deb8u1_amd64.deb ... Unpacking
apache2-mpm-prefork (2.4.10-10+deb8u1) over (2.4.10-10) ... Preparing
to unpack .../apache2_2.4.10-10+deb8u1_amd64.deb ... Unpacking apache2
(2.4.10-10+deb8u1) over (2.4.10-10) ... Preparing to
unpack .../apache2-bin_2.4.10-10+deb8u1_amd64.deb ... Unpacking
apache2-bin (2.4.10-10+deb8u1) over (2.4.10-10) ... Preparing to
unpack .../apache2-utils_2.4.10-10+deb8u1_amd64.deb ... Unpacking
apache2-utils (2.4.10-10+deb8u1) over (2.4.10-10) ... Preparing to
unpack .../apache2-data_2.4.10-10+deb8u1_all.deb ... Unpacking
apache2-data (2.4.10-10+deb8u1) over (2.4.10-10) ... Preparing to
unpack .../libicu52_52.1-8+deb8u2_amd64.deb ... Unpacking
libicu52:amd64 (52.1-8+deb8u2) over (52.1-8) ... Processing triggers
for systemd (215-17+deb8u1) ... Processing triggers for man-db
(2.7.0.2-5) ... Setting up apache2-bin (2.4.10-10+deb8u1) ...
Setting up apache2-utils (2.4.10-10+deb8u1) ...
Setting up apache2-data (2.4.10-10+deb8u1) ...
Setting up apache2 (2.4.10-10+deb8u1) ...

Configuration file '/etc/apache2/ports.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.  
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** ports.conf (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing
package apache2 (--configure): EOF on stdin at conffile prompt
dpkg: dependency problems prevent configuration of apache2-mpm-prefork:
 apache2-mpm-prefork depends on apache2 (= 2.4.10-10+deb8u1); however:
  Package apache2 is not configured yet.

dpkg: error processing package apache2-mpm-prefork (--configure):
 dependency problems - leaving unconfigured
Setting up libicu52:amd64 (52.1-8+deb8u2) ...
Processing triggers for libc-bin (2.19-18) ...
Errors were encountered while processing:
 apache2
 apache2-mpm-prefork
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to perform requested operation on package.  Trying to recover:
Setting up apache2 (2.4.10-10+deb8u1) ...

Configuration file '/etc/apache2/ports.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.  
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** ports.conf (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing
package apache2 (--configure): EOF on stdin at conffile prompt
dpkg: dependency problems prevent configuration of apache2-mpm-prefork:
 apache2-mpm-prefork depends on apache2 (= 2.4.10-10+deb8u1); however:
  Package apache2 is not configured yet.

dpkg: error processing package apache2-mpm-prefork (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 apache2
 apache2-mpm-prefork
------------------------<snip>-------------------------

Regards,

Karl <[email-masked]>

---

From: "Manuel A. Fernandez Montecelo" <[email-masked]>
Date: Wed, 9 Sep 2015 13:26:26 +0100

Control: reassign -1 debconf

Note for debconf maintainers: I am reassigning because this doesn't
seem to have anything to do with aptitude, so hopefully you will know
if this is a matter concerning debconf or hopefully could point in the
right direction.

> to ask questions when a new config is incompatible with

I see, I thought that it was happening with any debconf question,
that's why I thuoght that installing any new package would do.

> better reassign this to the debconf package.  Maybe they'll

As I said above, reassigned now.

> from Wheezy and something I should put into another

"Reading database" is a message from dpkg, not aptitude, and although
in some cases aptitude calls dpkg directly, I think that in this case
this call is made from apt (so the chain is aptitude->apt->dpkg).  We
do not have facilities to pass "verboseness/quietness" down the chain.

So to report this, dpkg is a better place, I think; I suppose that it
would better not print the progress when the terminal cannot handle
updating lines.

Cheers.