I accidently seem to have deleted my kernel (not sure how I did it) but I noticed before I rebooted the machine and have tried to reinstall it. I just want to be sure I'm ok before I do a reboot. uname --kernel-release
gave (and still gives) 4.4.0-104-generic.
How I got in the situation:
I had no room on my boot folder to update so I removed the defunct image files
I can't find the exact command, but it was something like:
sudo apt-get remove linux-image-4.4.0.{6*, 7*, 8*, 9*, 101, 102, 103}
I'm not sure how, but after when I checked with
dpkg -l linux-image-\* | grep ii
the list was empty and the image 4.4.104 had been removed. I assume I must have made a typo in my previous command.
Steps to resolve
I have yet to reboot the machine, but I did
sudo apt-get install linux-image-4.4.0-104-generic
sudo apt-get install linux-image-4.4.0-108-generic
grub-set-default Ubuntu\,\ with\ Linux\ 4.4.0-108-generic
(sudo apt-get install linux-image-4.4.0-109-generic
resulted in a 503 error (see below))
dpkg -l linux-image-\* | grep ii
Now shows
ii linux-image-4.4.0-104-generic 4.4.0-104.127~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-108-generic 4.4.0-108.131~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
If this is sufficient I will reboot, but I would like to confirm that before I do.
Further issues:
When I try
sudo apt-get upgrade
or to install linux-image-4.4.0.109-generic
I get a list of errors along the lines of
Err http://security.ubuntu.com/ubuntu/ trusty-security/main libruby1.9.1 amd64 1.9.3.484-2ubuntu1.7
503 OUT OF DISK SPACE
And nothing gets upgraded.
purge-old-kernels
script to remove older kernels. – N0rbert Jan 10 '18 at 16:30