Here's a typescript demo'ing the problem... Script started on Thu Dec 22 00:34:22 2005 Using ssh-agent pid 6267 # cd /etc/kernel # ls total 8 4 postinst.d/ 4 postrm.d/ # mv postinst.d postinst.d-off # mv postrm.d postrm.d-off # ed /etc/kernel-img.conf 183 $p #postrm_hook = /boot/grub/kernel_grub_rm.sh s/#//p postrm_hook = /boot/grub/kernel_grub_rm.sh - #postinst_hook = /boot/grub/kernel_grub_conf.sh s/#//p postinst_hook = /boot/grub/kernel_grub_conf.sh 1,$p # Kernel Image management overrides # See kernel-img.conf(5) for details do_symlinks = Yes postinst_hook = /boot/grub/kernel_grub_conf.sh postrm_hook = /boot/grub/kernel_grub_rm.sh w 181 q # cd /usr/projects/think-kernels # dpkg --purge linux-image-2.6.15-rc5 (Reading database ... 120763 files and directories currently installed.) Removing linux-image-2.6.15-rc5 ... dpkg: error processing linux-image-2.6.15-rc5 (--purge): subprocess post-removal script returned error exit status 128 Errors were encountered while processing: linux-image-2.6.15-rc5 # dpkg --install linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb Selecting previously deselected package linux-image-2.6.15-rc5. (Reading database ... 120119 files and directories currently installed.) Preparing to replace linux-image-2.6.15-rc5 tytso.IDE.1 (using linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb) ... Unpacking replacement linux-image-2.6.15-rc5 ... dpkg: warning - old post-removal script returned error exit status 128 dpkg - trying script from the new package instead ... dpkg: error processing linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb (--install): subprocess new post-removal script returned error exit status 128 dpkg: error while cleaning up: subprocess post-removal script returned error exit status 128 Errors were encountered while processing: linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb # dpkg --purge linux-image-2.6.15-rc5 dpkg: error processing linux-image-2.6.15-rc5 (--purge): Package is in a very bad inconsistent state - you should reinstall it before attempting a removal. Errors were encountered while processing: linux-image-2.6.15-rc5 # dpkg --install linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb Selecting previously deselected package linux-image-2.6.15-rc5. (Reading database ... 120119 files and directories currently installed.) Preparing to replace linux-image-2.6.15-rc5 tytso.IDE.1 (using linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb) ... Unpacking replacement linux-image-2.6.15-rc5 ... Setting up linux-image-2.6.15-rc5 (tytso.IDE.1) ... Not updating image symbolic links since we are being updated/reinstalled (tytso.IDE.1 was configured last, according to dpkg)
# dpkg --purge linux-image-2.6.15-rc5 (Reading database ... 120763 files and directories currently installed.) Removing linux-image-2.6.15-rc5 ... Purging configuration files for linux-image-2.6.15-rc5 ... rmdir: /lib/modules/2.6.15-rc5: Directory not empty dpkg: error processing linux-image-2.6.15-rc5 (--purge): subprocess post-removal script returned error exit status 128 Errors were encountered while processing: linux-image-2.6.15-rc5 # ed /etc/kernel-image.conf /etc/kernel-image.conf: No such file or directory q # ed /etc/kernel-img.conf 181 $-1p postinst_hook = /boot/grub/kernel_grub_conf.sh s/^/#/p #postinst_hook = /boot/grub/kernel_grub_conf.sh postrm_hook = /boot/grub/kernel_grub_rm.sh s/^/#/p #postrm_hook = /boot/grub/kernel_grub_rm.sh 1,$p # Kernel Image management overrides # See kernel-img.conf(5) for details do_symlinks = Yes #postinst_hook = /boot/grub/kernel_grub_conf.sh #postrm_hook = /boot/grub/kernel_grub_rm.sh w 183 q # ls /lib/modules/2.6.15-rc5 total 4 4 modules.ofmap # /bin/rm -rf /lib/modules/2.6.15-rc5 # dpkg --install linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb Selecting previously deselected package linux-image-2.6.15-rc5. (Reading database ... 120119 files and directories currently installed.) Unpacking linux-image-2.6.15-rc5 (from linux-image-2.6.15-rc5_tytso.IDE.1_i386.deb) ... Setting up linux-image-2.6.15-rc5 (tytso.IDE.1) ... # dpkg --purge linux-image-2.6.15-rc5 (Reading database ... 120763 files and directories currently installed.) Removing linux-image-2.6.15-rc5 ... The link /vmlinuz is a damaged link Removing symbolic link vmlinuz Unless you used the optional flag in lilo, you may need to re-run lilo Purging configuration files for linux-image-2.6.15-rc5 ... rmdir: /lib/modules/2.6.15-rc5: Directory not empty dpkg - warning: while removing linux-image-2.6.15-rc5, directory `/lib/modules/2.6.15-rc5' not empty so not removed. # exit Script done on Thu Dec 22 00:38:35 2005