Fedora Linux Support Community & Resources Center
  #1  
Old 10th December 2011, 11:50 PM
jonathonp Offline
Registered User
 
Join Date: Oct 2006
Location: Melbourne
Age: 45
Posts: 570
linuxfirefox
How to reinstall grub 2 in Fedora 16?

I'm at a loss as to how to reinstall grub in Fedora 16. There seems to be no documentation available. The ubuntu commands http://www.dedoimedo.com/computers/g...mozTocId232162 are not working.

I want to reinstall grub on the root partition and use a 3rd party boot loader since editing the menu list in grub seems complicated.

i found this:

Code:
su
grub2-install --force /dev/sda
__________________
PC CPU 3.60 Gigahertz Intel Core i7-4790, Motherboard Gigabyte H97M-D3H RAM: 32GB: Fedora 25 MATE x64, ARCH KDE, Solus OS Budgie
Asus Zenbook UX305CA: Fedora 25 Gnome
HP Elitebook 2170p Ubuntu 16.1 Unity & Arch Mate

Last edited by jonathonp; 12th December 2011 at 04:23 AM.
Reply With Quote
  #2  
Old 11th December 2011, 01:18 AM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 1,057
macoschrome
Re: How to reinstall grub 2 in Fedora 16?

grub2-install /dev/sda should just work. What error are you getting? grub.cfg is no longer directly edited except by those who really understand how to do so; instead the user editable files are /etc/default/grub primarily and secondarily the scripts numbered 40 and higher in /etc/grub.d. After editing run

grub2-mkconfig -o /boot/grub2/grub.cfg

This does overwrite your grub.cfg if the command successfully completes with a "done" notification.
Reply With Quote
  #3  
Old 12th December 2011, 02:10 AM
jonathonp Offline
Registered User
 
Join Date: Oct 2006
Location: Melbourne
Age: 45
Posts: 570
linuxfirefox
Re: How to reinstall grub 2 in Fedora 16?

How does one change the default kernel or operating system including the menu layout?

Code:
gedit /etc/default/grub
Code:
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Fedora"
GRUB_DEFAULT=saved
GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8"

As an example how can I make windows 7 the default boot in /etc/default/grub ?

Do i add to the /etc/grub.d/40_custom file?

Code:
### 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 ###
Code:
}
menuentry "Windows 7 (loader) (on /dev/sda3)" --class windows --class os {
	insmod part_msdos
	insmod ntfs
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 187F4BB03E2F5747
	chainloader +1

gedit /boot/grub2/grub.cfg


Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by 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="0"
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
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora (3.1.4-1.fc16.x86_64)' --class fedora --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set=root 7be5fbd4-9921-4623-8d52-dc091036ee40
	echo 'Loading Fedora (3.1.4-1.fc16.x86_64)'
	linux	/boot/vmlinuz-3.1.4-1.fc16.x86_64 root=UUID=7be5fbd4-9921-4623-8d52-dc091036ee40 ro rd.md=0 rd.lvm=0 rd.dm=0  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8 nouveau.modeset=0 rd.driver.blacklist=nouveau
	echo 'Loading initial ramdisk ...'
	initrd /boot/initramfs-3.1.4-1.fc16.x86_64.img
}
menuentry 'Fedora Linux, with Linux 3.1.0-7.fc16.x86_64' --class fedora --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set=root 7be5fbd4-9921-4623-8d52-dc091036ee40
	echo	'Loading Linux 3.1.0-7.fc16.x86_64 ...'
	linux	/boot/vmlinuz-3.1.0-7.fc16.x86_64 root=UUID=7be5fbd4-9921-4623-8d52-dc091036ee40 ro rd.md=0 rd.lvm=0 rd.dm=0  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-3.1.0-7.fc16.x86_64.img
}
menuentry 'Fedora Linux, with Linux 3.1.0-7.fc16.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set=root 7be5fbd4-9921-4623-8d52-dc091036ee40
	echo	'Loading Linux 3.1.0-7.fc16.x86_64 ...'
	linux	/boot/vmlinuz-3.1.0-7.fc16.x86_64 root=UUID=7be5fbd4-9921-4623-8d52-dc091036ee40 ro single rd.md=0 rd.lvm=0 rd.dm=0  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-3.1.0-7.fc16.x86_64.img
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Fedora release 16 (Verne) (on /dev/sda13)" --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos13)'
	search --no-floppy --fs-uuid --set=root 9e0e9c96-373f-493a-9147-a890cb7621d7
	linux /boot/vmlinuz-3.1.0-7.fc16.x86_64 root=/dev/sda13
	initrd /boot/initramfs-3.1.0-7.fc16.x86_64.img
}
menuentry "Fedora release 16 (Verne) (on /dev/sda13)" --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos13)'
	search --no-floppy --fs-uuid --set=root 9e0e9c96-373f-493a-9147-a890cb7621d7
	linux /boot/vmlinuz-3.1.1-1.fc16.x86_64 root=/dev/sda13
	initrd /boot/initramfs-3.1.1-1.fc16.x86_64.img
}
menuentry "Windows 7 (loader) (on /dev/sda3)" --class windows --class os {
	insmod part_msdos
	insmod ntfs
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 187F4BB03E2F5747
	chainloader +1
}
menuentry "Fedora (2.6.35.14-103.fc14.x86_64) (on /dev/sda8)" --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos8)'
	search --no-floppy --fs-uuid --set=root ab609ccb-2d38-41e6-951f-01bbf7352c61
	linux /boot/vmlinuz-2.6.35.14-103.fc14.x86_64 ro root=UUID=ab609ccb-2d38-41e6-951f-01bbf7352c61 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0 rdblacklist=nouveau
	initrd /boot/initramfs-2.6.35.14-103.fc14.x86_64.img
}
menuentry "Fedora (2.6.35.14-106.fc14.x86_64) (on /dev/sda8)" --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos8)'
	search --no-floppy --fs-uuid --set=root ab609ccb-2d38-41e6-951f-01bbf7352c61
	linux /boot/vmlinuz-2.6.35.14-106.fc14.x86_64 ro root=UUID=ab609ccb-2d38-41e6-951f-01bbf7352c61 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0 rdblacklist=nouveau
	initrd /boot/initramfs-2.6.35.14-106.fc14.x86_64.img
}
menuentry "Fedora (2.6.35.14-97.fc14.x86_64) (on /dev/sda8)" --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos8)'
	search --no-floppy --fs-uuid --set=root ab609ccb-2d38-41e6-951f-01bbf7352c61
	linux /boot/vmlinuz-2.6.35.14-97.fc14.x86_64 ro root=UUID=ab609ccb-2d38-41e6-951f-01bbf7352c61 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0 rdblacklist=nouveau
	initrd /boot/initramfs-2.6.35.14-97.fc14.x86_64.img
}
### 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/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/90_persistent ###
### END /etc/grub.d/90_persistent ###
__________________
PC CPU 3.60 Gigahertz Intel Core i7-4790, Motherboard Gigabyte H97M-D3H RAM: 32GB: Fedora 25 MATE x64, ARCH KDE, Solus OS Budgie
Asus Zenbook UX305CA: Fedora 25 Gnome
HP Elitebook 2170p Ubuntu 16.1 Unity & Arch Mate

Last edited by jonathonp; 12th December 2011 at 02:25 AM.
Reply With Quote
  #4  
Old 12th December 2011, 02:59 AM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 1,057
macoschrome
Re: How to reinstall grub 2 in Fedora 16?

Change GRUB_DEFAULT= then run
grub2-mkconfig -o /boot/grub2/grub.cfg

---------- Post added at 07:59 PM ---------- Previous post was at 07:59 PM ----------

http://www.gnu.org/software/grub/man...-configuration
Reply With Quote
  #5  
Old 12th December 2011, 03:45 AM
jonathonp Offline
Registered User
 
Join Date: Oct 2006
Location: Melbourne
Age: 45
Posts: 570
linuxfirefox
Re: How to reinstall grub 2 in Fedora 16?

Thanks Chris. To change the default boot menue in my case:


Code:
su - 
gedit  /etc/default/grub

add
Code:
GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda3)"

which was taken from /boot/grub2/grub.cfg
Code:
cat /boot/grub2/grub.cfg
/etc/default/grub now reads:


Code:
GRUB_TIMEOUT=15
GRUB_DISTRIBUTOR="Fedora"
GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda3)" 
GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8"
then

Code:
su
grub2-mkconfig -o /boot/grub2/grub.cfg
For the nvidia graphics card i did:

Code:
su
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)
otherwise my system was left unbootable.

i don't know if
Code:
 mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
is required but since i falied to get the system to boot I did not want to take any chances this time.

Changing the boot menue order requires more study. thanks

'grub-mkconfig does have some limitations. While adding extra custom menu entries to the end of the list can be done by editing /etc/grub.d/40_custom or creating /boot/grub/custom.cfg, changing the order of menu entries or changing their titles may require making complex changes to shell scripts stored in /etc/grub.d/. This may be improved in the future. In the meantime, those who feel that it would be easier to write grub.cfg directly are encouraged to do so (see Booting, and Shell-like scripting), and to disable any system provided by their distribution to automatically run grub-mkconfig. "
__________________
PC CPU 3.60 Gigahertz Intel Core i7-4790, Motherboard Gigabyte H97M-D3H RAM: 32GB: Fedora 25 MATE x64, ARCH KDE, Solus OS Budgie
Asus Zenbook UX305CA: Fedora 25 Gnome
HP Elitebook 2170p Ubuntu 16.1 Unity & Arch Mate

Last edited by jonathonp; 12th December 2011 at 04:20 AM.
Reply With Quote
  #6  
Old 12th December 2011, 10:45 AM
viking777 Offline
Registered User
 
Join Date: Dec 2011
Posts: 29
linuxfirefox
Re: How to reinstall grub 2 in Fedora 16?

Quote:
In the meantime, those who feel that it would be easier to write grub.cfg directly are encouraged to do so (see Booting, and Shell-like scripting), and to disable any system provided by their distribution to automatically run grub-mkconfig. "
A 'kludge' that I have used in the past to get around this issue utilises a simple backup of grub.cfg.

Eg. Edit grub.cfg to your liking, save it, but also copy it to grub.cfg.bak. The next time grub-mkconfig overwrites grub.cfg you just copy any new entries (which you probably want anyway) from grub.cfg to grub.cfg.bak, delete grub.cfg, then rename the bak file to grub.cfg. Then back it up again ready for the next time.

It is a bit of a pain, but no more so than grub2, and it works well enough.
Reply With Quote
  #7  
Old 12th December 2011, 03:25 PM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 1,057
macoschrome
Re: How to reinstall grub 2 in Fedora 16?

This is what /etc/grub.d/40_custom and 90_persistent are for. You can either organize them into their own scripts, 40_ 41_ 42_, or you can stuff them into just one. Then each time you run grub2-mkconfig you get your custom scripts included automatically.
Reply With Quote
  #8  
Old 12th December 2011, 04:03 PM
viking777 Offline
Registered User
 
Join Date: Dec 2011
Posts: 29
linuxfirefox
Re: How to reinstall grub 2 in Fedora 16?

Quote:
Originally Posted by chrismurphy View Post
This is what /etc/grub.d/40_custom and 90_persistent are for. You can either organize them into their own scripts, 40_ 41_ 42_, or you can stuff them into just one. Then each time you run grub2-mkconfig you get your custom scripts included automatically.
That is very true, but also part of the self-defeating lunacy of grub2. I want to alter grub.cfg so I have to go and alter something in a totally different part of my file system in order to do it - I don't think or work like that. Anyway, note the use of the word 'past' in my previous post I don't use this procedure any more because grub2 annoyed me so much I have gone back to the relative sanity of grub1(I refuse to call it grub-legacy)
and I now only see the nonsense grub2 inflicts on my boot menu in passing - I chainload it from grub1 with a 2 second time out, and I hardly ever have to deal with its idiotic features. This keeps my blood pressure down far more effectively than cutting out caffeine
Reply With Quote
  #9  
Old 12th December 2011, 04:40 PM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 1,057
macoschrome
Re: How to reinstall grub 2 in Fedora 16?

No what you want is a certain result hopefully, not specifically to alter grub.cfg. There are any number of examples of configuration files recommended that they not be edited directly.

But yeah I did the same thing. I hated GRUB2, and went back to GRUB legacy. And now I'm back to GRUB2 and trying to flick off the booger that is GRUB 1. That GRUB legacy ship has sailed, it's done, it's not in development, and wasn't ever stable released.

That said, I find them both to be idiotic. I hate GRUB and GRUB2. I hate the very need for an interaction with a bootloader. It's a persistently user hostile experience. And it's completely the wrong direction for UEFI.
Reply With Quote
  #10  
Old 12th December 2011, 05:12 PM
viking777 Offline
Registered User
 
Join Date: Dec 2011
Posts: 29
linuxfirefox
Re: How to reinstall grub 2 in Fedora 16?

Grub2/grub1 I could cope with, and "charted my own course" to use your nautical analogy.
Mention uefi and I adopt the ostrich approach - head in the sand and hope it never happens (although I know it will). I can only hope that someone else has dealt with it before I have to.

Isn't that cowardly?
Reply With Quote
  #11  
Old 13th December 2011, 02:59 AM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 1,057
macoschrome
Re: How to reinstall grub 2 in Fedora 16?

UEFI is overly complicated also. If I could wave a magic wand, I'd banish both GRUB2 and UEFI. The companies who build either crappy or sabotaged firmware will continue to do so, so UEFI is for the people who are going to follow the rules?

UEFI 2.3.1 with Errata A is a 2,214 page spec! It's almost like punishment for conformists.
Reply With Quote
  #12  
Old 13th December 2011, 03:34 AM
fibster Offline
Registered User
 
Join Date: Nov 2004
Location: Bellingham,Wa
Age: 54
Posts: 102
linuxfirefox
Re: How to reinstall grub 2 in Fedora 16?

LILO is the way to go.

Never had any problems with it.
__________________
cheers,
~fibster

Proud User of Fedora @ Gnome since Core 1>
Registered Linux user 412420
Reply With Quote
  #13  
Old 13th December 2011, 04:10 AM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 1,057
macoschrome
Re: How to reinstall grub 2 in Fedora 16?

ELILO might make more sense than GRUB2-efi for RH to consider also, but I don't know all of the parameters needing consideration.
Reply With Quote
  #14  
Old 13th December 2011, 05:18 AM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 8,435
linuxfirefox
Re: How to reinstall grub 2 in Fedora 16?

Quote:
Originally Posted by jonathonp View Post

Code:
su
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)
otherwise my system was left unbootable.

i don't know if
Code:
 mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
is required but since i falied to get the system to boot I did not want to take any chances this time.
No, the mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img was not required. This just backed up your previous initrd for you in case something went wrong, you could move it back and be able to boot.

It did nothing except just add a layer of security to what you were about to do running the dracut command to build a new initrd which would totally wipe out anything you had in the file previously.
Reply With Quote
Reply

Tags
fedora, grub, reinstall

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
[SOLVED] How to reinstall grub Arashdn Using Fedora 18 11th June 2010 04:24 PM
How do I reinstall grub in Fedora 11? Pumpino Using Fedora 4 25th November 2009 01:25 AM
How Reinstall XP Without Losing grub/fedora boot? riffin-rich Using Fedora 7 19th July 2007 02:00 AM
cant use grub after reinstall xp!help c4danger Installation, Upgrades and Live Media 2 25th March 2006 02:09 PM


Current GMT-time: 07:03 (Wednesday, 28-06-2017)

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