Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 8th May 2011, 05:57 AM
VastOne Offline
Registered User
 
Join Date: Apr 2011
Location: On a desperate edge...
Posts: 169
linuxfedorafirefox
How-To Using Grub2 in Fedora

The following outlines how to install and use Grub2 in Fedora. It will be an ongoing How-To as more of the tools involved are added upstream

Small History... I came over from Canonical/Ubuntu and was surprised to see that Grub2 was not that widely used or even developed..

I found this blog posting from Hedayat Vatankhah at his blogsite and this is what I did to replace the Ubuntu Grub2 with Fedora grub2 with the os-prober that Hedayat ported to Fedora and installing grub2

1: Install os-prober

Code:
sudo yum install os-prober
2: Install grub2 using yum

Code:
sudo yum install grub2
3: Install grub2 to the mba

Code:
sudo grub2-install /dev/sda
4: edit /etc/default/grub

Code:
sudo gedit /etc/default/grub
and add this line

Code:
GRUB_DISTRIBUTOR=$(sed "s/.*(\(.*\))/\1/" /etc/system-release)
This fixes this bug in Grub2 that does not correctly identify Fedora distribution name in the proper syntax

You can also add

Code:
GRUB_DEFAULT=2
to set what the default boot is ... In my case it is the 3rd boot line (Remember that in grub the first item is 0, the second is one the third is two etc etc etc)

You can also add

Code:
GRUB_TIMEOUT=10
the default is 5.. If you want 5 then this is not needed... If you want more then add it to what you want

Note
Anytime this file is changed you must run the command outlined in step 4

4: Now run this to update grub.cfg

Note
You will need to run this same thing any time there is a new kernel added anywhere on your system

Code:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Thats it.. When you reboot, it will be Fedoras grub2 and the same options are always there..

This is what my finished /boot/grub2/grub.cfg looks like

Code:
#
# /boot/grub2/grub.cfg

# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="2"
if [ ${prev_saved_entry} ]; then
  set saved_entry=${prev_saved_entry}
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z ${boot_once} ]; then
    saved_entry=${chosen}
    save_env saved_entry
  fi
}
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 951268a2-e667-4181-978c-526c0b71cf02
set locale_dir=($root)/boot/grub2/locale
set lang=en
insmod gettext
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Lovelock GNU/Linux, with Linux 2.6.39-0.rc4.git2.0.fc15.x86_64" --class lovelock --class gnu-linux --class gnu --class os {
	set gfxpayload=keep
	insmod ext2
	set root='(hd0,6)'
	search --no-floppy --fs-uuid --set 951268a2-e667-4181-978c-526c0b71cf02
	echo	Loading Linux 2.6.39-0.rc4.git2.0.fc15.x86_64 ...
	linux	/boot/vmlinuz-2.6.39-0.rc4.git2.0.fc15.x86_64 root=UUID=951268a2-e667-4181-978c-526c0b71cf02 ro quiet rhgb 
	echo	Loading initial ramdisk ...
	initrd	/boot/initramfs-2.6.39-0.rc4.git2.0.fc15.x86_64.img
}
menuentry "Lovelock GNU/Linux, with Linux 2.6.39-0.rc4.git2.0.fc15.x86_64 (recovery mode)" --class lovelock --class gnu-linux --class gnu --class os {
	set gfxpayload=keep
	insmod ext2
	set root='(hd0,6)'
	search --no-floppy --fs-uuid --set 951268a2-e667-4181-978c-526c0b71cf02
	echo	Loading Linux 2.6.39-0.rc4.git2.0.fc15.x86_64 ...
	linux	/boot/vmlinuz-2.6.39-0.rc4.git2.0.fc15.x86_64 root=UUID=951268a2-e667-4181-978c-526c0b71cf02 ro single quiet rhgb
	echo	Loading initial ramdisk ...
	initrd	/boot/initramfs-2.6.39-0.rc4.git2.0.fc15.x86_64.img
}
menuentry "Lovelock GNU/Linux, with Linux 2.6.38.5-24.fc15.x86_64" --class lovelock --class gnu-linux --class gnu --class os {
	set gfxpayload=keep
	insmod ext2
	set root='(hd0,6)'
	search --no-floppy --fs-uuid --set 951268a2-e667-4181-978c-526c0b71cf02
	echo	Loading Linux 2.6.38.5-24.fc15.x86_64 ...
	linux	/boot/vmlinuz-2.6.38.5-24.fc15.x86_64 root=UUID=951268a2-e667-4181-978c-526c0b71cf02 ro quiet rhgb 
	echo	Loading initial ramdisk ...
	initrd	/boot/initramfs-2.6.38.5-24.fc15.x86_64.img
}
menuentry "Lovelock GNU/Linux, with Linux 2.6.38.5-24.fc15.x86_64 (recovery mode)" --class lovelock --class gnu-linux --class gnu --class os {
	set gfxpayload=keep
	insmod ext2
	set root='(hd0,6)'
	search --no-floppy --fs-uuid --set 951268a2-e667-4181-978c-526c0b71cf02
	echo	Loading Linux 2.6.38.5-24.fc15.x86_64 ...
	linux	/boot/vmlinuz-2.6.38.5-24.fc15.x86_64 root=UUID=951268a2-e667-4181-978c-526c0b71cf02 ro single quiet rhgb
	echo	Loading initial ramdisk ...
	initrd	/boot/initramfs-2.6.38.5-24.fc15.x86_64.img
}
menuentry "Lovelock GNU/Linux, with Linux 2.6.38.5-22.fc15.x86_64" --class lovelock --class gnu-linux --class gnu --class os {
	set gfxpayload=keep
	insmod ext2
	set root='(hd0,6)'
	search --no-floppy --fs-uuid --set 951268a2-e667-4181-978c-526c0b71cf02
	echo	Loading Linux 2.6.38.5-22.fc15.x86_64 ...
	linux	/boot/vmlinuz-2.6.38.5-22.fc15.x86_64 root=UUID=951268a2-e667-4181-978c-526c0b71cf02 ro quiet rhgb 
	echo	Loading initial ramdisk ...
	initrd	/boot/initramfs-2.6.38.5-22.fc15.x86_64.img
}
menuentry "Lovelock GNU/Linux, with Linux 2.6.38.5-22.fc15.x86_64 (recovery mode)" --class lovelock --class gnu-linux --class gnu --class os {
	set gfxpayload=keep
	insmod ext2
	set root='(hd0,6)'
	search --no-floppy --fs-uuid --set 951268a2-e667-4181-978c-526c0b71cf02
	echo	Loading Linux 2.6.38.5-22.fc15.x86_64 ...
	linux	/boot/vmlinuz-2.6.38.5-22.fc15.x86_64 root=UUID=951268a2-e667-4181-978c-526c0b71cf02 ro single quiet rhgb
	echo	Loading initial ramdisk ...
	initrd	/boot/initramfs-2.6.38.5-22.fc15.x86_64.img
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Ubuntu 10.10 (10.10) (on /dev/sda1)" {
	insmod ext2
	set root='(hd0,1)'
	search --no-floppy --fs-uuid --set 788582ac-a45e-4289-8fc3-36d3caaa0137
	linux /boot/vmlinuz-2.6.38-020638-generic root=/dev/sda1
	initrd /boot/initrd.img-2.6.38-020638-generic
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/90_persistent ###
### END /etc/grub.d/90_persistent ###
Note
I am using Fedora 15 .. this should work with any Fedora release that supports grub2

I want to stress again that this is an ongoing project and will be updated as the changes happen

EDIT

May 8 2011

I got grub2 1.99~rc2 up and functioning perfectly with os-prober

If you compile grub2 1.99~rc2 you must create

/usr/local/etc/default

and then copy the file grub from /etc/default to /usr/local/etc/default

This will then read and parse the grub file information

Last edited by VastOne; 9th May 2011 at 04:56 PM. Reason: update info regarding grub2 1.99~rc2
Reply With Quote
  #2  
Old 8th May 2011, 06:10 AM
tox
Guest
 
Posts: n/a
linuxchrome
Re: How-To Using Grub2 in Fedora

i have asked in Bugzilla if 1.99 final will be available for F15, i'll try an keep this updated if it is or not
Reply With Quote
  #3  
Old 8th May 2011, 06:12 AM
VastOne Offline
Registered User
 
Join Date: Apr 2011
Location: On a desperate edge...
Posts: 169
linuxfedorafirefox
Re: How-To Using Grub2 in Fedora

Quote:
Originally Posted by detox View Post
i have asked in Bugzilla if 1.99 final will be available for F15, i'll try an keep this updated if it is or not
I appreciate that... Thank you
Reply With Quote
  #4  
Old 9th May 2011, 04:59 PM
VastOne Offline
Registered User
 
Join Date: Apr 2011
Location: On a desperate edge...
Posts: 169
linuxfedorafirefox
Re: How-To Using Grub2 in Fedora

An interesting note, in grub2 1.99~rc2 the '2' has been removed from the commands

grub2-mkconfig

is

grub-mkconfig

This may change when packaged for Fedora, I do not know for sure...?
Reply With Quote
  #5  
Old 10th May 2011, 12:12 AM
tox
Guest
 
Posts: n/a
linuxchrome
Re: How-To Using Grub2 in Fedora

me neither dude sorry

---------- Post added at 09:12 AM ---------- Previous post was at 08:53 AM ----------

here's your Bug and a followup http://lists.gnu.org/archive/html/bu.../msg00040.html http://savannah.gnu.org/bugs/?33265
Reply With Quote
  #6  
Old 10th May 2011, 01:22 AM
VastOne Offline
Registered User
 
Join Date: Apr 2011
Location: On a desperate edge...
Posts: 169
linuxfedorafirefox
Re: How-To Using Grub2 in Fedora

Quote:
Originally Posted by detox View Post
me neither dude sorry

---------- Post added at 09:12 AM ---------- Previous post was at 08:53 AM ----------

here's your Bug and a followup http://lists.gnu.org/archive/html/bu.../msg00040.html http://savannah.gnu.org/bugs/?33265
Compiling it with

./configure --prefix=/usr

would have done it correctly...

My haste got the best of me...

Thanks...

On another note, Debian allows for entries like this in 40_custom entries

menuentry “Daily on sda6″ {
set root=(hd0,13)
linux /vmlinuz root=/dev/sda6 ro quiet splash
initrd /initrd.img
}

where the latest kernel entry is found in /boot on sda6 because Debian has built in symlinks...

Is there an easy way to add these symlinks to Fedora to allow for the same thing?

And on a larger scale, I am curious as to why it is not there by default... It would make things much easier... Especially when testing daily builds or multiple distros
Reply With Quote
  #7  
Old 10th May 2011, 04:12 PM
fpmurphy Offline
Registered User
 
Join Date: May 2009
Location: /dev/ph
Posts: 313
windows_7firefox
Re: How-To Using Grub2 in Fedora

You can eliminate most problems with GRUB2 by simply editing grub.cfg directly.

The requirement to edit /etc/default/grub and then run grub-mkconfig adds a layer of complexity to GRUB2 not needed by most users.
Reply With Quote
  #8  
Old 10th May 2011, 04:16 PM
VastOne Offline
Registered User
 
Join Date: Apr 2011
Location: On a desperate edge...
Posts: 169
linuxfedorafirefox
Re: How-To Using Grub2 in Fedora

Quote:
Originally Posted by fpmurphy View Post
You can eliminate most problems with GRUB2 by simply editing grub.cfg directly.

The requirement to edit /etc/default/grub and then run grub-mkconfig adds a layer of complexity to GRUB2 not needed by most users.
True..

Most users of grub2 (in Debian) are used to this method and complexity as it has always been the norm to edit /etc/default/grub and then run update-grub
Reply With Quote
  #9  
Old 18th May 2011, 08:36 PM
hedayat Offline
Registered User
 
Join Date: Sep 2007
Location: Isfahan, Iran
Age: 28
Posts: 18
linuxfirefox
Re: How-To Using Grub2 in Fedora

Quote:
Originally Posted by VastOne View Post
An interesting note, in grub2 1.99~rc2 the '2' has been removed from the commands

grub2-mkconfig

is

grub-mkconfig

This may change when packaged for Fedora, I do not know for sure...?
Yes, the "2" is added in Fedora packaging to clearly separate it from Fedora's Grub 1.
Reply With Quote
  #10  
Old 18th May 2011, 10:06 PM
bob Offline
Administrator (yeah, back again)
 
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 69
Posts: 22,084
linuxfirefox
Re: How-To Using Grub2 in Fedora

moved to Guides & Solutions
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651


Don't use any of my solutions on working computers or near small children.
Reply With Quote
  #11  
Old 10th June 2011, 05:25 AM
towheedm Offline
Registered User
 
Join Date: May 2011
Location: Trinidad & Tobago
Posts: 20
linuxubuntufirefox
Re: How-To Using Grub2 in Fedora

A broken dependency in GRUB2 requires that you install the gettext first if it was not installed by some other package.

Code:
su -c "yum install gettext"
Or has this been fixed?
Reply With Quote
  #12  
Old 10th June 2011, 03:21 PM
fpmurphy Offline
Registered User
 
Join Date: May 2009
Location: /dev/ph
Posts: 313
windows_7firefox
Re: How-To Using Grub2 in Fedora

The latest GRUB2 sources come with an internal gettext. See ../grub-core/gettext/gettext.c and read the ABOUT-NLS file.

To include the internal gettext support use
Code:
./configure --with-included-gettext
Reply With Quote
  #13  
Old 11th June 2011, 12:44 AM
towheedm Offline
Registered User
 
Join Date: May 2011
Location: Trinidad & Tobago
Posts: 20
linuxubuntufirefox
Re: How-To Using Grub2 in Fedora

Actually, I was referring to GRUB2 available from the repos, not building from source.

---------- Post added at 07:44 PM ---------- Previous post was at 07:25 PM ----------

To be a bit more accurate:

From the first post:

Quote:
3: Install grub2 to the mba
Should be install GRUB2 bootloader to the MBR (Master Boot Record). What is MBA?

Quote:
4: edit /etc/default/grub

Code:
Code:
sudo gedit /etc/default/grub
and add this line

Code:
Code:
GRUB_DISTRIBUTOR=$(sed "s/.*(\(.*\))/\1/" /etc/system-release)
Of course you can also install the lsb package:
Code:
su -c "yum install redhat-lsb"
And add the line:
Code:
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null`
to you /etc/default/grub configuration file, which would keep it it in line with other distros.

Or, forget all of the above and simply add:
Code:
GRUB_DISTRIBUTOR="Fedora"
Quote:
I got grub2 1.99~rc2 up and functioning perfectly with os-prober

If you compile grub2 1.99~rc2 you must create

/usr/local/etc/default

and then copy the file grub from /etc/default to /usr/local/etc/default

This will then read and parse the grub file information
QUESTION: Would this be necessary if you set prefix=/usr instead oif /usr/local? In Ubuntu the above is not necessary with prefix=/usr.
Reply With Quote
  #14  
Old 16th June 2011, 10:11 PM
Andre Gompel Offline
Registered User
 
Join Date: Feb 2005
Posts: 45
linuxubuntuchrome
Smile Re: How-To Using Grub2 in Fedora- Does "yum update" still work

Question:
when Fedora 15 is installed with Grub 2, then does automated updates of kernels works?

Else we should run "Grub-update", after the proper RPM has installed the initrd, and new kernel (and a bit more) into /boot.

Hopefully that works, else an RPM package to do the work for Fedora 15, to behave properly when used with Grub 2, would be both feasible, and a great first step towards full support and test of Grub 2, with upcoming versions of Fedora, starting with Fedora 16.

Any volunteer? (Unfortunately not me for now: busy w/Embedded Linux)
Reply With Quote
  #15  
Old 17th June 2011, 01:14 AM
fpmurphy Offline
Registered User
 
Join Date: May 2009
Location: /dev/ph
Posts: 313
windows_7firefox
Re: How-To Using Grub2 in Fedora

No, automatic creation of a new menu stanza for GRUB2 does not occur at present when a kernel is updated on F15.
Reply With Quote
Reply

Tags
fedora, grub, grub2, grub2-mkconfig, setup

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
boot fedora from iso using loopback in grub2 geseeker Installation, Upgrades and Live Media 19 27th February 2013 08:13 PM
dual booting fedora and ubntu should i use grub or grub2? sreek Installation, Upgrades and Live Media 5 13th November 2011 05:00 AM
how to install grub2+fedora instead of mac os? fmmail Mac Chat 4 29th April 2011 12:58 AM
Error in building Grub2 in Fedora 10 justdo Using Fedora 0 22nd September 2009 03:29 PM
Grub2 on Fedora Core 4 Computer Guru Using Fedora 8 8th November 2005 11:58 AM


Current GMT-time: 08:36 (Saturday, 02-08-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat