After updating my Ubuntu distribution from 18.04 to 20.04 I'm unable to clean up old kernels. I'm also blocked from running any update or cleanup because of that.
Currently I'm running my system on the latest stable 5.4 kernel.
While trying to clean up the old kernels I'm getting this messages:
foo@foo:~$ sudo apt-get --purge autoremove
[sudo] password for foo:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
linux-image-extra-4.4.0-105-generic linux-image-extra-4.4.0-86-generic
0 to upgrade, 0 to newly install, 2 to remove and 1536 not to upgrade.
3 not fully installed or removed.
After this operation, 305 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 230131 files and directories currently installed.)
Removing linux-image-extra-4.4.0-105-generic (4.4.0-105.128) ...
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-105-generic /boot/vmlinuz-4.4.0-105-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-105-generic
E: /usr/share/initramfs-tools/hooks/plymouth failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-105-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-105-generic (--remove):
installed linux-image-extra-4.4.0-105-generic package post-removal script subprocess returned error exit status 1
Removing linux-image-extra-4.4.0-86-generic (4.4.0-86.109) ...
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-86-generic /boot/vmlinuz-4.4.0-86-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-86-generic
E: /usr/share/initramfs-tools/hooks/plymouth failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-86-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-86-generic (--remove):
installed linux-image-extra-4.4.0-86-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
linux-image-extra-4.4.0-105-generic
linux-image-extra-4.4.0-86-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
I've also tried to reinstall/update initramfs-tools
but it also fails.
sudo dpkg -P
fails the same way