I have faced lately some cases where the asker had a APT removal operation stuck due some kernel script errors.

Sometimes is easy to fix the root cause.

But in some other rare cases, it is hard or long path to go with debugging. Specially with non boot-able system or only recovery shell available.

I will add some cases here:

I have already used a dirty solution as explained my answer below. I would ask for a cleaner workaround to manually remove a kernel package as DPKG do?


This is not a clean solution as it does not update the some generated kernel settings/files.(It skips all post-/pre- scripts & dpkg triggers)

  1. Check the installed files using

     dpkg -L linux-image-...
  2. Remove them manually

  3. Remove generated RAMDisk

    sudo rm /boot/initrd.img-...
  4. Backup /var/lib/dpkg/status them open it and change its status to deinstall

  5. Update grub menu

    sudo update-grub
  • 1
    At least one should delete the respective /boot/initrd.img-* file(s). – jarno Apr 4 '17 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.