Bug#499270: initramfs-tools: postrm.d/update-initramfs breaks removal of old kernel
Package: initramfs-tools
Version: 0.92k
Severity: serious
Justification: forbid removal of other packages
Hi,
I upgraded initramfs-tools then I tried to remove an old kernel package
(package from the Debian Kernel Team repo). I got an error:
eyak:/home/vdanjean# dpkg --purge linux-image-2.6.27-rc3-amd64
(Lecture de la base de données... 192887 fichiers et répertoires déjà installés.)
Suppression de linux-image-2.6.27-rc3-amd64 ...
Purge des fichiers de configuration de linux-image-2.6.27-rc3-amd64 ...
Running postrm hook script /usr/sbin/update-grub.
Updating /boot/grub/grub.cfg ...
Found Debian background: debian-blueish-wallpaper-640x480.png
Found linux image: /boot/vmlinuz-2.6.27-rc6-amd64
Found initrd image: /boot/initrd.img-2.6.27-rc6-amd64
Found linux image: /boot/vmlinuz-2.6.27-rc5-amd64
Found initrd image: /boot/initrd.img-2.6.27-rc5-amd64
Found linux image: /boot/vmlinuz-2.6.27-rc4-amd64
Found initrd image: /boot/initrd.img-2.6.27-rc4-amd64
Found linux image: /boot/vmlinuz-2.6.26-1-amd64
Found initrd image: /boot/initrd.img-2.6.26-1-amd64
done
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/update-initramfs
Cannot delete /boot/initrd.img-2.6.27-rc3-amd64, doesn't exist.
run-parts: /etc/kernel/postrm.d/update-initramfs exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-2.6.27-rc3-amd64.postrm line 331.
dpkg*: erreur de traitement de linux-image-2.6.27-rc3-amd64 (--purge)*:
le sous-processus post-removal script a retourné une erreur de sortie d'état 2
Des erreurs ont été rencontrées pendant l'exécution*:
linux-image-2.6.27-rc3-amd64
eyak:/home/vdanjean#
This is due to the fact that:
* linux-image-* postrm script removes /boot/initrd.img-... files
Even if it should not, you cannot change already installed postrm files
of all (locally or official) kernel debian package. This is why I report
this bug against initramfs-tool and not linux-2.6
* linux-image-* postrm script calls /etc/kernel/postrm.d/update-initramfs
(with the help of run-parts)
* /etc/kernel/postrm.d/update-initramfs runs "update-initramfs -d -k $KVER"
that returns an error (even if "set -e" is not there, this is the last
command of this script):
eyak:/home/vdanjean# update-initramfs -d -k 2.6.27-rc3-amd64 ; echo $?
Cannot delete /boot/initrd.img-2.6.27-rc3-amd64, doesn't exist.
1
eyak:/home/vdanjean#
So, somthing must be done. /etc/kernel/postrm.d/update-initramfs must not
return an error when /boot/initrd.img-* is not present (even if it is not
removed in the linux-image-* postrm: the sysadmin can have (re)moved it)
Regards,
Vincent
PS: as a workaround, I added "true" in /etc/kernel/postrm.d/update-initramfs
on the last line. But it not really a fix since I now ignore any update-initramfs
error.
Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages initramfs-tools depends on:
ii cpio 2.9-13 GNU cpio -- a program to manage ar
ii findutils 4.4.0-2 utilities for finding files--find,
ii klibc-utils 1.5.12-2 small utilities built with klibc f
ii module-init-tools 3.4-1 tools for managing Linux kernel mo
ii udev 0.125-6 /dev/ and hotplug management daemo
Versions of packages initramfs-tools recommends:
ii busybox 1:1.10.2-2 Tiny utilities for small and embed
initramfs-tools suggests no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
09-30-2008, 10:06 PM
Andres Salomon
Bug#499270: initramfs-tools: postrm.d/update-initramfs breaks removal of old kernel
Hi,
We can possibly distinguish between /etc/kernel/postinst.d getting called
from kernel-package context, and upstream debpkg context. debpkg calls
with the following:
test -d /etc/kernel/postinst.d && run-parts --arg="$version" /etc/kernel/postinst.d
Note that kernel-package's passes two arguments. In theory, we could have
an /etc/kernel/postinst.d/update-initramfs (or
/etc/kernel/postinst.d/initramfs-tools, if we want to match the package
name) that does:
# passing the kernel version is required
[ -z "$1" ] && exit 0
# kernel-package passes an extra arg; hack to not run under kernel-package
[ -z "$2" ] || exit 0