Set Manjaro to boot with an older kernel next time, before rebooting?

There are currently two kernels installed: (1)6.2.13 and (2)6.1.26. It is currently running (1), and the “Remove” button only appears next to (2). I cannot access the boot screen (remote PC). How can I make the system to boot to (2) next time, so that I could remove (1) and set (2) as the only kernel?

Normally when you boot, grub prompts you for which installed kernel you want to run, which becomes “current”

Yeah, I cannot access the boot screen, so I need way to select that before rebooting.

Do you need help fixing the boot process? With something like GRUB/Restore the GRUB Bootloader - Manjaro

No, GRUB is working fine. I cannot access it because it is a remote PC as I wrote in the OP. There are two kernels in the /boot. If I delete 6.2…img files there, will it boot to 6.1 next time?

man grub-reboot
1 Like

A better way is to configure grub to boot on the kernel you want to. (as @Aragorn says more succinctly haha)

1 Like

How to get all available “menu entries” and pass it? I searched Google and found

awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg

but the following 2 did not work

sudo grub-reboot "Manjaro Linux (Kernel: 6.1.26-1-MANJARO x64)"
sudo grub-reboot 'Manjaro Linux (Kernel: 6.1.26-1-MANJARO x64)' 

and this

sudo grub-reboot Manjaro Linux (Kernel: 6.1.26-1-MANJARO x64)

caused

zsh: unknown file attribute: K

Have you tried just using the number of the menu entry? (Hint: the count starts at 0 for the first entry.)

Why not edit /etc/default/grub to change GRUB_DEFAULT=1 (depends on boot number of Kernel in GRUB) and add GRUB_DISABLE_SUBMENU=y , then run $ sudo update-grub?

from the looks of it grub-menu is set to be hidden, and in its hidden mode, from my experience grub always resorts to the latest kernel installed irrespective what is set to be the default entry. if you want to hard-set the kernel to be booted next time you can use GRUB_TOP_LEVEL

open /boot/grub/grub.cfg
put this line on top;

GRUB_TOP_LEVEL="/boot/vmlinuz-6.1-x86_64"

since this is one off requirement i wouldnt necessarily put this in /etc/default/grub

refer; GRUB - ArchWiki

I tried with grub-reboot 3 (kernel 6.1 was the fourth line in the output of the awk command above) and that made the system not boot. Well, I don’t know, because I cannot connect to it (no ping). Maybe it booted to something weird or got stuck. The PC is not in a far away place, but in another room and headless (no GPU, no monitor). I pushed reset a few times, and even un/re-plugged it, but I still cannot connect to it. Isn’t grub-boot supposed to be next time-only? Then shouldn’t it go back to the previous choice if I reset it?

Anyway, I guess I have to connect a GPU and a monitor and see the real screen.

Normally, yes.

Normally, yes.

The problem is that you have submenu entries in the GRUB menu like:
Screenshot_20230510_093530

You only have boot order: 0, 1, 2. There is no 3.

But you used the command line:

The output:

Manjaro Linux (Kernel: 6.2.14-2-MANJARO x64)
Manjaro Linux (Kernel: 6.2.14-2-MANJARO x64 - fallback initramfs)
Manjaro Linux (Kernel: 6.1.22-1-MANJARO x64)
Manjaro Linux (Kernel: 6.1.22-1-MANJARO x64 - fallback initramfs)
UEFI Firmware Settings

This command line can not see entries in GRUB boot menu.

I already told that you need to disable the submenu: :point_down:
Edit /etc/default/grub to add:

Then run $ sudo update-grub and $ sudo grub-reboot 2: The result:

2 Likes

I was following Aragorn’s reply, and you wrote that after the problem had already happened.

Anyway, it seems that the problem was that the fourth item on the first screen was not the 6.1 kernel, but “Advanced Manjaro … on /dev/loop” or something, so it booted into a weird thing. The boot menu was nested, something like

  • Manjaro
  • Advanced Manjaro
    • 6.2
    • 6.2 fallback
    • 6.1 <=== the one I needed to select
    • 6.1 fallback
  • something
  • Advanced Manajro /dev/loop

So, it was not fourth, but the third subitem of the second item. Also, it seems even after a successful boot, the selection that was set by grub-reboot persisted. I had to set grub-reboot 0.

You did not disable GRUB submenu. Useless, I know grub-reboot [number] does not support selecting an item in the submenu.

You can actually simplify things by doing something like:

sudo grub-reboot "1>2"

You can use this ugly awk -F\' '/menuentry |submenu /{print $1 $2}' /boot/grub/grub.cfg to get a better view of the ‘numbers’ (count level-0, then count level-1, all zero based).
Or use this script if you wish
https://askubuntu.com/questions/838704/grub-reboot-to-specific-kernel/1062304#1062304

1 Like

@kingofmanjar0 thanks for coming back to clarify the issue.

This sounds like a bug in grub

Option to disable submenu is usually commented out in GRUB
This command will remove comment tag

sudo sed -i 's/#GRUB_DISABLE_SUBMENU/GRUB_DISABLE_SUBMENU/g' /etc/default/grub

and disable submenu when GRUB is updated

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