Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub 2 - getting mine working...
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
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1271
Location: Adelaide/Australia

PostPosted: Sat Oct 19, 2013 3:55 am    Post subject: grub 2 - getting mine working... Reply with quote

I have been a long time user of legacy grub.
I dual boot Gentoo linux and Windows 7.
My existing grub config looks like this
Code:
default 0
fallback 1
timeout 5

# raid not assembling does not seem to actually not assemble
title Gentoo Linux 3.10.7-gentoo-r1 GenKernel no Kernel RAID Assemble
root (hd2,0)
kernel /boot/kernel-genkernel-x86_64-3.10.7-gentoo-r1 dolvm domdadm raid=noautodetect real_root=/dev/md126 root=/dev/md126 video=uvesafb:ywrap,mtrr:3,1280x1024-32@60
initrd /boot/initramfs-genkernel-x86_64-3.10.7-gentoo-r1

title GRUB2 Chainload
root (hd2,0)
kernel /boot/grub/i386-pc/core.img
boot

title Windows 7 x64 (from hd1)
#map (hd0) (hd1)
#map (hd1) (hd0)
rootnoverify (hd1,0)
makeactive
chainloader +1
boot


My specifics include

  • I use XFS
  • I have multiple XFS partitions, not a single root partition.
  • I have a separate /usr partition
  • I have an initrd to deal with the separate root partition
  • I use LVM to host all my partitions except root and boot
  • I have RAID 1 of boot, root and LVM partitions
  • I dual boot to Windows 7


Given all this wonderfulness, of course, the out of the box grub 2 does not work.

It seems to think my root partition is my /usr partition which it successfully finds in LVM, when in actual fact, my root partition is a raw, mirrored partition.

So, I had to throw out the entire automated menu list by removing execute permission on

  • /etc/grub.d/10_linux
  • /etc/grub.d/20_linux_zen
  • /etc/grub.d/30_os-prober

and create my own /etc/grub/40_custom, as follows

Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
echo "Creating Lyalls Custom entries..."

menuentry "Linux" {
    set root=(hd2,1)
    linux "/boot/kernel-genkernel-x86_64-3.10.7-gentoo-r1"  dolvm domdadm raid=noautodetect real_root=/dev/md126 root=/dev/md126 video=uvesafb:ywrap,mtrr:3,1280x1024-32@60
    initrd /boot/initramfs-genkernel-x86_64-3.10.7-gentoo-r1
}
menuentry "Windows" {
    set root=(hd1,1)
    chainloader (hd1,1)+1
}


This worked. I can chainload from grub legacy to grub 2, the grub 2 menu displays and I can boot Linux, windows also boots.

The fact that my Grub2 menu doesn't seem to include a whole pile of confusing options now, is also an improvement, IMHO.

I am sure I can do all sorts of wonderful things, but less is more. :)

I thought I would share.

:)
_________________
...Lyall
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2331
Location: Canada

PostPosted: Sat Oct 19, 2013 5:12 am    Post subject: Reply with quote

At some stage you need to delete legacy grub, otherwise - what's the point ?
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sat Oct 19, 2013 5:36 am    Post subject: Reply with quote

Yes, have been using 40_custom here too; because well, I haven't yet spend time on trying to fit what I want in the auto detection style.

dmpogo wrote:
At some stage you need to delete legacy grub, otherwise - what's the point ?


Seems like a neat way to make the switch without having to worry about breaking what's already in place.
Back to top
View user's profile Send private message
mackal
Tux's lil' helper
Tux's lil' helper


Joined: 04 Aug 2011
Posts: 78

PostPosted: Sat Oct 19, 2013 7:02 am    Post subject: Reply with quote

Read the wiki page.

From what I can tell you need sys-boot/grub:2 device-mapper and then add GRUB_PRELOAD_MODULES=lvm in /etc/default/grub

You will also set GRUB_CMDLINE_LINUX="video=uvesafb:ywrap,mtrr:3,1280x1024-32@60" in /etc/default/grub

If the USE flag change and the PRELOAD thing doesn't do the LVM stuff, you might be able to get it working right adding it to GRUB_CMDLINE_LINUX.

You can also uncomment GRUB_DISABLE_LINUX_UUID=true if you don't want to use UUID.
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1271
Location: Adelaide/Australia

PostPosted: Sat Oct 19, 2013 11:36 pm    Post subject: Reply with quote

Regarding removing legacy grub, yeah, I plan to, but I think I will leave it there for a bit whilst I continue to experiment with Grub2.

In particular, the wiki page seems to have improved quite significantly since I looked last time.

I will see how I go at tweaking config options, etc, to try make my setup a bit more flexible and move away from the hard coding which I currently have.
_________________
...Lyall
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