Jump to content
Read the Funtoo Newsletter: Summer 2023 ×
  • 0

Is it possible to install grub to PBR in Funtoo?


fredmyra

Question

I have just installed funtoo on an external disk connected to a laptop and everything has gone well. This is a multiboot set-up with some Linux distros on the external disk and Windows on the internal, just in case I may need it, which is extremely rare.

I have used funtoo in this set-up for about an year without problems, but I accidentally damaged 3 partitions recently and that is why I am reinstalling.

I am still pretty much of a newbie, without formal technical background and I don' t like to mess around with grub. I have been booting most of my multiboot set-ups with Manjaro since my previous favorite bootloader (in Mint) failed to boot Manjaro.  

funtoo's installation guide points the use of ego boot, which led me to post a question here -
 https://forums.funtoo.org/topic/5005-can-i-have-funtoo-in-a-multiboot-set-up/  - when I first installed funtoo.  Unfortunately I don't remember how I dealt with it then in order to have the good result I had. I expect things will work if I just update grub in the booting distribution, which at the moment happens to be MX-Linux, and is working well as a test after I used it on older very limited machine.

I have also been able to boot multiboots by writing "40_custom" files, so  I think I can get funtoo started somehow but I don't want to miss <ego boot>, if possible.

The main reason for this post is that  I have been waiting to find time to try the multibooting suggestion proposed at  https://forums.linuxmint.com/viewtopic.php?f=42&t=315584&p=1807167&hilit=pbear+tutorial+custom+grub#p1807167   which requires installation  of grub to the PBR of non-booting distros, but I am afraid to damage my funtoo installation if I install grub to the PBR of  funtoo's root partition.

When I searched for this topic the only relevant text I found  was this - at  https://unix.stackexchange.com/questions/709783/cannot-find-a-grub-drive-for-dev-sda1-check-your-device-map:

Quote

 

 ... Are you trying to install GRUB with grub-install /dev/sda1?

Since GRUB practically requires access to MBR and the unused space between the MBR and the first partition when installing for BIOS-style boot process, try grub-install /dev/sda. If it still displays the same error message, just write your own /boot/grub/device.map file. In your case, its contents could be just

(hd0)    /dev/sda

(Ideally, you would use an appropriate /dev/disk/by-id/... pathname in place of /dev/sda, but that's not mandatory.)

grub-install /dev/sda1 would attempt to embed GRUB's boot block into PBR of partition sda1 instead of the MBR. Since most filesystems won't have a fixed space for bootloader, GRUB's boot block would have to point at /boot/grub/i386-pc/core.img by physical disk location, which used to be a very seriously discouraged installation mode. Modern versions of GRUB might no longer support installing GRUB that way at all.

The problem is, the boot block code needs to be so small it won't understand filesystems, so it reads the GRUB image using raw disk block numbers determined at GRUB installation time. For this to work, the GRUB core image needs to be placed somewhere where its physical location on disk is guaranteed to stay the same. From the OS viewpoint, /boot/grub/i386-pc/core.img is a regular file, so a defragmentation tool or a smart filesystem driver might occasionally move it to a different physical location on-disk: that would cause a total boot failure.

 

I am pretty unsure about what to do.

P.s.: It just occurred to me that maybe I should rather post this question to some GRUB forum as far as custom.cfgs are concerned,  but as far as funtoo is concerned you guys are my preferred source to answer whether funtoo can have  grub in its PBR.

 

Edited by fredmyra
typo
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...