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

Hello all

I recently added lts kernel to my system as a fallback if the current kernel doesn’t play well with my system.
I am trying to get grub to remember my selection of kernel (boot the regular linux kernel), but so far not successful.
There is a section bit far in the grub file that says

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

Which I have uncommented (as you can see), I have also changed GRUB_DEFAULT=0 to GRUB_DEFAULT=saved as mentioned in the section.

I did run

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

after my changes.

However, my system always boots lts kernel. I haven’t been able to find anything concrete about this on the arch wiki https://wiki.archlinux.org/title/GRUB#Detecting_other_operating_systems

Am I missing anything?

Really stupid question - You have removed the “#” character at the beginning of the line?

If you changed the file and regenerated grub.cfg while booted into linux-lts, that is what it remembers.

I was in the rolling kernel when I generated the grub.cfg (I am almost 100% sure of that)
Will try it again though.

Yes, like I said, I have uncommented the line.

Hi @olividir
If I may comment, I learned here that it is better to use LTS as it is more stable and more tested. Unless you need the default for a specific reason.

Though I am on EndeavourOS as a rolling release, and this is just one of the reasons I like it, I prefer stability and reliability.

If LTS works fine with you and give you what you need, better stick to it.

1 Like

Thanks for the advice. I am running quite new hardware which could get better benefits of newer kernel, which is why I tend to be on the newer kernel :slight_smile:

3 Likes

Wouldn’t GRUB_DEFAULT=0 alone be sufficient for the kernel with highest version to be first on the Grub boot menu?

You could then just adjust GRUB_TIMEOUT= to time (in seconds) to your liking.

Sorry @limotux, the reply was meant for @olividir.

1 Like

Neither
GRUB_DEFAULT=0 or GRUB_DEFAULT=true is giving me the boot of running kernel.
I have noticed some weird errors at the beginning of boots after installing lts-kernel.

      Booting 'EndeavourOS, on linux-lts'

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

Press any key to continue...

This is very new to me… at this time I either wait for 15 - 30 sec or press any key to continue… which is not ideal.

With your current settings, could you post the output of:

cat /etc/default/grub

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

Also:

cat /boot/grub/grub.cfg | eos-sendlog and post the URL

You can’t use save default with btrfs.

Grub only supports reading btrfs. It can’t write so it can’t save the setting.

4 Likes

Aaaahhhh

That is a solution :smiley: :rofl:

So that was it: BTRFS!
:blush:

How about I make a new post for the boot error??

That is the reason for the boot error.

Disable save default and it will go away.

1 Like

I would revert the changes in the /etc/default/grub and regenerate grub.cfg first.
Reboot and see if you still have that error.

2 Likes

You are correct, reverting the changes fixed that error.

Now to see if there is a bootloader that can handle two kernels, remember which kernel I want and works with BTRFS :laughing:

2 Likes

Why sorry! It is OK with me and hope it is OK with @olividir

He had the answer anyway.

2 Likes

You are welcome.
Yes, sometimes you may need the latest kernel for the latest hardware.

becasue I use btrfs too, I tried it on my system, with the same behavior.

But I prefer btrfs with snapper than switching to ext4 only for such a little annoyance.

how is this with systemd-boot?

1 Like

I tried systemd-boot, it does not detect snapshots unfortunately.