Control: retitle -1 apt-listbugs: automatic pinning is not added under 
unattended-upgrades

Refocusing this bug report on the pinning issue.

On Fri, 2022-10-07 at 00:26 +0200, Francesco Poli wrote:

> Specifically, when apt-listbugs sees that its stdout is not a terminal,
> it automatically assume the following options: --quiet --force-pin
> --force-no
> This automatic behavior change should ensure that all buggy packages
> (of the upgrade/installation that is about to happen) are pinned,
> without any interactive prompt.

I tested this again and it definitely is not happening, see below.

Reading the code, it seems the issue is that the save() function is
only ever called by the view() function when the answer is y/n but
never when the answer is p which is set by --force-pin.

> I assume unattended-upgrades runs the package manager without connecting
> stdout to a terminal...

I think that is correct given the output below.

> More investigation is needed in order to figure out why you didn't see
> the pinning added.

Provided some debugging at the end of this mail.

> I assume unattended-upgrades runs the package manager with root
> privileges...

Correct.

> Did you configure unattended-upgrades to attempt the upgrade twice in a
> row (as suggested in the FAQ[^note])?

I hadn't read the FAQ, thanks for the pointer. In this case the pinning
issue would prevent it from working anyway.

> I admit that I am not familiar with unattended-upgrades, hence I am not
> sure how to configure it for the twice-in-a-row upgrade.
> I hope it's easy enough.

I can only configure unattended-upgrades to run more often, there is no
option to ignore failure of a particular upgrade and retry it.

> I think this cannot work, unfortunately.
> 
> In order to know which packages are going to be upgraded (or newly
> installed!), apt-listbugs must receive information from the upgrade (or
> install) session of the package manager.

I see, that makes sense.

Here is the debugging for the pinning issue.

$ apt list --upgradable 
Listing... Done
libreadline-dev/testing,unstable 8.2-1 amd64 [upgradable from: 8.2~rc2-2]
libreadline8-dbgsym/testing-debug,unstable-debug 8.2-1 amd64 [upgradable from: 
8.2~rc2-2]
libreadline8/testing,unstable 8.2-1 amd64 [upgradable from: 8.2~rc2-2]

$ apt upgrade -s
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libreadline-dev libreadline8 libreadline8-dbgsym
3 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
Inst libreadline8-dbgsym [8.2~rc2-2] (8.2-1 Debian debug:testing-debug, Debian 
debug:unstable-debug [amd64]) []
Inst libreadline-dev [8.2~rc2-2] (8.2-1 Debian:testing, Debian:unstable 
[amd64]) []
Inst libreadline8 [8.2~rc2-2] (8.2-1 Debian:testing, Debian:unstable [amd64])
Conf libreadline8-dbgsym (8.2-1 Debian debug:testing-debug, Debian 
debug:unstable-debug [amd64])
Conf libreadline-dev (8.2-1 Debian:testing, Debian:unstable [amd64])
Conf libreadline8 (8.2-1 Debian:testing, Debian:unstable [amd64])

$ apt-listbugs list libreadline-dev libreadline8 libreadline8-dbgsym
Retrieving bug reports... Done
Parsing Found/Fixed information... Done
grave bugs of libreadline8 (-> ) <Outstanding>
 b1 - #1021062 - bash: non existent locale crashes bash
Summary:
 libreadline8(1 bug)

$ cat /etc/apt/preferences.d/apt-listbugs 
$

$ systemctl start apt-daily-upgrade.service

$ cat /etc/apt/preferences.d/apt-listbugs 
$

$ tail -n12 /var/log/unattended-upgrades/unattended-upgrades.log
2022-10-07 07:42:26,918 INFO Starting unattended upgrades script
2022-10-07 07:42:26,919 INFO Allowed origins are: 
origin=Debian,codename=bookworm,label=Debian, 
origin=Debian,codename=bookworm,label=Debian-Security, 
origin=Debian,codename=bookworm-security,label=Debian-Security, origin=Debian
2022-10-07 07:42:26,919 INFO Initial blacklist: 
2022-10-07 07:42:26,919 INFO Initial whitelist (not strict): 
2022-10-07 07:42:41,539 INFO Packages that will be upgraded: libreadline-dev 
libreadline8 libreadline8-dbgsym
2022-10-07 07:42:41,540 INFO Writing dpkg log to 
/var/log/unattended-upgrades/unattended-upgrades-dpkg.log
2022-10-07 07:42:45,879 ERROR Installing the upgrades failed!
2022-10-07 07:42:45,879 ERROR error message: installArchives() failed
2022-10-07 07:42:45,879 ERROR dpkg returned a error! See 
/var/log/unattended-upgrades/unattended-upgrades-dpkg.log for details
2022-10-07 07:42:46,439 INFO Package libreadline-dev is kept back because a 
related package is kept back or due to local apt_preferences(5).
2022-10-07 07:42:46,443 INFO Package libreadline8 is kept back because a 
related package is kept back or due to local apt_preferences(5).
2022-10-07 07:42:46,452 INFO Package libreadline8-dbgsym is kept back because a 
related package is kept back or due to local apt_preferences(5).

$ tail -n12 /var/log/unattended-upgrades/unattended-upgrades-dpkg.log
Log started: 2022-10-07  07:42:41
grave bugs of libreadline8 (8.2~rc2-2 → 8.2-1) <Outstanding>
 b1 - #1021062 - bash: non existent locale crashes bash
Summary:
 libreadline8(1 bug)
libreadline8 will be pinned. Restart APT session to enable
**********************************************************************
****** Exiting with an error in order to stop the installation. ******
**********************************************************************
E:Sub-process /usr/bin/apt-listbugs apt returned an error code (10), E:Failure 
running script /usr/bin/apt-listbugs apt
Log ended: 2022-10-07  07:42:45

$ sudo apt upgrade 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libreadline-dev libreadline8 libreadline8-dbgsym
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/693 kB of archives.
After this operation, 2,048 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Retrieving bug reports... Done
Parsing Found/Fixed information... Done
grave bugs of libreadline8 (8.2~rc2-2 -> 8.2-1) <Outstanding>
 b1 - #1021062 - bash: non existent locale crashes bash
Summary:
 libreadline8(1 bug)
Are you sure you want to install/upgrade the above packages? [Y/n/?/...] d b1
The following 1 bug will be dodged:
 b1
Are you sure? [Y/n] y
libreadline8 will be pinned. Restart APT session to enable
Are you sure you want to install/upgrade the above packages? [N/?/...] 
**********************************************************************
****** Exiting with an error in order to stop the installation. ******
**********************************************************************
E: Sub-process /usr/bin/apt-listbugs apt returned an error code (10)
E: Failure running script /usr/bin/apt-listbugs apt

$ sudo apt upgrade 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ cat /etc/apt/preferences.d/apt-listbugs 

Explanation: Pinned by apt-listbugs at 2022-10-07 07:57:06 +0800
Explanation:   #1021062: bash: non existent locale crashes bash
Package: libreadline8
Pin: version 8.2~rc2-2
Pin-Priority: 30000

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to