To remove an old kernel and free up disk space use "sudo apt-get remove linux-image-<old version>-generic"
However, if you tried to install a new kernel and installation failed due to lack of disk space you should follow these steps:
1. Move temporarily "initrd.img-<old version>-generic" and "vmlinuz-<old version>-generic" from boot to other location
2. "sudo dpkg --configure -a"
3. Move temporarily "initrd.img-<new version>-generic" and "vmlinuz-<new version>-generic" from boot to other location
4. sudo apt-get remove linux-image-<old version>-generic"
5. Move back "initrd.img-<new version>-generic" and "vmlinuz-<new version>-generic"
Replace <old version> and <new version> with proper kernel version.
To remove an old kernel and free up disk space use "sudo apt-get remove linux-image-<old version>-generic"
However, if you tried to install a new kernel and installation failed due to lack of disk space you should follow these steps:
1. Move temporarily "initrd.img-<old version>-generic" and "vmlinuz-<old version>-generic" from boot to other location
2. "sudo dpkg --configure -a"
3. Move temporarily "initrd.img-<new version>-generic" and "vmlinuz-<new version>-generic" from boot to other location
4. sudo apt-get remove linux-image-<old version>-generic"
5. Move back "initrd.img-<new version>-generic" and "vmlinuz-<new version>-generic"
Replace <old version> and <new version> with proper kernel version.