How to remove old kernels from Ubuntu
This method should work for both Ubuntu server OS (instances) and desktops that we use.
Use case: Automatic or manual updates to the OS may result in multiple kernels installed in your system. This is usually alright, but it can become a problem if your the OS has a small /boot partition, and it runs out of space because of a large number of old kernels installed there.
You could follow these simple steps to delete the older kernels
1. Verify the kernel that is currently booted and is in use:
uname -r
4.4.0-79-generic
4.4.0-79-generic
Whatever you do, don't delete this kernel.
2. Finding out what kernels are currently installed in the system:
dpkg —list | grep linux-image
linux-image-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP linux-image-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP linux-image-4.4.0-77-generic 4.4.0-77.98 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP linux-image-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP linux-image-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
3. Deleting the kernels that you don't need using apt-get:
sudo apt-get purge linux-image-x.x.x-xx-generic
4. Updating Grub:
Although this should be done automatically, manually updating grub shouldn't hurt.
sudo update-grub2
5. Reboot the system
Hope this helps.
Comments
Post a Comment