A broken installation of custom kernel gave some headache

I rolled my own 2.6.31 kernel for my Ubuntu Karmic, and used make-kpkg to make .deb packages for easy installation. For some reason, unknown at the moment, my .deb didn’t install properly. The kernel .deb package ended up in a iF state by dpkg. I didn’t have time to fix this when it occurred and planned on getting back to it later until I started getting annoying errors when update-manager wanted to update my system. It seemed that update-initramfs tried to reconfigure my broken kernel package and kept on failing. So I removed my custom kernel via dpkg –purge ‘name of package’ but still when updating my system update-initramfs got hung up on trying to configure my custom kernel, which no longer existed on my system. My first thought was to reinstall my custom kernel and then reinstall initramfs-tools but I got into this really stupid circular problem with my custom kernel not getting installed followed by update-initramfs failing ending up with dpkg setting a iF state on initramfs-tools package as well which again led to any kernel upgrade failing, or at least giving lots of complaints about that stupid kernel package of mine.
I finally got out of it by installing my custom kernel, which broke under installation, then do a update-initramfs -d -k ‘my custom kernel’ followed by dpkg –purge ‘my custom kernel’ and everything got back to normal 🙂