Score:0

unable to remove old kernels after upgrading to 20.4

cn flag

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

Mahler avatar
in flag
You might do clean installation of the 20.04 Focal Fossa.
user2091046 avatar
cn flag
I would prefer to try and fix it before doing a clean install
user535733 avatar
cn flag
`E: /usr/share/initramfs-tools/hooks/plymouth failed with return 1.` Check for the existence and contents of that directory. Check that you have enough storage to generate initramfs.
nobody avatar
gh flag
`sudo chmod -x /usr/share/initramfs-tools/hooks/plymouth` and remove your old kernels. Later you can give the executable flag back.
user2091046 avatar
cn flag
great, that worked, thanks! I think I understand what I did here by removing the exec flag, but by any chance can you could explain a bit more on what could have happened here?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.