Is it possible to get small help with /etc/default/grub?

GRUB_DEFAULT= any number works without saving.

The only value that doesn’t work is grub_DEFAULT=saved

This can’t be true, because in my last attempt with BTRFS exactly THAT didn’t work. It was saved, but there were errors when booting.

exactly what?

GRUB_DEFAULT= any number

GRUB_DEFAULT=2 did not bring anything.

This seems to be the same problem @olividir describes.

It has worked for me in the past. The only way you should get that error is if you set GRUB_SAVEDEFAULT=true which is a separate setting.

My guess would be that you set GRUB_DEFAULT=saved and GRUB_SAVEDEFAULT=true.

Then you changed GRUB_DEFAULT=2 but left GRUB_SAVEDEFAULT set to true which caused the error.

 GRUB boot loader configuration

GRUB_DEFAULT=2
GRUB_TIMEOUT=3

This is how mine looks, I’ll reboot and take pick of grub to show you how it works.

If you are getting errors you could need to comment out this

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

But I was getting error because I uncommented GRUB_SAVEDEFAULT=true

3 Likes

I definitely did NOT set that. That is exactly what keeps me away from BTRFS. It is exasperating. I have given up on it for now …

Exactly like that it looked with me (under BTRFS, as well as just now under ext4). Only hfunctions only with ext4. No idea which evil spirit has haunted my computer.

And this is how my grub looks like, it highlights the rolling kernel

IMG_20221022_205747

And I am on BTRFS

But the choice is yours if you want BTRFS or ex4, or any other file system. :slight_smile:

1 Like

That’s how it looks with ext4 at the moment, but with BTRFS it just didn’t work. Will try it again in the near future.

If you want this results, and you have both lts and rolling kernel, then I suggest you have

GRUB_DEFAULT=2

And then just to be sure, you could run

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

to make it stick

3 Likes

And make the line

#GRUB_SAVEDEFAULT=true

look exactly like this on BTRFS, if you don’t, you will get this error on boot

      Booting 'EndeavourOS, on linux-lts'

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

Press any key to continue...

That’s exactly what I did, but thanks for pointing it out! :+1:t2:

1 Like

The joke is that I had #GRUB_SAVEDEFAULT=true exactly like this and still got this error message.

#GRUB_SAVEDEFAULT=true is the default value, which I have left as it is.

Then I am unfortunately in too deep water to be able to help.
I have no idea how grub works… it’s all magic to me :magic_wand:

Then you feel the same way I do. I’ve been struggling with this problem since I first tried BTRFS 2 years ago.

1 Like

@anon50380917

I have the feeling, that you are a little confused about the “grub can’t write on btrfs”

With btrfs you can make changes on grub via editing /etc/default/grub (here was an error) an updating grub via
sudo grub-mkconfig -o /boot/grub/grub.cfg

because at that moment you are in the booted OS an there are no writing problems with btrfs.
Only on the boot, before the OS, grub itself can’t write on btrfs.

Can you post you entire grub.cfg that we can search together, to find problems?

@arcDaniel Thanks for the explanation about grub.config.

I can’t do that at the moment as I am on ext4 now. My questions are aimed at what I can/must do better in a next attempt with BTRFS to not have this problem.

But grub.cfg is there no matter if you are on ex4 or btrfs.

Should be here
/boot/grub/grub.cfg

grub.congig:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  52202e8d-3b7d-4997-ad57-75310aabf6f3
else
  search --no-floppy --fs-uuid --set=root 52202e8d-3b7d-4997-ad57-75310aabf6f3
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768x32
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=de_DE
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  52202e8d-3b7d-4997-ad57-75310aabf6f3
else
  search --no-floppy --fs-uuid --set=root 52202e8d-3b7d-4997-ad57-75310aabf6f3
fi
insmod png
background_image -m stretch /usr/share/endeavouros/splash.png
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=3
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=3
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'EndeavourOS Linux, mit Linux linux-lts' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-advanced-52202e8d-3b7d-4997-ad57-75310aabf6f3' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  52202e8d-3b7d-4997-ad57-75310aabf6f3
	else
	  search --no-floppy --fs-uuid --set=root 52202e8d-3b7d-4997-ad57-75310aabf6f3
	fi
	echo	'Linux linux-lts wird geladen …'
	linux	/boot/vmlinuz-linux-lts root=UUID=52202e8d-3b7d-4997-ad57-75310aabf6f3 rw  loglevel=3 nowatchdog nvme_load=YES
	echo	'Initiale Ramdisk wird geladen …'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux-lts.img
}
menuentry 'EndeavourOS Linux, with Linux linux-lts (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-fallback-52202e8d-3b7d-4997-ad57-75310aabf6f3' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  52202e8d-3b7d-4997-ad57-75310aabf6f3
	else
	  search --no-floppy --fs-uuid --set=root 52202e8d-3b7d-4997-ad57-75310aabf6f3
	fi
	echo	'Linux linux-lts wird geladen …'
	linux	/boot/vmlinuz-linux-lts root=UUID=52202e8d-3b7d-4997-ad57-75310aabf6f3 rw  loglevel=3 nowatchdog nvme_load=YES
	echo	'Initiale Ramdisk wird geladen …'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux-lts-fallback.img
}
menuentry 'EndeavourOS Linux, mit Linux linux' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-52202e8d-3b7d-4997-ad57-75310aabf6f3' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  52202e8d-3b7d-4997-ad57-75310aabf6f3
	else
	  search --no-floppy --fs-uuid --set=root 52202e8d-3b7d-4997-ad57-75310aabf6f3
	fi
	echo	'Linux linux wird geladen …'
	linux	/boot/vmlinuz-linux root=UUID=52202e8d-3b7d-4997-ad57-75310aabf6f3 rw  loglevel=3 nowatchdog nvme_load=YES
	echo	'Initiale Ramdisk wird geladen …'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
}
menuentry 'EndeavourOS Linux, with Linux linux (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-52202e8d-3b7d-4997-ad57-75310aabf6f3' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  52202e8d-3b7d-4997-ad57-75310aabf6f3
	else
	  search --no-floppy --fs-uuid --set=root 52202e8d-3b7d-4997-ad57-75310aabf6f3
	fi
	echo	'Linux linux wird geladen …'
	linux	/boot/vmlinuz-linux root=UUID=52202e8d-3b7d-4997-ad57-75310aabf6f3 rw  loglevel=3 nowatchdog nvme_load=YES
	echo	'Initiale Ramdisk wird geladen …'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux-fallback.img
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
fwsetup --is-supported
if [ "$grub_platform" = "efi" -a "$?" = 0 ]; then
	menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
		fwsetup
	}
fi
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/35_fwupd ###
### END /etc/grub.d/35_fwupd ###

### BEGIN /etc/grub.d/40_custom ###
# 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.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###

Currently the LTS kernel runs with ext4!