Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub2 Install from running Linux
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Lokesh
n00b
n00b


Joined: 01 Apr 2012
Posts: 3

PostPosted: Sun Apr 01, 2012 4:36 pm    Post subject: Grub2 Install from running Linux Reply with quote

...it does not work. First, apologies if I am not clear, but I am no Linux expert and may not even know how to properly describe the problem.

I have Ubuntu 11.10 installed on my iMac 2006, dual boot with OSX 10.4. I want to additionally install Gentoo, but fail when it comes to the bootloader part.
Here's my partition scheme:
    sda1=EFI
    sda2=OsX
    sda3=this strange grub boot partition that nobody knows what it is used for
    sda4=boot
    sda5=lvm. Lvm contains swap, ubuntu root and a gentoo root partition

For those who are not familiar with Macs: limit is four primary partitions, therefore the only option is the above scheme.

The Ubuntu installed Grub2 identifies the additional kernel, but allocates corresponding root partitions in a random way. Therefore I want a new grub2 install from within Gentoo (chrooted).

I emerged grub2, which took 2 hours until I could unmask it. Compilation took extremely long, at least one hour, which makes me a bit suspicious.
Error message I get from #grub-install /dev/sda:
    "this GPT partition contains no BIOS Boot partition; embedding won't be possible."

The Ubuntu Grub2 installed without problems, so what the hell does that mean?

One note: I tried many instructions, and all had their individual errors. What I need is a detailed instruction tailored to my equipment and situation.

Another note: I am not in love with grub2, if it is possible to remove it and to have a more reliable bootloader, please please tell my how.

Thanks
Lokesh
_________________
Frustrated Linux User
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1576
Location: US

PostPosted: Sun Apr 01, 2012 5:02 pm    Post subject: Reply with quote

Lokesh,

Quote:
The Ubuntu Grub2 installed without problems, so what the hell does that mean?

If you already had or you installed grub in Ubuntu, then you shouldn't need it in gentoo.

I have grub installed in lmde and boot Arch, gentoo and win7 from it. Grub is NOT installed in gentoo or Arch.

The only caveat is I had to make the entries manually and I have to save it off in case lmde updates the kernel or initrd and generates a new grub.cfg.

Never worked with a iMac so I can't speak to that aspect.

Here's my grub.cfg if it helps

.
Back to top
View user's profile Send private message
Lokesh
n00b
n00b


Joined: 01 Apr 2012
Posts: 3

PostPosted: Mon Apr 02, 2012 7:56 am    Post subject: Reply with quote

[quote="BillWho"]Lokesh,

Quote:
The only caveat is I had to make the entries manually and I have to save it off in case lmde updates the kernel or initrd and generates a new grub.cfg..


I could not yet figure out how to do it manually. What is the OS-prober for? It should in theory be better to run the included scripts rather that make manual changes.

Being stuck because of a sh..bootloader that does not do what it is supposed to do is frustrating. The whole Grub2 story anyway seems to be annoying. So many complaints about it, still all distros run simultaneously to use it. I do not understand this.

Removed Grub2, installed Grub legacy, still no luck. Probably the issue is related to a separate /boot partition plus the lvm usage.

Anybody an idea?

Lokesh
_________________
Frustrated Linux User
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1576
Location: US

PostPosted: Mon Apr 02, 2012 11:09 pm    Post subject: Reply with quote

Lokesh,

You should be able to copy and paste my grub entry for gentoo. You would just need to change the uuid entries. blkid will provide that information.
Code:
root@gentoo-gateway script # blkid|grep "1a808cff-31af-4036-8fa7-380098554f71\|b3bfd853-2f66-4946-9a08-428af6f50ba1"
/dev/sdb1: LABEL="gentoo-boot" UUID="1a808cff-31af-4036-8fa7-380098554f71" TYPE="ext2"
/dev/sdb14: LABEL="gentoo-root" UUID="b3bfd853-2f66-4946-9a08-428af6f50ba1" TYPE="ext3"

Hope this helps :wink:
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 310
Location: Woonsocket, RI

PostPosted: Sat Apr 07, 2012 3:35 am    Post subject: Re: Grub2 Install from running Linux Reply with quote

Lokesh wrote:
...it does not work. First, apologies if I am not clear, but I am no Linux expert and may not even know how to properly describe the problem.

I have Ubuntu 11.10 installed on my iMac 2006, dual boot with OSX 10.4. I want to additionally install Gentoo, but fail when it comes to the bootloader part.


There's a lot of confusion and outright misinformation about booting Linux on Macs. You've fallen victim to at least some of that....

Quote:
Here's my partition scheme:
    sda1=EFI
    sda2=OsX
    sda3=this strange grub boot partition that nobody knows what it is used for
    sda4=boot
    sda5=lvm. Lvm contains swap, ubuntu root and a gentoo root partition

For those who are not familiar with Macs: limit is four primary partitions, therefore the only option is the above scheme.


Actually, Intel-based Macs use the GUID Partition Table (GPT) partitioning system, which provides 128 partitions by default. This limit can be raised or, by violating the standard, lowered; but Apple's tools create GPT setups with 128 partition entries.

The limit you're thinking of relates to Apple's tendency to create dangerous hybrid MBRs at the drop of a hat. These overlay a Master Boot Record (MBR) partition table on the GPT scheme; however, because GPT specifies an MBR with a particular partition type (0xEE) to keep GPT-unaware utilities from messing with the disk, hybrid MBRs are limited to three (not four) primary partitions that correspond to three of the GPT partitions. The belief that it's four arises because most hybrid MBR setups place the 0xEE partition first in the table, and it's similar in size and location to the first GPT partition -- but it's not identical.

One more point: I'm guessing that your /dev/sda3 is a BIOS Boot Partition, which holds part of the GRUB 2 code when it's installed to a GPT disk. I can't be sure of this without more detailed information, such as the output of "gdisk -l /dev/sda" or "parted /dev/sda print", and it seems to be contradicted by the below....

Quote:
The Ubuntu installed Grub2 identifies the additional kernel, but allocates corresponding root partitions in a random way. Therefore I want a new grub2 install from within Gentoo (chrooted).
...
Error message I get from #grub-install /dev/sda:
    "this GPT partition contains no BIOS Boot partition; embedding won't be possible."

The Ubuntu Grub2 installed without problems, so what the hell does that mean?


This message suggests that /dev/sda3 is not a BIOS Boot Partition; however, it could be that your GRUB package is messed up in one way or another, or that the type code of the partition got changed after its creation.

In any event, GRUB only tries to use a BIOS Boot Partition when booting on BIOS-based computers. Macs are EFI-based, but they have a BIOS compatibility layer that Apple uses to boot Windows. Unfortunately, many Linux users make use of this feature to boot Linux. This works better than a native EFI boot in some cases, but in other cases it causes problems. If your hardware works properly under Linux from an EFI boot, you'll be able to boot both Ubuntu and Gentoo much more easily that way. (The problem with a native EFI boot is that some hardware -- particularly video drivers -- may not be properly initialized. This problem is most common on models with nVidia video outputs. Apparently the problem has been diminishing with kernels since 3.0, but I don't have detailed information on this.)

Quote:
Another note: I am not in love with grub2, if it is possible to remove it and to have a more reliable bootloader, please please tell my how.


Yes, at least if EFI booting works for you.

Here's my suggestion:


  1. Obtain a 3.3.x kernel source tree and compile it. Be sure to enable the EFI stub loader feature. This feature is new to the 3.3.0 kernel, so getting this kernel is important. If you're not up to compiling your own kernel, then this could be a stumbling block, at least until precompiled 3.3.x kernels with this feature enabled become common. (Fedora's already shipping such a kernel, FWIW.)
  2. Copy your newly-compiled kernel to the EFI System Partition (ESP; /dev/sda1) as EFI/gentoo/bzImage-3.3.x.efi. Note the filename extension of .efi; that's the most critical part, along with a filename that begins with bzImage or vmlinuz.
  3. Copy the initial RAM disk to the same directory you use for the kernel, and give it a filename that includes the same version number.
  4. Install my rEFInd boot manager. Note that using OS X is advisable for at least one step (using bless vs. efibootmgr).
  5. Create a refind_linux.conf file in the ESP directory that holds the kernel, as described here.


With any luck, when you reboot you'll see your kernel in the rEFInd menu and be able to boot it directly. One caveat: On my Mac (an older 32-bit Mac Mini), this method of booting hangs when I try to boot from the ESP. It works if I move the kernel to an HFS+ partition. If necessary, you could convert your ESP or Linux /boot partition to HFS+.

If this method works, you can use one kernel for both your Linux distributions and create separate initrd files for them. There are various ways you could configure this. You'll also be able to convert your hybrid MBR to a conventional protective MBR, which will probably keep your Mac from loading its BIOS compatibility code, which in turn will speed up the boot process by a few seconds. As described on the rEFInd page, kernel upgrades become very easy -- just copy them to the ESP (or some other location that rEFInd probes) under an appropriate name. rEFInd probes for boot loaders at boot time, and with a 3.3.0 or later kernel with EFI stub support, the kernel is its own boot loader. Thus, rEFInd will detect the kernel upgrade and give you a boot option with no need to adjust a configuration file.

If you're not comfortable compiling your own kernel, then I recommend looking at ELILO and Fedora's patched GRUB Legacy. (I describe both of these on my EFI boot loaders Web page.) Both are much less finicky and easier to configure than GRUB 2. I prefer ELILO on 64-bit systems, but I've never gotten it working on my 32-bit Mac Mini or under a 32-bit VirtualBox setup. GRUB Legacy works on most systems, including my Mac, but it produces video problems on some installations. If you use ELILO, you'll probably want to use rEFInd or the earlier rEFIt (from which I forked rEFInd) as a boot manager, since ELILO can't launch the OS X boot loader.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum