View previous topic :: View next topic |
Author |
Message |
ONEEYEMAN Advocate

Joined: 01 Mar 2005 Posts: 2773
|
Posted: Sat Jun 14, 2014 10:03 am Post subject: Where is GRUB2 |
|
|
Hi, ALL,
I did my install of Gentoo according to Handbook using GPT labeling scheme. During partitioning I made 4 primary partitions: 1MB -> grub, 128M -> boot, 2G -> swap, 250G -> root.
Now as far as I understand GRUB2 is installed in the first partition called grub and it does not touches MBR.
Am I right?
Thank you. |
|
Back to top |
|
 |
vaxbrat l33t


Joined: 05 Oct 2005 Posts: 731 Location: DC Burbs
|
Posted: Sat Jun 14, 2014 4:15 pm Post subject: There's still code in the MBR |
|
|
If you had run grub2-install it will still write the MBR. It will also write into the EF02 partition that you had given it. grub2-mkconfig only updates the /boot/grub/grub.cfg file if you use the -o option. |
|
Back to top |
|
 |
ONEEYEMAN Advocate

Joined: 01 Mar 2005 Posts: 2773
|
Posted: Sat Jun 14, 2014 7:42 pm Post subject: Re: There's still code in the MBR |
|
|
Hi
vaxbrat wrote: |
If you had run grub2-install it will still write the MBR. It will also write into the EF02 partition that you had given it. grub2-mkconfig only updates the /boot/grub/grub.cfg file if you use the -o option.
|
So I have 2 copies of the grub installed: one in the MBR and one in the 1st partition named "grub" correct? Or it is MBR and the second one called boot?
Now, IIUC they both use same /boot/grub/grub.cfg file.
Now what I need to do in order for the second partition's GRUB to kick in when the power turns on?
Thank you. |
|
Back to top |
|
 |
vaxbrat l33t


Joined: 05 Oct 2005 Posts: 731 Location: DC Burbs
|
Posted: Sun Jun 15, 2014 1:19 am Post subject: not exactly |
|
|
I'll refer to my native btrfs wiki entry here:
https://wiki.gentoo.org/wiki/Btrfs_native_system_root
My gpt table there looks like:
Code: | root # gdisk /dev/sdc
GPT fdisk (gdisk) version 0.8.6
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/sdc: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): A5C43D4A-ED5A-4173-BDC0-5D632C0BAEEF
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 8191 3.0 MiB EF02 grub2biosboot
2 8192 1032191 500.0 MiB 8300 boot
3 1032192 3907029134 1.8 TiB 8300 root
Command (? for help):
|
When I did my grub2-install, it wrote the MBR and partition 1 (grub2biosboot). The MBR is for legacy bios style bootup. The MBR isn't big enough for grub2 to work with when trying to find and mount /boot. So the EF02 partition gets the spillover from that and it also handles the next step when an EFI type boot is used instead. The 1-3mb space there lets grub work with more filesystem types for /boot, including ext4 and also "simple" mirror sets for btrfs. From there, grub2 gets /boot mounted and then looks at the /boot/grub/grub.cfg which is updated by grub2-mkconfig. |
|
Back to top |
|
 |
ONEEYEMAN Advocate

Joined: 01 Mar 2005 Posts: 2773
|
Posted: Sun Jun 15, 2014 3:13 am Post subject: |
|
|
Hi, vaxbrat,
What I'm looking for is the setup on which GRUB2 is not installed into the MBR but on the partition. And when the power turns on it is comes up.
I am planning to have a dual-boot machine with Solaris. Latest Solaris is also using GRUB2 which as far as I understand is installed the same way. Problem is Gentoo GRUB, according to Solaris devs, do not know how to boot Solaris. So I'm just wondering how do I install Gentoo GRUB2 into the partition and run it, and then chainload Solaris'es GRUB from it.
I know it is possible to chainload Solaris from Linux GRUB, but I want to make sure that I can have both GRUBs installed on one machine at the same time.
Is it possible?
Thank you. |
|
Back to top |
|
 |
szatox Veteran

Joined: 27 Aug 2013 Posts: 1779
|
Posted: Sun Jun 15, 2014 4:02 pm Post subject: |
|
|
it is possible. You can install 1 bootloader per partition, and you select first one with boot flag (in grub legacy makeactive can do it, or you can use partitioning tool to set flags).
Then you can make your bootloader point to another partition and launch another bootloader from there. |
|
Back to top |
|
 |
ONEEYEMAN Advocate

Joined: 01 Mar 2005 Posts: 2773
|
Posted: Sun Jun 15, 2014 6:32 pm Post subject: |
|
|
Hi,
As I said, I have GPT partitioning scheme. And so fdisk will not work there.
I used parted to make partitions...
How do I make partition bootable there?
Thank you. |
|
Back to top |
|
 |
vaxbrat l33t


Joined: 05 Oct 2005 Posts: 731 Location: DC Burbs
|
Posted: Sun Jun 15, 2014 9:49 pm Post subject: It would be whomever writes the MBR last |
|
|
I wonder if the Solaris devs are confusing grub0.9 with grub2 when talking about gentoo grub not knowing how to boot Solaris. The chainloader approach should work no matter what (hey it boots winders that way right )
I've run away from Solaris as fast as I could since Oracle started being bastards about maintenance. I'm a bit surprised to see they went to grub2, but I guess that's because they are cloning RHEL and want to keep things somewhat the same between their Linux distro and Solaris.
I would say that whoever writes the MBR last with the grub2-install command will be the one controlling chainloads and whatever gets in the grub2bios partition. So have your Solaris grub2 do the honors last. Have they also gone to using /boot or are they still doing their old forth based console program mounting the ufs based rootfs? |
|
Back to top |
|
 |
ONEEYEMAN Advocate

Joined: 01 Mar 2005 Posts: 2773
|
Posted: Sun Jun 15, 2014 10:01 pm Post subject: Re: It would be whomever writes the MBR last |
|
|
Hi, vaxbrat,
vaxbrat wrote: |
I wonder if the Solaris devs are confusing grub0.9 with grub2 when talking about gentoo grub not knowing how to boot Solaris. The chainloader approach should work no matter what (hey it boots winders that way right )
|
Everything is possible.
Just for the reference, here is my discussion about GRUB on the Oracle forum.
vaxbrat wrote: |
I've run away from Solaris as fast as I could since Oracle started being bastards about maintenance. I'm a bit surprised to see they went to grub2, but I guess that's because they are cloning RHEL and want to keep things somewhat the same between their Linux distro and Solaris.
|
Well I just want to check something as a developer. Beside it will be an interesting experience.
vaxbrat wrote: |
I would say that whoever writes the MBR last with the grub2-install command will be the one controlling chainloads and whatever gets in the grub2bios partition. So have your Solaris grub2 do the honors last. Have they also gone to using /boot or are they still doing their old forth based console program mounting the ufs based rootfs?
|
I guess that's what I will do - use Solaris' GRUB to boot Gentoo. But just for the sake of an experiment it would be nice to do it vice versa.
Feel free to chime in and ask that question on the link I gave. You will need to register though.
Also keep in mind that they are off Sat-Sun comparing to Gentoo (lINUX) community.
Thank you. |
|
Back to top |
|
 |
vaxbrat l33t


Joined: 05 Oct 2005 Posts: 731 Location: DC Burbs
|
Posted: Wed Jun 18, 2014 3:01 pm Post subject: I looked at the thread |
|
|
I wonder if oracle did a patched version of grub2 that includes the zfs support. You can be sure it wouldn't have come from upstream because of the license conflicts with gpl, but oracle does own the copyrights to zfs. So I'd say let them handle the mbr and then chainload your gentoo. You will need to go into the /etc/grub.d on the Solaris rootfs in order to do custom boot stanzas for the gentoo kernels and then run their grub2-mkconfig.
Because they probably have a patched grub2 version, I wouldn't be surprised if they managed to squeeze the zfs loader support in the small amount of mbr space available. Maybe they threw out something to make room? Otherwise it's possible they are hiding it in the dead zone that's padding between the MBR and the first GPT partition. |
|
Back to top |
|
 |
ONEEYEMAN Advocate

Joined: 01 Mar 2005 Posts: 2773
|
Posted: Wed Jun 18, 2014 9:47 pm Post subject: |
|
|
vaxbrat,
Yes, it looks like everybody tells to use Solaris and chainload Gentoo from Solaris' GRUB.
Now in order to do that IIUC, I need to boot Gentoo from LiveCD and install grub in the partition instead of MBR, right? So that I can point Solaris GRUB for the chainload to that partition.
So, now the questions are: am I right and how to do it?
Thank you. |
|
Back to top |
|
 |
vaxbrat l33t


Joined: 05 Oct 2005 Posts: 731 Location: DC Burbs
|
Posted: Thu Jun 19, 2014 2:33 am Post subject: might not need to do that |
|
|
If the Solaris version is indeed a grub2 variant, you should have an /etc/grub.d directory on its root filesystem. In there you should see something like a 40_custom file. I don't have it in front of me, but somebody has a wiki or faq on grub2 that should be able to walk you through putting stanzas in there for your gentoo. I suspect you may be able to cut and paste most of what you got in your grub.cfg file when you ran grub2-mkconfig on gentoo. You then should have a grub-mkconfig or grub2-mkconfig in your Solaris /usr/sbin or wherever that will merge everything into wherever its grub.cfg ends up in the Solaris /boot partition. |
|
Back to top |
|
 |
ONEEYEMAN Advocate

Joined: 01 Mar 2005 Posts: 2773
|
Posted: Thu Jun 19, 2014 7:53 am Post subject: |
|
|
Hi,
It's even easier now with Solaris 11.1. See this link.
Problem is I don't know which scenario to use. I do have a BIOS system (amd64) which is GPT based.
So I take it I have to go with the scenario 1 from the link above and change the last 2 lines to read like the last 2 lines on the scenario 2.
Will try that and come back....
Thank you.
P.S.: In case you are wondering: they don't have ext2/ext3 support in GRUB so chainloading from Solaris is the only option... |
|
Back to top |
|
 |
|