I have 2 partitions of equal size on my laptop, about 26gb each, ext4 format. They are both used for a root partition, the idea being to have one as a backup in case one of the tumbleweed updates totally doesn’t work.
This is my partition setup:
**Device**** Start**** End**** Sectors**** Size****Type**
/dev/nvme0n1p1 2048 1026047 1024000 500M Microsoft basic data
/dev/nvme0n1p2 1026048 55711743 54685696 26.1G Linux filesystem
/dev/nvme0n1p3 55711744 110397439 54685696 26.1G Linux filesystem
/dev/nvme0n1p4 110397440 1943756799 1833359360 874.2G Linux filesystem
/dev/nvme0n1p5 1943756800 1953523711 9766912 4.7G Linux swap
When I run the procedure to restore/install grub, here is what I do. As root in a terminal:
> mkinitrd
> grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-5.14.5-1-default
Found initrd image: /boot/initrd-5.14.5-1-default
Found linux image: /boot/vmlinuz-5.14.2-1-default
Found initrd image: /boot/initrd-5.14.2-1-default
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found openSUSE Tumbleweed on /dev/nvme0n1p3
Adding boot menu entry for UEFI Firmware Settings ...
done
> grub2-install /dev/nvme0
Installing for x86_64-efi platform.
Installation finished. No error reported.
Notice what the result is in the grub configuration file. I will leave out the advanced options on both partitions because they are the same with regard to what I found:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'openSUSE Tumbleweed' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-ba22e191-xxxxxxxxxxxxxxxxxxx' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root ba22e191-xxxxxxxxxxxxxxxxxxx
echo 'Loading Linux 5.14.5-1-default ...'
linuxefi /boot/vmlinuz-5.14.5-1-default root=UUID=ba22e191-xxxxxxxxxxxxxxxxxxxx splash=silent mitigations=auto quiet
echo 'Loading initial ramdisk ...'
initrdefi /boot/initrd-5.14.5-1-default
}
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'openSUSE Tumbleweed (on /dev/nvme0n1p3)' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-4efad914-xxxxxxxxxxxxxxxxxxxxxxx' {
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 4efad914-xxxxxxxxxxxxxxxxxxxxxxxx
linuxefi /boot/vmlinuz-5.14.2-1-default root=UUID=ba22e191-xxxxxxxxxxxxxxxxxxx splash=silent mitigations=auto quiet
initrdefi /boot/initrd-5.14.2-1-default
}
See how on the 2nd menu item in grub for my 2nd root partition, the menuentry line points to the right UUID for that partition, and the search line also points to the right UUID for that partition. However, the actual boot line that begins with linuxefi points back to the other root partition, the same as in the first menu entry in grub.
Am I doing something wrong in how I install grub? Or is this a bug in setting up grub?
I know I am not supposed to manually adjust the grub.cfg file, but what I found was that if I selected the 2nd root partition in grub, it would still mount and boot into the 1st root partition because of the wrong UUID specified on the linuxefi line. So I manually changed the UUID to the correct one on this line, and was able to boot into the 2nd root partition. But I don’t want to have to do this every time.