0

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?

user.dz
  • 48,105

1 Answers1

1

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
    
user.dz
  • 48,105