Why is installing GRUB2 to a partition's boot sector discouraged?

I am am multi-booting Arch, Fedora and Windows. I don't use Windows much, and I only keep Fedora around as backup.

Since Fedora needs to change its GRUB entry every time it gets a new kernel, I have Fedora controlling the boot sequence. Since I primarily use Arch, it seems a little silly for Fedora to own GRUB, especially since I am more likely to replace Fedora than Arch (and then I'd have to set up GRUB all over again).

I was thinking about chain loading GRUB2. Arch would own GRUB and include an option to chain load Fedora's GRUB. If I replace Fedora, I would just need the new distro to install GRUB to it's partition and I wouldn't have to touch a thing in Arch. For example:

Arch's GRUB entries:

Arch Linux
Windows
Other (chain load)

Fedora's GRUB entries:

Fedora
Windows

If I break Arch's GRUB, I can boot into a live CD, reinstall GRUB to point to Fedora and fix everything else from Fedora.

However, I read on the Arch wiki that this is not supported and may cause stability issues in GRUB.

What does that mean exactly? Is there a better way to have Arch own GRUB, but also let Fedora update its own entries when it gets a new kernel? It would be awesome if I could load additional entries from another partition's grub.cfg...

Re: Why is installing GRUB2 to a partition's boot sector discouraged?

Hi,The problem that may occur is stated on the same page:

grub-bios relies on embedded blocklists in the partition bootsector to locate the /boot/grub/i386-pc/core.img file and the prefix dir /boot/grub.
The sector locations of core.img may change whenever the filesystem in the partition is being altered (files copied, deleted etc.)

The workaround:

The workaround for this is to set the immutable flag on /boot/grub/i386-pc/core.img (using chattr command as mentioned above)
so that the sector locations of the core.img file in the disk is not altered.

I've done this now several times with Arch, using Xubuntu's Grub to multiboot. the only problems I had:-I never seem to have an i386-pc directory in /boot/grub. I always have to copy it from /usr/lib/grub.-Xubuntu's Grub never sees Arch rightaway. I have to mount the "Arch"-partition" under /mnt (in Xubuntu) , and then I can add it to the Grub menu (Grub Customizer)Apart from this, no problems booting.

Re: Why is installing GRUB2 to a partition's boot sector discouraged?

I saw that, but I wasn't sure if that's all it meant. I get a little wary when I read something that says it's not supported. It doesn't really seem like an unreasonable workaround, especially since grub works on such a low level.

So, do you actually chain load? I was thinking I'd have grub boot arch's config, chain load to fedora's copy of grub then boot fedora. Do you have the same setup?

Re: Why is installing GRUB2 to a partition's boot sector discouraged?

Just my 2 cents - I use syslinux as my bootloader for about 8 distros besides arch on one hdd--I just find syslinux more straightforward than grub2. My other linux distros use grub2 and I always install the others to the root partition with no trouble as they generally have that option and I don't want my Arch syslinux mbr screwed over by another distro's grub. Every once in awhile I've found that when trying out a new distro there is no option to install grub to a partition and they automagically install to the mbr--then I swear a little and reinstall my syslinux mbr from a live arch cd, and remove that distro from further testing. Chainloading is fine from grub2 but I just found syslinux more like legacy grub which I preferred--like I said just my 2 cents. One day I'll have to bite the bullet and give grub2 a real chance.

Time is a great teacher, but unfortunately it kills all its pupils ... - Louis Hector Berlioz

Re: Why is installing GRUB2 to a partition's boot sector discouraged?

Hi,

The normal way to chainload to another grub in grub-legacy was to install the secondary grub on the boot partition of the secondary system, then to chainload it from the primary grub.

The normal way to do this with grub2 is not to chainload a partition, but to load the secondary grub as a kernel, it is explained in this section of the grub wiki.The wiki explains very well how to setup the secondary system (--grub-setup=/bin/true option to grub-install), but I had a hard time to figure out how to load the core.img file from the primary grub, so here it is:

set root='whatever' # or with a search command
multiboot /boot/grub/i386-pc/core.img # or whatever path to it

With this setting, you will have the same behavior as with the grub-legacy chainloading setting, which I think is what you want.