Bug#791757: apt: /etc/kernel/postinst.d/apt-auto-removal: does not deal with Multi-Arch kernels
Package: apt
Version: 1.0.9.10
Severity: important
Tags: patch
I just had 4.0.0-1-amd64 autoremoved by apt and wondered why.
Looking at /etc/kernel/postinst.d/apt-auto-removal I see:
tglase@tglase:~ $ eval $(apt-config shell DPKG Dir::bin::dpkg/f)
tglase@tglase:~ $ test -n "$DPKG" || DPKG="/usr/bin/dpkg"
tglase@tglase:~ $ running_version="$(uname -r)"
tglase@tglase:~ $ list="$(${DPKG} -l | \
> awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]+\./ && $2 !~ /-dbg$/ { print $2 }' | \
> sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##')"
tglase@tglase:~ $ echo $running_version
4.0.0-2-amd64
tglase@tglase:~ $ echo $list
4.0.0-2-amd64:amd64
So, the architecture qualifier needs to be stripped from the
kernel versions in dpkg’s output for this to work at all.
This affects at least one release architecture now (i386 systems
with an amd64 kernel), since the Debian Linux maintainers removed
the -amd64 i386 kernel flavour, and is no longer just a debian-ports
problem.
The fix (which also fixes the minor problem of not detecting kernel
versions that are on hold) should be (mildly tested):
list=$(dpkg-query -Wf '${db:Status-Abbrev} ${Package}\n' | sed -nre '/-dbg$/d' -e '/^[hi]i +(linux|kfreebsd|gnumach)-image-([0-9]+\.)/s//\2/p')
No idea whether you have to sort the output of that (ask Guillem).
-- Package-specific info:
-- (/etc/apt/preferences present, but not submitted) --
-- (/etc/apt/sources.list present, but not submitted) --
-- System Information:
Debian Release: stretch/sid
APT prefers unreleased
APT policy: (500, 'unreleased'), (500, 'buildd-unstable'), (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: i386, amd64
Kernel: Linux 4.0.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)
Versions of packages apt depends on:
ii debian-archive-keyring 2014.3
ii gnupg 1.4.19-3
ii libapt-pkg4.12 1.0.9.10
ii libc6 2.19-18
ii libgcc1 1:5.1.1-13
ii libstdc++6 5.1.1-13
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none>
pn aptitude | synaptic | wajig <none>
ii dpkg-dev 1.18.1
ii python-apt 1.0.0~beta3
-- no debconf information
Reply to: