Hi,
this is probably rather an apt bug and apt-listbugs is only the culprit,
so feel free to reassign if you agree.
Symptom: Sometimes the BTS is slow and apt-listbugs stops in "Retrieving
bug reports...". Hitting Ctrl-C here results in:
| # apt install zsh
| Reading package lists... Done
| Building dependency tree
| Reading state information... Done
| Suggested packages:
| zsh-doc
| The following NEW packages will be installed:
| zsh
| 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
| Need to get 0 B/901 kB of archives.
| After this operation, 2501 kB of additional disk space will be used.
| Retrieving bug reports... 0%^CInterrupted
| Fail
| Error retrieving bug reports from the server with the following error message:
| E: exit
| It could be because your network is down, or because of broken proxy servers, or the BTS server itself is down. Check network configuration and try again
| Retry downloading bug information? [Y/n] n
| Continue the installation anyway? [y/N] y
| Retrieving bug reports... Done
| Parsing Found/Fixed information... Done
| E: Sub-process /usr/bin/apt-listbugs apt received signal 2.
| E: Failure running script /usr/bin/apt-listbugs apt
i.e. apt-listbugs asks if apt should continue to install bug apt fails
afterwards anyhow.
Steps to reproduce (as root):
# echo 127.0.0.1 bugs.debian.org >> /etc/hosts
# nc -l -p 80
# apt install zsh # or any other package not installed
Doing pkill -INT apt-listbugs instead of Ctrl-C works, but that means
opening a new root shell.
I tried debugging this the process tree and as far as I see Ctrl-C is
caught by the sh process running apt-listbugs.
I see two ways to solve this:
- Don't ask the questions in case apt-listbugs is killed by the parent
(and maybe print that one should kill apt-listbugs as a workaround).
- Get the shell started by apt to not catch the Ctrl-C.
I tried to do that but didn't find a way. apt set's the INT signal
handler to ignore before calling sh (apt-pkg/deb/dpkgpm.cc:427) but
dash gets the signal, still. I tried to trap '' INT in
apt.conf.d/10apt-listbugs but that didn't work out (APT_HOOK_INFO_FD
not set).
Reading https://unix.stackexchange.com/a/165715 there seems to be an
option to set the active process group, but I didn't find a way to
make it work.
The only related bug I found is #214141.
Cheers Jochen