3

I have installed Windows 11 and Ubuntu 22.04. Both systems work properly. I’m using GRUB to select the desired system.

The first entry in the GRUB menu is Ubuntu 22.04 and launches Ubuntu with kernel 6.5.0-15-generic.

This kernel has problems connecting to the network (LAN), but this is not my issue here. Using menu entry Advanced options for Ubuntu Ubuntu, with Linux 6.5.0-40-generic launches Ubuntu with proper network access.

I don’t want to always use the advanced mode to get a proper working system. How can I change the first entry in the GRUB menu `Ubuntu 22.04 to use Ubuntu with kernel 6.5.0-40-generic? I haven’t found this in GNU GRUB manual.

Uwe3003
  • 31
  • 1
  • 5

3 Answers3

3

Edit /etc/grub.d/40_custom to be like this:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'Ubuntu k40' --class Ubuntu  {
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos4'
    linux /boot/vmlinuz-6.5.0-40-generic root=/dev/sda4 ro --
    initrd /boot/initrd.img-6.5.0-40-generic
}

Make sure to replace the 'hd0,msdos4' and /dev/sda4 with the appropriate values based on the Ubuntu partition.

Save the file, and rename it to /etc/grub.d/09_custom. and sudo update-grub.

To make this the default entry in the Grub boot menu; edit /etc/default/grub, find this line GRUB_DEFAULT=0, change it to GRUB_DEFAULT=Ubuntu k40, save the file, sudo update-grub, and reboot to test

Talaat Etman
  • 1,340
3

A simpler way is to edit /etc/default/grub changing this line to show

GRUB_DEFAULT=saved

and adding this line

GRUB_SAVEDEFAULT=true

and do sudo update-grub

This sets the last kernel booted into as the default. So just manually boot into the desired kernel through the GRUB menu once, and from then on (until you change it) it will automatically boot that kernel.

0

Solved! In GRUB menu type ‘e’ to edit the menu entry. Here address the Linux kernel you find in /boot. By this I was able to change the address of my first menu entry. Another good way to maintain the menu entries is using the GRUB Customizer. I meanwhile upgraded to Ubuntu 24.04.1 LTS and am using Linux kernel vmlinuz-6.8.0-44-generic as default. Thanks for your tips and hints.

Uwe3003
  • 31
  • 1
  • 5