update-grub2 could not find custom kernel
I've compiled a new kernel based on 5.4.18-xanmod10 kernel. Then I've installed it:
sudo dpkg -i linux*5.4.18-xanmod10-custom*.deb
But after installing, it have not been found by update-grub2
:
root@lenovo:~# ls /boot/
config-5.3.0-29-lowlatency memtest86+.elf
config-5.4.18-xanmod10-custom memtest86+_multiboot.bin
config-5.5.0-3.2-liquorix-amd64 System.map-5.3.0-29-lowlatency
config-5.5.0-4.1-liquorix-amd64 System.map-5.4.18-xanmod10-custom
config-5.5.4-xanmod3 System.map-5.5.0-3.2-liquorix-amd64
grub System.map-5.5.0-4.1-liquorix-amd64
initrd.img System.map-5.5.4-xanmod3
initrd.img-5.3.0-29-lowlatency vmlinuz
initrd.img-5.4.18-xanmod10-custom vmlinuz-5.3.0-29-lowlatency
initrd.img-5.5.0-3.2-liquorix-amd64 vmlinuz-5.4.18-xanmod10-custom
initrd.img-5.5.0-4.1-liquorix-amd64 vmlinuz-5.5.0-3.2-liquorix-amd64
initrd.img-5.5.4-xanmod3 vmlinuz-5.5.0-4.1-liquorix-amd64
initrd.img.old vmlinuz-5.5.4-xanmod3
memtest86+.bin vmlinuz.old
root@lenovo:~# update-grub2
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.3.0-29-lowlatency
Found initrd image: /boot/initrd.img-5.3.0-29-lowlatency
Found linux image: /boot/vmlinuz-5.3.0-29-lowlatency
Found initrd image: /boot/initrd.img-5.3.0-29-lowlatency
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
There're other kernels present, but after reboot only lowlatency
kernel and memtest are present in the grub menu. Also, during update it shows the same kernel two times. Previously, before generic cernels moving to another folder, generic and lowlatency kernels have been listed during grub update.
How could I resolve this issue?
The following three commands also solve this problem, by turning off the executable bit on 09_lowlatency and turning on the bit for 10_linux, in accordance with the text in /etc/grub.d/README.lowlatency. I recommend editing /etc/default/grub to change GRUB_TIMEOUT to a positive value, prior to invoking update-grub as well.
# chmod -x /etc/grub.d/09_lowlatency
# chmod +x /etc/grub.d/10_linux
# update-grub