You are not logged in.

#1 2020-09-19 21:12:58

Tyskr
Member
Registered: 2019-12-11
Posts: 67

[SOLVED] Grub not remembering last boot choice

Hey guys,

This forum has helped me quite a lot in the past and I hope that you can help me once more!

My problem is this: While booting, I tell grub to boot the latest kernel, not my lts one.
It does just that and everything works fine.

I want to permanently boot the latest one.

In my grub.cfg it says:

GRUB_DEFAULT=saved

and

GRUB_SAVEDEFAULT=true

I do

grub-mkconfig

after editing the .cfg.

But it is always booting the lts-kernel anyway. What am I doing wrong?

Last edited by Tyskr (2020-09-20 15:17:50)

Offline

#2 2020-09-19 22:33:13

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: [SOLVED] Grub not remembering last boot choice

If you edit grub.cfg and then run grub-mkconfig, your edits are overwritten. Check your grub.cfg file and see if your changes are still there.

Edit your grub.cfg file, do not run grub-mkconfig, and then try booting. If you want changes to persist after you run grub-mkconfig, you need to add those changes to /etc/grub/default, not directly in grub.cfg.

Just editing grub.cfg without changing /etc/default/grub should work, as long as you don't run grub-mkconfig. Arch does not run grub-mkconfig after a kernel update (Debian does this, but Arch does not).

Offline

#3 2020-09-19 22:59:02

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,431
Website

Re: [SOLVED] Grub not remembering last boot choice

2ManyDogs wrote:

Just editing grub.cfg without changing /etc/default/grub should work

The OP's posted options only work if they are added to /etc/default/grub (and then incorporated into grub.cfg with grub-mkconfig).

The relevant option in grub.cfg is

set default="${saved_entry}"

Para todos todo, para nosotros nada

Offline

#4 2020-09-19 23:03:46

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: [SOLVED] Grub not remembering last boot choice

Thanks for the clarification. I have never used those options.

Offline

#5 2020-09-20 10:41:27

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: [SOLVED] Grub not remembering last boot choice

Thanks for your replies guys.

So I edit /boot/grub/grub.cfg? That's where I found

set default="${saved_entry}"

But I don't edit this manually right?

I should have clarified that when I edit my grub.cfg, I was referring to the one which can be found in /etc/default/grub. I think you were thinking of this one too, 2ManyDogs?

2ManyDogs wrote:

If you want changes to persist after you run grub-mkconfig, you need to add those changes to /etc/grub/default, not directly in grub.cfg.

I did exactly this, but when my system boots and I'm seeing the boot menu, I press enter like usual and it boots the lts-kernel, which bothers me. In the boot menu, I can select advanced options and boot the latest kernel, but that is kind of a hassle and I want to boot the latest kernel automatically without me having to tell grub to do just that.

//Edit

2ManyDogs wrote:

If you edit grub.cfg and then run grub-mkconfig, your edits are overwritten. Check your grub.cfg file and see if your changes are still there.

I edited my grub.cfg in /etc/default, did grub-mkconfig and my changes were still there. They were not overwritten.
My grub.cfg is named only 'grub' in /etc/default, is that normal? Should I change it to grub.cfg? Maybe that makes a difference.

Last edited by Tyskr (2020-09-20 10:45:19)

Offline

#6 2020-09-20 10:52:19

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,431
Website

Re: [SOLVED] Grub not remembering last boot choice

Tyskr wrote:

I do

grub-mkconfig

after editing the .cfg.

That is not correct: https://wiki.archlinux.org/index.php/GR … ation_file


Para todos todo, para nosotros nada

Offline

#7 2020-09-20 11:24:24

Wild Penguin
Member
Registered: 2015-03-19
Posts: 347

Re: [SOLVED] Grub not remembering last boot choice

Yes, Head_on_a_Stick is correct. While 2ManyDogs's advice is not completely incorrect, it has completely the wrong gist of how things are supposed to be done. Arch doesn't run grub-mkconfig after Kernel updates, since it doesn't change file names in /boot/[vmlinuz-*|initramfs-*.img] (and, also, doesn't support multiple versions of the same kernel flavours; such as -lts, -zen, NONE etc.). So, running grub-mkconfig is not generally needed after Kernel updates, however, that doesn't mean the facility wasn't in place and used.

The intended way to configure grub is to add the desired options in /etc/default/grub (and /etc/grub.d, however editing scripts in latter is rarely needed) - and then run grub-mkconfig. In (most) modern distributions editing /boot/grub/grub.cfg directly is generally discouraged, however, it is possible. It is much more sensible to edit grub configuration files in /etc and then run grub-mkconfig (as the generated files are quite a monstrosity for humans to edit). It's all explained in the Wiki.

If after editing /etc/default/grub and running grub-mkconfig, it still doesn't work, post the contents of that file here. EDIT: Here is the correct way to configure desired feature.

Last edited by Wild Penguin (2020-09-20 11:29:22)

Offline

#8 2020-09-20 12:10:08

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] Grub not remembering last boot choice

Tyskr wrote:

My problem is this: While booting, I tell grub to boot the latest kernel, not my lts one.
It does just that and everything works fine.

I want to permanently boot the latest one.

Just to verify: You mean the one used latest?

Offline

#9 2020-09-20 12:33:15

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: [SOLVED] Grub not remembering last boot choice

Thanks again for the replies.

I had the 'true' in

GRUB_SAVEDEFAULT=true

in quotes, smh.



My /etc/default/grub.cfg:

# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash loglevel=3 cryptdevice=/dev/nvme0n1p3:volgroup0:allow-discards rd.udev.log_priority=3 vt.global_cursor_default=0"
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"

# 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
respiranto wrote:
Tyskr wrote:

My problem is this: While booting, I tell grub to boot the latest kernel, not my lts one.
It does just that and everything works fine.

I want to permanently boot the latest one.

Just to verify: You mean the one used latest?

Yes, the last one used. Just not the lts-kernel I used so long now.

Last edited by Tyskr (2020-09-20 13:43:26)

Offline

#10 2020-09-20 12:51:27

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,431
Website

Re: [SOLVED] Grub not remembering last boot choice

Tyskr wrote:

My grub.cfg

Are you sure? Those contents belong in /etc/default/grub.

Do you have a file at /boot/grub/grub.cfg? Have you run the correct grub-mkconfig(8) command yet?


Para todos todo, para nosotros nada

Offline

#11 2020-09-20 13:43:06

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: [SOLVED] Grub not remembering last boot choice

Head_on_a_Stick wrote:
Tyskr wrote:

My grub.cfg

Are you sure? Those contents belong in /etc/default/grub.

Do you have a file at /boot/grub/grub.cfg? Have you run the correct grub-mkconfig(8) command yet?

Those contents are in /etc/default/grub.

I do have a file in /boot/grub/grub.cfg.

And as Wild Penguin recommended, I followed this:  https://wiki.archlinux.org/index.php/GR … ious_entry

Last edited by Tyskr (2020-09-20 14:24:28)

Offline

#12 2020-09-20 15:17:23

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: [SOLVED] Grub not remembering last boot choice

Tyskr wrote:
Head_on_a_Stick wrote:
Tyskr wrote:

My grub.cfg

Are you sure? Those contents belong in /etc/default/grub.

Do you have a file at /boot/grub/grub.cfg? Have you run the correct grub-mkconfig(8) command yet?

Those contents are in /etc/default/grub.

I do have a file in /boot/grub/grub.cfg.

And as Wild Penguin recommended, I followed this:  https://wiki.archlinux.org/index.php/GR … ious_entry

// SOLUTION:

Again, my mistake:

GRUB_SAVEDEFAULT="true"

instead of

GRUB_SAVEDEFAULT=true

I then ran

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

and it now boots the last used boot option.

Thanks for the help!

Offline

Board footer

Powered by FluxBB