How to change default kernel on boot menu?

I’ve modified the /etc/default/grub to this:

# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="EndeavourOS"
GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=3a163a1a-a0b5-42f6-b01d-6a9344ab8f52 loglevel=3 nowatchdog nvme_load=YES nvidia-drm.modeset=1"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=menu

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"
GRUB_THEME=/boot/grub/themes/EndeavourOS/theme.txt

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
GRUB_SAVEDEFAULT=true

# Uncomment to disable submenus in boot menu
GRUB_DISABLE_SUBMENU=y

# Probing for other operating systems is disabled for security reasons. Read
# documentation on GRUB_DISABLE_OS_PROBER, if still want to enable this
# functionality install os-prober and uncomment to detect and include other
# operating systems.
GRUB_DISABLE_OS_PROBER=false

I wish: no graphic menu, and remember last entry selected

But there’s no change after booting my OS.

$ efibootmgr
BootCurrent: 0004
Timeout: 1 seconds
BootOrder: 0004,0000,000A,0001,0002,0003
Boot0000* Windows Boot Manager  HD(1,GPT,9446e71d-2551-430f-a7ca-eb75f9e27fd1,0x800,0x32000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
Boot0001* UEFI:CD/DVD Drive     BBS(129,,0x0)
Boot0002* UEFI:Removable Device BBS(130,,0x0)
Boot0003* UEFI:Network Device   BBS(131,,0x0)
Boot0004* endeavouros-2952      HD(5,GPT,b719b06c-e2ca-c44b-b11f-916ee797f317,0x2e932000,0xfa000)/File(\EFI\ENDEAVOUROS-2952\GRUBX64.EFI)
Boot000A  UEFI OS       HD(5,GPT,b719b06c-e2ca-c44b-b11f-916ee797f317,0x2e932000,0xfa000)/File(\EFI\BOOT\BOOTX64.EFI)0000424f

/boot/efi partition is fat32

What am I missing?

Did you

sudo grub-mkconfig -o /boot/grub/grub.cfg

and reboot after making changes?

3 Likes

Your are right but after rebooting I get this message:

error: sparse file not allowed.
Loading kernel linux-lts ...
Loading initial ramdisk ...

Press any key to continue...

For file /boot/grub/grub.cfg I’ve made these changes only:

GRUB_DEFAULT=saved
.......
GRUB_TERMINAL_INPUT=console
.......
GRUB_SAVEDEFAULT=true
.......

Moreover last selected option is not saved. Why?

You can’t use GRUB_SAVEDEFAULT with btrfs.

Grub doesn’t have support for writing to btrfs.

You can, however, set GRUB_DEFAULT to a specific number to boot a different entry.

2 Likes

Also thought about that, since you mentioned it very recently on the forum. How did you figure it is BTRFS? Didn’t see it from the code outputs…

That sparse file not allowed error only happens on a few different filesystems and btrfs is by far the most common of those.

Technically, it could be a different filesystem that grub can’t write to but the solution would still be the same.

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