Howto uninstall a kernel properly?

Because I had some problems with recent hw, drivers, I decided to see if it improves with the latest kernel.
As this does not solve the problem either, I uninstalled the kernel again using kde system settings - kernel.
The kernel is uninstalled, but grub still lists it and it also takes this uninstalled kernel as the default startup option (also after a manual grub update).
Afterwards I also followed these instructions,
All commands indicate that the kernel is no longer installed, but still it is listed in the grub boot menu.

So apparently the uninstall instructions and the system settings uninstall script is not complete, as they don’t take care of the grub menu.

How can I remove these lines in the grub menu from the uninstalled kernel, in a way that the command sudo update-grub creates the grub menu correctly, without the uninstalled kernel lines, and without making the uninstalled kernel the default boot option ?

What is the output of the command… :arrow_down:

ls -l /boot

… please?

Also, what kernel(s) do you wish to keep and what kernels are supposed to have been uninstalled?

I uninstalled kernel 5.10-x86, but in the mean time I re-installed it again in order to have a normal functioning grub boot menu.
I’ll uninstall it again, and post the output of ls -l /boot again.

ls -l /boot
total 143452
-rw-r--r-- 1 root root    40960 24 nov 17:47 amd-ucode.img
drwx------ 3 root root     4096  1 jan  1970 efi
drwxr-xr-x 5 root root     4096 29 nov 15:30 grub
-rw-r--r-- 1 root root 31772999 29 nov 15:29 initramfs-5.10-x86_64-fallback.img
-rw-r--r-- 1 root root  9776450 29 nov 15:29 initramfs-5.10-x86_64.img
-rw-r--r-- 1 root root 31254102 29 nov 15:29 initramfs-5.8-x86_64-fallback.img
-rw-r--r-- 1 root root  9714859 29 nov 15:29 initramfs-5.8-x86_64.img
-rw-r--r-- 1 root root 31341165 29 nov 15:29 initramfs-5.9-x86_64-fallback.img
-rw-r--r-- 1 root root  9719131 29 nov 15:29 initramfs-5.9-x86_64.img
-rw-r--r-- 1 root root       38 23 nov 01:48 linux510-x86_64.kver
-rw-r--r-- 1 root root       21  1 nov 15:09 linux58-x86_64.kver
-rw-r--r-- 1 root root       21 28 nov 10:08 linux59-x86_64.kver
drwxr-xr-x 2 root root     4096  1 okt 15:56 memtest86+
-rw-r--r-- 1 root root  8289216 29 nov 15:29 vmlinuz-5.10-x86_64
-rw-r--r-- 1 root root  6804736  5 nov 22:28 vmlinuz-5.8-x86_64
-rw-r--r-- 1 root root  8138944 28 nov 23:37 vmlinuz-5.9-x86_64

I have edited your post to make the output more legible. Please put three backticks (```) above and below the terminal output in your next post. :wink:

sudo mhwd-kernel -r linux510
sudo mkinitcpio -P

OK, thx, that makes it more clear indeed.

I uninstalled it again, and now it worked correctly, the lines have been removed from the grub boot menu.
In ls -l /boot, all 510 kernel items are no longer there either.

yesterday, I saw in the updates, that there were kernel updates, perhaps the uninstall script has been corrected in the latest update.

Anyway, thanks for your suggestion on listing the /boot directory, it made me uninstall the kernel again, and got me a correct working grub menu again.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.