On Mon, Mar 6, 2023 at 5:16 PM Michael Peters <[email protected]> wrote: > > Hi. I'm trying to figure out how to chainload one grub to another. > > bios boot, not UEFI. > grub 2.06 built from source. > > What GNU/Linux identifies as /dev/sdc has a CentOS 7.9 install with its own > /boot at /dev/sdc1 and the operating system root at /dev/sdc2. I have had > too many bad experiences with a shared /boot between multiple Linux > installs, especially when package managers like to rewrite the grub > configuration file. > > What GNU/Linux identifies as /dev/sda has a "Linux From Scratch" install > with its own /boot at /dev/sda1 and the operating system root at /dev/sda2. > > Switching the boot order in the bios every time I want to switch operating > systems is a royal pain in the arse, but I also don't want a shared /boot > partition. > > What I would like to do is keep the /dev/sda (the drive with Linux From > Scratch) as the boot drive the bios sees, but have a menu entry that will > chain load the CentOS managed grub. > > I've tried several things, this is the latest but it also doesn't work > (CentOS entry is the bottom) > > ==== > # Begin /boot/grub/grub.cfg > set default=0 > set timeout=5 > > insmod ext2 > # LFS grub root=/dev/sda1 > search --set=root --fs-uuid 2322f8e6-1d3d-43ee-becf-67417a46e124 > > # filesystem root=/dev/sda2 > menuentry "GNU/Linux, Linux 6.1.15-lfs-11.3" { > linux /vmlinuz-6.1.15-lfs-11.3 root=PARTUUID=d92d2b64-02 ro > } > menuentry "GNU/Linux, Linux 6.1.14-lfs-11.3" { > linux /vmlinuz-6.1.14-lfs-11.3 root=PARTUUID=d92d2b64-02 ro > } > > # CentOS grub root=/dev/sdc1 (but can change...) > menuentry "CentOS 7.9 GNU/Linux" { > insmod chain > insmod ext2 > search --set=root --fs-uuid 7c405b03-a178-474d-a777-a8ba6359f565 > chainloader +1 > } > > # End /boot/grub/grub.cfg > ==== > > That attempt based on Windows 7 example I saw. > > It results in the following message: > > ==== > error: invalid signature. > > Press any key to continue... > ==== >
Where is grub installed by OS on sdc? You need to load boot block form the device where grub was installed. Also depending on how exactly grub image was created you may need to map this device to the first BIOS disk (0x80). > Is chainloading grub from one physical drive to grub on another physical > drive possible? > Yes. > How is it done? You load grub stage1 code from where it was installed. You can also load core.img directly using multiboot command (on legacy BIOS).
