mvo5 / unattended-upgrades

Automatic installation of security upgrades on apt based systems
GNU General Public License v2.0
278 stars 78 forks source link

apt-listchanges sends a changelog mail per package updated upon Debian 10 #294

Closed Terae closed 3 years ago

Terae commented 3 years ago

In Debian 9, an unattended-upgrades run produced a unique apt-listchanges summary mail because the /usr/bin/apt-listchanges --apt script was called once during the update (DPkg::Pre-Install-Pkgs variable on the file /etc/apt/apt.conf.d/20listchanges).

The behavior is a little bit different in Debian 10: running unattended-upgrades makes the /usr/bin/apt-listchanges --apt script called once per package updated.

I wish unattended-upgrades to update all packages at the same time as before to not be spammed by apt-listchanges, is there any configuration parameter I missed?


You can reproduce the N-times called apt-listchanges test with the following files:

# Dockerfile

# Debian 9
#FROM debian:stretch
# Debian 10
FROM debian:buster

RUN apt-get update
RUN apt-get install -y apt-listchanges unattended-upgrades

COPY apt_script.sh /tmp/apt_script.sh
COPY 20listchanges /etc/apt/apt.conf.d/20listchanges
RUN chmod +x /tmp/apt_script.sh
# apt_script.sh

#!/bin/bash

echo "$0 script called at '$(date)' with $# args: '$*'" >> /tmp/apt-listchanges.log
# 20listchanges

DPkg::Pre-Install-Pkgs { "/tmp/apt_script.sh"; };
DPkg::Tools::Options::/usr/bin/apt-listchanges::Version "2";
DPkg::Tools::Options::/usr/bin/apt-listchanges::InfoFD "20";

Then, docker build -t apt-listchanges . and docker run -it apt-listchanges bash opens a shell, you can type unattended-upgrades -v and count the lines in /tmp/apt-listchanges.log (one line with debian:stretch, multiple lines with debian:buster)

julian-klode commented 3 years ago

You'll have to disable "minimal steps" so that dpkg hooks only run once. But this means that you might have to wait a long time when rebooting as it needs to finish installing all updates. See the config file for the concrete option.

Terae commented 3 years ago

Oh thank you very much, it works like a charm! To resolve the issue, I changed a parameter in the file /etc/apt/apt.conf.d/50unattended-upgrades:

Unattended-Upgrade::MinimalSteps "false";