You are not logged in.

#1 2013-12-26 13:37:08

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

chainload GRUB on btrfs subvolume from MBR-installed GRUB

Hi,

I have two linux distros (Ubuntu and Arch) installed on a computer, both having their root on a dedicated btrfs subvolume. There is one FAT32 partition on the drive which was originally the /boot partition for Ubuntu. Arch was installed later and I need it to have a separate bootloader, because of crossdistro-incompatible grub2 maintenance routines (i.e. Ubuntu gets a grub or kernel update which triggers grub reconfiguration possibly screwing up Arch's grub entries and vice versa). Therefore I need a separate grub installation for each distro.

What I'd like to see is a grub configuration for Arch that can be chainloaded from ubuntu's "system-wide" bootloader. Note that I cannot install Arch's grub to any partition in "grub-install /dev/sdaX" as there is no such partition available (Arch installation resides only in btrfs subvolumes).

Any hints? So far I managed to get Arch's grub partially chainloaded by "chainloader (hd0,msdos5)/archroot/boot/grub/boot.img" but no menu is showed and Ubuntu's grub falls back in a second.

thanks,

-miky


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#2 2013-12-26 16:21:34

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: chainload GRUB on btrfs subvolume from MBR-installed GRUB

I really think that this is over complicating things.  I understand that the user of ubuntu really takes away some of the control you have in Arch, in particular the regeneration of the bootloader configs.  But maintaining two separate bootloaders, and chainloading between them because of this seems to be just asking for more trouble than what you already have.

Instead of trying to chainload to hell, why not just try to solve the actual problem of Arch vs os-prober?  I am not an os-prober user, nor do I actually rely on grub as my primary bootloader, but I have read that having an /etc/lsb-release helps os-prober identify things (this can now be simply installed with the lsb-release package).

Otherwise, we are fortunate that kernels and initramfs' in Arch are consistently named without version numbers.  This should allow you to actually not use os-prober at all in ubuntu, and then simply manually input your required Arch entry into one of the custom entries in /etc/grub.d.  This is probably the route that I would take since I don't know a whole hell of a lot about grub.

Offline

#3 2013-12-27 17:16:24

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: chainload GRUB on btrfs subvolume from MBR-installed GRUB

Thanks for the tip. I'll look into it but I'm afraid it's not going to work for me as I prefer to have a distro-agnostic solution, coz chances are Arch will get replaced by some no-fuss user-proof distro. It's my mom's lappy and must require little-to-no maintenance - Arch, albeit being the best distro for me for last 8 years or so, is consistently failing doing the same job for my mom.

Having separate bootloaders for each distro should make it tamper-proof. It must not fail in any case, but as soon as one bootloader gets maintained by two bfu distros, it's asking for trouble and I can't have that.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#4 2013-12-28 01:28:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: chainload GRUB on btrfs subvolume from MBR-installed GRUB

But if you are writing a bootloader to the partition superblock, this is something that grub2 doesn't actually support and is considered potentially fragile.  If you are dead set on chainloading, then I would say to use syslinux/extlinux for the partition.

In any case, if you do end up sticking with Arch, then the Arch portion will not require any actual bootloader maintenance.  Since the kernel is always /boot/vmlinuz-linux and the initramfs is always /boot/initramfs-linux.img, that portion of the bootloader config should stay consistent.  That is why I was saying that it might make more sense to do away with os-prober and then simply put an exact config portion into /etc/grub.d/40_custom for Arch.  At most, you may need to possibly change the kernel command line in the future, but those kinds of things tend to be optional.

Offline

#5 2013-12-28 10:45:18

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: chainload GRUB on btrfs subvolume from MBR-installed GRUB

There is no partition to start with. The entire Arch installation lives on a btrfs subvolume (which btw means I do need kernel boot parameters hmm ). If there was a partition, it would have already worked out smile

I would be happiest if there was no bootloader for the second distro. That is possible with Arch as you correctly pointed out, as Arch links kernels to a stable name. But as I said, I'd prefer a distro-agnostic solution.

Consider this an experiment:

How to load a GRUB instance from within another GRUB instance in the same manner as linux kernel is loaded, i.e. from a file, not from a boot sector.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#6 2013-12-28 15:27:42

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: chainload GRUB on btrfs subvolume from MBR-installed GRUB

Aaahh, then you have nowhere to actually install it to and you don't have this choice.  You will be forced to use one bootloader and one bootloader only as there is only one viable spot for it to be installed to.

Offline

Board footer

Powered by FluxBB