I'm trying to create dualboot system with openSuse (15.4) and Ubuntu (20.04).
I had Suse installed on a drive /dev/sda
with following structure:
/dev/sda
|- /dev/sda1
|- /boot/efi (vfat)
|- /dev/sda2
|- / (btrfs subvol @/.snapshots/1/snapshot)
|- /boot/grub2/x86_64-efi (btrfs subvol @/boot/grub2/x86_64-efi)
|- /boot/grub2/i386-pc (btrfs subvol @/boot/grub2/i386-pc)
|- /home (btrfs subvol @/home)
...
The idea was to create separate subvol for ubuntu /
and share all other subvols like /home
I've created new subvol @/ubuntu-root
mounted it to /mnt/ubuntu-root
:
|- /dev/sda2
...
|- /mnt/ubuntu-root (btrfs subvol @/ubuntu-root)
Afer that I debootstrap
'd ubutntu into it.
I can successfully chroot
into freshly installed ubuntu, but I can't come up with the way to properly update EFI loader and grub.
I'm really new to all grub stuff and all guides are really messy in terms of what comes first and what should be manually updated and what should be generated by what. ALso, and none of them seem to mention EFI.
update-grub
mentioned in answers to this question does not exist on Suse, os-prober
does not seem to detect ubuntu from Suse thus grub2-mkconfig
does not change anything.
Is there some place where All this stuff is concisely explained, or maybe there's a guide that could help me but I can't somehow find on google?
UPD#1:
I've installed proper kernel (5.4) and done update-initramfs -c -k 5.4.0-26-generic
from chroot.
Now, grub-mkconfig
from ubuntu chroot generates somewhat proper config for ubuntu with proper menuentries and load targets:
...
menuentry 'Ubuntu' ...
...
linux /@/ubuntu-root/boot/vmlinuz-5.4.0-26-generic
However, it does not see existing openSuse (obviously, I guess)
As far as I understand there's following order of things happening:
- BIOS loads EFI from
/dev/sda1
which is /boot/efi/EFI/boot/bootx64.efi
/boot/efi/EFI/boot/bootx64.efi
has hardcoded path to /boot/efi/EFI/opensuse/grub.cfg
which it tries to load
/boot/efi/EFI/opensuse/grub.cfg
has follwoing contents
set btrfs_relative_path="yes"
search --fs-uuid --set=root {UUID}
set prefix=(${root})/boot/grub2
source "${prefix}/grub.cfg"
which I ASSUME mounts default btrfs subvolume from FS on /dev/sda2
and loads next grub config from that subvolume /boot/grub2/grub.cfg
that resides on opensuse root subvolume.
I can manually alter that config and insert ubuntu menuentries but those would be on subvolume that is not mounted, since default one is mounted outside that config and before any OS choices
Can I replace grub.cfg
on /boot/efi/EFI
with one from OS root subvolume? Or there are some tools that should do that for me?!