Can't switch default Kernel.

I tried to follow this turorial.

I tried to edit grub and then update-grub, still not getting desired kernel booting.
The only thing that changed is that cursor now always points to Advanced options in boot menu (by default).
This is my edit (also tried the numerical method with "1>2", "1>3" etc):

GRUB_DEFAULT="gnulinux-4.19.91-1-MANJARO x64-advanced-62dadb23-d7ce-4d36-977b-2c40fc1486e2"
GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=8f42e9b9-86b5-4be9-bf7c-26d8019260b2 udev.log_priority=3"
GRUB_CMDLINE_LINUX=""
````Preformatted text`

This is my kernels:

$ awk '/menuentry/ && /class/ {count++; print count-2""$0 }' /boot/grub/grub.cfg
-1
menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-62dadb23-d7ce-4d36-977b-2c40fc1486e2' {
0**** menuentry 'Manjaro Linux (Kernel: 5.4.6-2-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.6-2-MANJARO x64-advanced-62dadb23-d7ce-4d36-977b-2c40fc1486e2' {
1**** menuentry 'Manjaro Linux (Kernel: 5.4.6-2-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.6-2-MANJARO x64-fallback-62dadb23-d7ce-4d36-977b-2c40fc1486e2' {
2**** menuentry 'Manjaro Linux (Kernel: 4.19.91-1-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.91-1-MANJARO x64-advanced-62dadb23-d7ce-4d36-977b-2c40fc1486e2' {
3**** menuentry 'Manjaro Linux (Kernel: 4.19.91-1-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.91-1-MANJARO x64-fallback-62dadb23-d7ce-4d36-977b-2c40fc1486e2' {
4menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-9D40-2728' {
5
menuentry 'Ubuntu 18.04.3 LTS (18.04) (on /dev/sda6)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-d14590c0-05bd-46f6-94a6-72f74eb02337' {
6**** menuentry 'Ubuntu (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.0.0-37-generic--d14590c0-05bd-46f6-94a6-72f74eb02337' {
7**** menuentry 'Ubuntu, with Linux 5.0.0-37-generic (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.0.0-37-generic--d14590c0-05bd-46f6-94a6-72f74eb02337' {
8**** menuentry 'Ubuntu, with Linux 5.0.0-37-generic (recovery mode) (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.0.0-37-generic--d14590c0-05bd-46f6-94a6-72f74eb02337' {
9**** menuentry 'Ubuntu, with Linux 5.0.0-23-generic (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.0.0-23-generic--d14590c0-05bd-46f6-94a6-72f74eb02337' {
10**** menuentry 'Ubuntu, with Linux 5.0.0-23-generic (recovery mode) (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.0.0-23-generic--d14590c0-05bd-46f6-94a6-72f74eb02337' {
11**** menuentry "Memory Tester (memtest86+)" --class memtest86 --class gnu --class tool {

You can disable the creation of submenus with
GRUB_DISABLE_SUBMENU=true
Then you can simply set GRUB_DEFAULT to the desired number.
Tested this just a few days ago so it should work.

1 Like

Thanks for info about GRUB_DISABLE_SUBMENU, but in general it's not gonna change anything, because the desired number is set and yet Kernel 5 instead of 4 being booted. I set "1>3", tried to put text instead of numbers.

you can have grub remember last selected kernel and make it default.

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

edit your /etc/default/grub

to something like this

GRUB_DEFAULT="saved"
GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=8f42e9b9-86b5-4be9-bf7c-26d8019260b2 udev.log_priority=3"
GRUB_CMDLINE_LINUX=""

GRUB_SAVEDEFAULT="true"

save/exit sudo update-grub

My Manjaro is cursed. It doesn't work.
I changed to "saved", updated grub, seleted 4.19 in Advanced boot options, booted, rebooted, selected Manjaro (first entry, above Advanced...) and I see that it's 5.4.6-2.

1 Like

did you uncomment this line?

post your full /etc/default/grub

1 Like
GRUB_DEFAULT="saved"
GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=8f42e9b9-86b5-4be9-bf7c-26d8019260b2 udev.log_priority=3"
GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# 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

# 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 'videoinfo'
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-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/theme.txt"

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

have we been playing with grub-customizer? :face_with_raised_eyebrow:

Never heard of such.
The only operations I performed with Grub before are these (because had a problem after Ubuntu or Windows installation):

sudo mount /dev/sda1 /mnt/boot/efi
sudo chroot /mnt
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
grub-install /dev/sda
update-grub
exit
for i in /sys /proc /run /dev; do sudo umount "/mnt/$i"; done
sudo umount /mnt/boot/efi

I wasn't able to umount something, so had to reboot without unmounting.

thats for an mbr/bios installation. for uefi

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
sudo update-grub

I tried to update grub using what you said. Still the same.
This is an excerpt from the last time:

[PC /]# sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub-install: error: efibootmgr failed to register the boot entry: No such file or directory.
[PC /]# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
[PC /]# sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
Installing for x86_64-efi platform.
Installation finished. No error reported.
[PC /]# update-grub
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.4-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-5.4-x86_64.img
Found initrd fallback image: /boot/initramfs-5.4-x86_64-fallback.img
Found linux image: /boot/vmlinuz-4.19-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-4.19-x86_64.img
Found initrd fallback image: /boot/initramfs-4.19-x86_64-fallback.img
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 18.04.3 LTS (18.04) on /dev/sda6
Found memtest86+ image: /boot/memtest86+/memtest.bin
done
[PC /]# exit
exit
[john@PC ~]$ for i in /sys /proc /run /dev; do sudo umount "/mnt/$i"; done
umount: /mnt//sys: target is busy.
[john@PC ~]$ sudo umount /mnt/boot/efi

post full output of sudo parted -l

for i in /sys /proc /run /dev; do sudo umount "/mnt/$i"; done

is for unmounting the directories that are mounted when chrooting into another install like when doing what manjaro-chroot does normally. You shouldn't need to run that at all unless you are manually chrooting into your system to fix grub. OR you're chrooting in from Ubuntu to fix Manjaro which is not something I'd advise.

I can tell by your prompt changes and commands that you're attempting to fixing grub from a chroot and, well, you shouldn't have to based on what you're trying to accomplish.

@dglt "sudo grub-install /dev/sda" is a perfectly valid command for EFI systems on Ubuntu according to the Ubuntu documentation I quicly glanced over. Since @john100 has an Ubuntu partition and a few Ubuntu mentions above I thought it pertinent to see what Ubuntu says about grub-install.

1 Like

maybe for ubuntu but from what i understand is that manjaro's grub can boot other distro's but those others distro's have trouble booting manjaro.

i dont understand why OP is doing this either since he mentioned already he can boot into manjaro, there is no reason to manually load efivars or mount partitions from a booted manjaro unless the OP installed manjaro as legacy bios on a uefi partition table seeing as how windows is installed as uefi

Yep. That's they way I understand it.

From what I can tell this is a triple boot setup with Manjaro, Ubuntu, and Windows and most of the advise that's been given would mainly work for a dual boot with Windows or single booting with Manjaro; not managing Grub from two distributions on one disk which is what is going on here and is a serious pain in the rear to deal with to put it politely.

$ sudo parted -l
...
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 269MB 268MB fat32 EFI System Partition boot, esp
2 269MB 1343MB 1074MB linux-swap(v1) swap
3 1343MB 22,8GB 21,5GB ext4
5 22,8GB 186GB 163GB ext4
6 186GB 213GB 26,8GB ext4
4 213GB 320GB 107GB ntfs msftdata

I think sudo grub-install /dev/sda aslo vaild on Manjaro, because I was using for fixing after Windows/Ubuntu install, it did it's job.

Going by both the Arch and Manjaro Wikis, sudo grub-install /dev/sda; sudo grub-install /dev/sda --recheck; sudo update-grub is the method for BIOS+MBR systems. I'm not saying it won't work, just that even if it does work, it isn't the official, recommended method to do for your kind of system.

Using your numbers above, UEFI systems are supposed use sudo mount /dev/sda1 /boot/efi; sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck; sudo update-grub

Anyhoo, did you install GRUB2 in both Manjaro and Arch and, if that's a yes, which distribution are you using as your primary Linux OS?

Only one of them needs GRUB installed to the disk via /dev/sda. The other distribution should be using it's /dev/sda# root partition for the GRUB install -- like, if Manjaro is your primary Linux OS, Ubuntu should be using /dev/sda6 for it's GRUB install which will allow Manjaro's GRUB install to take precedence at boot.

Anyhoo, did you install GRUB2 in both Manjaro and Arch and, if that's a yes, which distribution are you using as your primary Linux OS?

What Arch? There is Windows, Manjaro and Ubuntu.

Only one of them needs GRUB installed to the disk via /dev/sda. The other distribution should be using it's /dev/sda# root partition for the GRUB install -- like, if Manjaro is your primary Linux OS, Ubuntu should be using /dev/sda6 for it's GRUB install which will allow Manjaro's GRUB install to take precedence at boot.

I think I'll just remove Ubuntu partition and fix Manjaro's grub with commands above.

I did what I told in the previous post - nothing changes.

Forum kindly sponsored by