Deleted kernel still showing up in grub?

Hello,

I have a computer with Manjaro on which I installed multiple kernels in the past, namely:

5.10 LTS
5.15 LTS
5.16

Now, 5.16 ran out of support before I moved to a newer kernel and thus, I encountered some problems with it. I booted Manjaro from live usb and removed 5.16 using:

mhwd-kernel -r linux516

While the kernel was removed, it somehow still shows up in grub and now I have to manually select the 5.15 kernel in grub when booting.

Kernel 5.16 seems to be removed:

mhwd-kernel -li                   
Currently running: 5.15.74-3-MANJARO (linux515)
The following kernels are installed in your system:
   * linux510
   * linux515
pacman -Ss linux5 | grep installed
core/linux510 5.10.148-1 [installed]
core/linux515 5.15.74-3 [installed]
extra/linux510-nvidia 520.56.06-2 (linux510-extramodules) [installed]
extra/linux515-nvidia 520.56.06-3 (linux515-extramodules) [installed]

However, the grub entries for 5.16 still remain:

sudo update-grub                  
[sudo] password for wombat: 
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.16-x86_64
Found initrd image: /boot/amd-ucode.img /boot/initramfs-5.16-x86_64.img
Found initrd fallback image: /boot/initramfs-5.16-x86_64-fallback.img
fgrep: warning: fgrep is obsolescent; using grep -F
Found linux image: /boot/vmlinuz-5.15-x86_64
Found initrd image: /boot/amd-ucode.img /boot/initramfs-5.15-x86_64.img
Found initrd fallback image: /boot/initramfs-5.15-x86_64-fallback.img
fgrep: warning: fgrep is obsolescent; using grep -F
Found linux image: /boot/vmlinuz-5.10-x86_64
Found initrd image: /boot/amd-ucode.img /boot/initramfs-5.10-x86_64.img
Found initrd fallback image: /boot/initramfs-5.10-x86_64-fallback.img
fgrep: warning: fgrep is obsolescent; using grep -F
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found memtest86+ image: /boot/memtest86+/memtest.bin
/usr/bin/grub-probe: warning: unknown device type nvme0n1.
done

I am not courageous enough to simply remove the 5.16 files from /boot. So, how can I safely resolve the issue?

Thanks in advance.

Why did you remove it a live environment?

You can safely delete any 5.16 files in /boot if you’re sure you’re currently not running it.

Can you show the content in /boot ?

see this

I wanted to update my system using pacman which failed. My system was a bit unresponsive after that and seemed a bit buggy/broken, so I figured I should restart the system. The system did not boot properly after. As I had a live usb lying around, I booted from that and noticed then, that the kernel I was running was unsupported. So, I removed it from there and was able to boot again normally, however, the 5.16 kernel was not removed from grub automatically for some reason.

Thanks for your response, I will try removing it manually then. I can’t do so before next week though.

@Keruskerfuerst: Sure, this is the content of \boot:

ls -l /boot
total 154328
-rw-r--r-- 1 root root    51200 24. Sep 20:04 amd-ucode.img
drwx------ 2 root root     4096  1. Jän 1970  efi
drwxr-xr-x 5 root root     4096 25. Okt 15:57 grub
-rw------- 1 root root  7848996 25. Okt 15:06 initramfs-5.10-x86_64.img
-rw------- 1 root root 29586334 25. Okt 15:06 initramfs-5.10-x86_64-fallback.img
-rw------- 1 root root  7981386 25. Okt 15:06 initramfs-5.15-x86_64.img
-rw------- 1 root root 35072737 25. Okt 15:06 initramfs-5.15-x86_64-fallback.img
-rw------- 1 root root  8230060 27. Mai 16:26 initramfs-5.16-x86_64.img
-rw------- 1 root root 38027056 27. Mai 16:26 initramfs-5.16-x86_64-fallback.img
-rw-r--r-- 1 root root       23 15. Okt 15:40 linux510-x86_64.kver
-rw-r--r-- 1 root root       22 15. Okt 15:38 linux515-x86_64.kver
drwxr-xr-x 2 root root     4096 28. Jul 2021  memtest86+
-rw-r--r-- 1 root root  9742496 25. Okt 15:06 vmlinuz-5.10-x86_64
-rw-r--r-- 1 root root 10785024 25. Okt 15:06 vmlinuz-5.15-x86_64
-rw-r--r-- 1 root root 10665664 13. Mai 11:49 vmlinuz-5.16-x86_64

So, following the suggestion of @mithrial, I would delete the 3 files belonging to the 5.16 kernel.

@stephane: The contents of the other paths:

ls -l /lib/modules    
total 16
drwxr-xr-x 3 root root 4096 25. Okt 15:06 5.10.148-1-MANJARO
drwxr-xr-x 3 root root 4096 25. Okt 15:06 5.15.74-3-MANJARO
drwxr-xr-x 2 root root 4096 25. Okt 15:05 extramodules-5.10-MANJARO
drwxr-xr-x 2 root root 4096 25. Okt 15:05 extramodules-5.15-MANJARO
ls -l /etc/mkinitcpio.d/*.preset
-rw-r--r-- 1 root root 396 21. Jän 2021  /etc/mkinitcpio.d/linux510.preset
-rw-r--r-- 1 root root 396 24. Mär 2022  /etc/mkinitcpio.d/linux515.preset
-rw-r--r-- 1 root root 396 24. Mär 2022  /etc/mkinitcpio.d/linux516.preset

So, /lib/modules is clean, /etc/mkinitcpio.d contains a file of 5.16. I guess I can manually remove this as well?

You can delete

  1. vmlinuz-5.16-x86_64
  2. initramfs-5.16-x86_64 and fallback image
  3. /etc/mkinitcpio/linux5.16.preset
  4. An also the modules of the kernel: /usr/lib/modules/5.16...
1 Like

I removed the files you suggested and ran sudo update-grub which did the trick. The 5.16 kernel is now removed from the grub menu as intended.

Thank you all for the support.

2 Likes

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