This seems to work for me. I changed some things based on feedback from Robert Euhus (and a little bit more). I don't see a problem in updating the kernel list in case a linux-image-extra package is being removed; the list does not change then, but this updates also, when a linux-image package is being removed, when it may be necessary to update the list.
** Attachment added: "/etc/kernel/postinst.d/apt-auto-removal (version 3 from Jarnos Suni)" https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1440608/+attachment/4552511/+files/apt-auto-removal -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1440608 Title: /etc/kernel/postinst.d/apt-auto-removal wants to remove all kernels except the latest one To manage notifications about this bug go to: https://bugs.launchpad.net/hundredpapercuts/+bug/1440608/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs