Wednesday, October 19, 2011

Ubuntu Oneiric (11.10) DPKG error removing old Linux kernel

I stumbled into another trouble removing my obsolete packages after upgrading into Ubuntu Oneiric 11.10 with Linux kernel 3.00-12. The problem is with removing the old 64bit kernel 2.6.35-24. The Debian package name is 2.6.35-24. The error I got is following:
[13:41:34] user@machin:[/var/lib/dpkg/info]$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages will be REMOVED:
  linux-image-2.6.35-24-generic
0 upgraded, 0 newly installed, 1 to remove and 31 not upgraded.
1 not fully installed or removed.
After this operation, 139 MB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 248250 files and directories currently installed.)
Removing linux-image-2.6.35-24-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 2.6.35-24-generic /boot/vmlinuz-2.6.35-24-generic
update-initramfs: Deleting /boot/initrd.img-2.6.35-24-generic
run-parts: executing /etc/kernel/postrm.d/zz-extlinux 2.6.35-24-generic /boot/vmlinuz-2.6.35-24-generic
P: Checking for EXTLINUX directory... found.
P: Writing config for /boot/vmlinuz-3.0.0-12-generic...
E: /usr/share/syslinux/debian/extlinux: No such file or directory
run-parts: /etc/kernel/postrm.d/zz-extlinux exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-2.6.35-24-generic.postrm line 328.
dpkg: error processing linux-image-2.6.35-24-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-2.6.35-24-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
The highlighted lines told me the error is caused by the postrm script called zz-extlinux located in /etc/kernel/postrm.d/. I don't know how I managed to have extlinux installed on my system. If I am not mistaken booting is still managed by grub-2. So, I decided to remove both extlinux and linux-image-2.6.35-24-generic. But, since my DPKG is already going crazy removing linux-image-2.6.35-24-generic and failing on zz-extlinux, I have to remove the old Linux image first. I quickly patched the zz-extlinux script with an "exit 0" at top followed by an "sudo apt-get -f install". One could also make it non-executable as following as a solution, followe:
sudo chmod -x /etc/kernel/postrm.d/zz-extlinux; sudo apt-get -f install
This solved my problem removing the Linux image. Now, I guess one can also remove extlinux considering Grub-2 is the bootloader.
sudo apt-get remove --purge extlinux

0 comments:

Post a Comment