Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub w/ EFI and LVM
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
darkphoenix16
n00b
n00b


Joined: 23 Apr 2003
Posts: 71
Location: Nova Scotia, Canada

PostPosted: Wed Mar 20, 2013 6:48 pm    Post subject: Grub w/ EFI and LVM Reply with quote

Hello all,

It has been quite a while since I last used Gentoo. After a long switch to debian, I'm back but technology has progressed to the point where I don't know how to properly set up GRUB anymore. Been looking at tutorials but it seems I need a piece from each but I am not sure which pieces.

I have one disc with the following structure

/dev/sda1 EFI partition
/dev/sda2 /boot
/dev/sda3 lvm

lvm looks like

/dev/fedora/root
/dev/fedora/swap
/dev/fedora/home

(I was trying fedora out but wasn't happy with RPM's)

So I take it I need to enable EFI in the kernel and then manually set root=/dev/sda# in it, which seems messy, but the problem is I don't know what I should be pointing to.

Then I need to set up GRUB, but I am not sure what my grub.conf needs to look like. Here is what I have

Code:

title Gentoo
root (hd0,1)
kernel /boot/kernel root=/dev/fedora/root
initrd /boot/initramfs


I'm not sure what root is supposed to be. The boot device? The lvm partition? the logical partitions inside the lvm?


I think I have lvm set to start on boot (used rc-update add)

Any help would be appreciated!
_________________
I really wish I could put something witty here.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


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

PostPosted: Thu Mar 21, 2013 2:55 am    Post subject: Re: Grub w/ EFI and LVM Reply with quote

darkphoenix16 wrote:
I have one disc with the following structure

/dev/sda1 EFI partition
/dev/sda2 /boot
/dev/sda3 lvm


From this, it seems that your computer uses EFI firmware rather than BIOS. I'll proceed under that assumption. If it's incorrect, ignore everything I write below....

Quote:
lvm looks like

/dev/fedora/root
/dev/fedora/swap
/dev/fedora/home

(I was trying fedora out but wasn't happy with RPM's)

So I take it I need to enable EFI in the kernel and then manually set root=/dev/sda# in it, which seems messy, but the problem is I don't know what I should be pointing to.


Yes, you need EFI support in the kernel. You'd set "root=/dev/fedora/root", though, or you could probably do it via the filesystem's UUID value. If you change the volume group's name to something more sensible for a non-Fedora system, you'd need to change the "root=" value to match.

Quote:
Then I need to set up GRUB, but I am not sure what my grub.conf needs to look like. Here is what I have

Code:

title Gentoo
root (hd0,1)
kernel /boot/kernel root=/dev/fedora/root
initrd /boot/initramfs


I'm not sure what root is supposed to be. The boot device? The lvm partition? the logical partitions inside the lvm?


You'd probably want to remove the "/boot" part from the kernel and initrd lines, since these refer to the locations on the /boot partition, rather than on the Linux filesystem. The "root=" part of the kernel line refers to the device that holds the Linux root filesystem.

That said, it looks like you've got a GRUB Legacy setup here, but on EFI that will only work with Fedora's patched GRUB Legacy. AFAIK, the version of GRUB Legacy available via Portage doesn't include Fedora's EFI patches. If you've got this version of GRUB already installed from Fedora, it will probably continue to work with Gentoo, but you'll need to maintain it manually, and there aren't likely to be future updates, since Fedora has switched to GRUB 2.

Personally, I prefer to use the kernel's built-in EFI stub loader on EFI-based systems. This works best in conjunction with a separate boot loader program, such as my rEFInd or gummiboot. If you've gotten Gentoo to boot, you should be able to install rEFInd by running the install.sh script that comes in the binary .zip file. If you're working from an emergency system, though, you'd be better off using the manual installation procedure described in the rEFInd documentation. Given a default refind.conf file, you can create a file called refind_linux.conf in /boot and install an EFI driver for the filesystem you use on /boot to have rEFInd detect and boot your kernels automatically. This is all described in the rEFInd documentation, on the sub-page on booting Linux.
Back to top
View user's profile Send private message
darkphoenix16
n00b
n00b


Joined: 23 Apr 2003
Posts: 71
Location: Nova Scotia, Canada

PostPosted: Thu Mar 21, 2013 4:31 pm    Post subject: Reply with quote

Thank you very much for the post. After 10 years I thought I would be an expert by now ;)

I followed *some* of your instructions, trying to change as few things as possible so that I don't get myself into a bigger mess. I got Grub2 installed, generated a kernel with a efi stub (although I am fairly certain I am not using it) and got the system to boot.

however, grub cannot find /dev/fedora/root because the volume group hasn't been loaded. So on boot failure (root isn't found) I drop to a shell and use

Code:

lvm vgchange -ay fedora


Then allow grub to search again by pressing ENTER after exiting the shell, and continue on my merry way.

I've found references to scripts so I created /boot/init which does what I described above, but it does not appear to be running. How do I get grub to run this script before trying to boot root? Can I do this in grub.cfg?

thanks!
COLIN
_________________
I really wish I could put something witty here.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


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

PostPosted: Thu Mar 21, 2013 4:37 pm    Post subject: Reply with quote

You may need to generate an initramfs with the LVM features active and/or add "dolvm" to the kernel options. For the former, you'd use genkernel:

Code:

genkernel initramfs --lvm
Back to top
View user's profile Send private message
darkphoenix16
n00b
n00b


Joined: 23 Apr 2003
Posts: 71
Location: Nova Scotia, Canada

PostPosted: Fri Mar 22, 2013 12:19 am    Post subject: Reply with quote

Thanks, but I this wasn't it. There is probably something I missed during set up that has caused this, but for now I can live with it. I'll update the thread if/when I find the cause.
_________________
I really wish I could put something witty here.
Back to top
View user's profile Send private message
darkphoenix16
n00b
n00b


Joined: 23 Apr 2003
Posts: 71
Location: Nova Scotia, Canada

PostPosted: Sat Mar 23, 2013 3:40 pm    Post subject: Reply with quote

I've gotten a little further. I changed root= to real_root= in the generated grub.cfg and also added dolvm. Now the system boots by / is in read-only mode. Must be a simple mistake that I am looking into now
_________________
I really wish I could put something witty here.
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