Why there is an update-initramfs error when removing a kernel by dpkg? [duplicate]
Solution 1:
When purging a linux-image-extra package, post installation scripts are run, since the main linux-image package of that kernel release may be left remaining in system: The respective initrd.img will be altered not to contain the extra's stuff; its size will decrease as a result of this process. However, the old initrd.img file is not removed in "/boot" and the new one is created beside it in "/boot" during this process, so there is a risk of running out of space.
The fix could be to create the new initrg.img file in different partition before replacing the old one by it in update-initramfs
. So the update-initramfs
script should be fixed.
A workaround would be to remove the respective versioned /boot/initrd.img file before running dpkg --purge
for the linux-image-extra package. That could also be done by sudo update-initramfs -d -k 3.13.0-112-generic
in this case, as the kernel I was removing was "3.13.0-112-generic".