Wilders Security Forums  

Go Back   Wilders Security Forums > Software, Hardware and General Services > all things UNIX
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread
  #1  
Old May 4th, 2010, 04:39 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Make yourself a bootable Grub 2 rescue CD

Make yourself a bootable Grub 2 rescue CD
Absolute must imho.
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux
  #2  
Old May 4th, 2010, 04:54 AM
Eice's Avatar
Eice Eice is offline
Very Frequent Poster
 
Join Date: Jan 2009
Posts: 1,413
Default Re: Make yourself a bootable Grub 2 rescue CD

Can't you just boot from your distro's livecd and perform any repairs from there?
  #3  
Old May 4th, 2010, 05:06 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Quote:
Originally Posted by Eice
Can't you just boot from your distro's livecd and perform any repairs from there?
Sure, but that's cumbersome. This way you get the grub menu with all the kernels as you normally would, make your selection and you boot into the distro with the damaged grub. From there you can just reinstall grub from terminal.

Once you have burned the .iso to CD boot with it. At the grub prompt type configfile /grub.cfg
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux
  #4  
Old May 4th, 2010, 05:08 AM
Mrkvonic Mrkvonic is online now
Linux Systems Expert
 
Join Date: May 2005
Posts: 7,420
Default Re: Make yourself a bootable Grub 2 rescue CD

Ocky, GRUB2 is still not standardized, so using a live CD may not necessarily work for all flavors of GRUB2. To be on the safe side, you may want to boot the live CD of your particular distro edition and perform maintenance using that.

That said, Herman is a very knowledgeable dude and his pages are very useful, informative and interesting. It's worth listening to his advice. But i believe that this is for Ubuntu only, and even then, per-edition.

For example, GRUB2 has changed from 1.97-beta4 to 1.98-ubuntu5 between karmic and lucid and device mapping file is gone from the grub directory. These small, subtle differences could be dangerous if you do not know fully what you're doing.

Mrk
__________________
http://www.dedoimedo.com

All your base are belong to us

Linux Systems Expert / Systems Programmer, Linux System Administrator, LPIC-1, LPIC-2 (WIP), GSEC, CCHD, CCHA
  #5  
Old May 4th, 2010, 05:36 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Mrk,worked really well for me with dual boot Karmic. I had a prob. once with Karmic and simply booted the grub rescue CD, then installed grub 2 from within the live system. All was perfect again. I posted in Ubuntu forums because the command for Karmic is not valid for Lucid. Tested this morning and Herman's new command for Lucid is fine.
I don't have Windows, but realise that your cautionary re: device mapping is called for but surely there is no prob. for (X)Buntu's ?
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux
  #6  
Old May 4th, 2010, 06:06 AM
Mrkvonic Mrkvonic is online now
Linux Systems Expert
 
Join Date: May 2005
Posts: 7,420
Default Re: Make yourself a bootable Grub 2 rescue CD

Device mapping is required for booting from other disks, if you have more than one, so that grub can properly identify and associate hd0/1/2/3 to sda/b/c/d. Not strictly related to any particular os, more to make sure the bios order is indeed the grub order.
Mrk
__________________
http://www.dedoimedo.com

All your base are belong to us

Linux Systems Expert / Systems Programmer, Linux System Administrator, LPIC-1, LPIC-2 (WIP), GSEC, CCHD, CCHA
  #7  
Old May 4th, 2010, 06:47 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Quote:
Originally Posted by Mrkvonic
Ocky, GRUB2 is still not standardized, so using a live CD may not necessarily work for all flavors of GRUB2. To be on the safe side, you may want to boot the live CD of your particular distro edition and perform maintenance using that.

For example, GRUB2 has changed from 1.97-beta4 to 1.98-ubuntu5 between karmic and lucid and device mapping file is gone from the grub directory. These small, subtle differences could be dangerous if you do not know fully what you're doing.

Mrk
All I can say is try it out on one of your machines where Grub 2 is installed.
If Grub version = 1.97 use: grub-mkrescue --overlay=/boot/grub Grub2CD.iso
If Grub version = 1.98 use: grub-mkrescue --output=rescue.iso /boot/grub

With the rescue CD made using the second command I can successfully boot into either
Lucid or Karmic despite different vesions of Grub 2 and Karmic is on another internal HDD.
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux
  #8  
Old May 4th, 2010, 10:24 AM
Mrkvonic Mrkvonic is online now
Linux Systems Expert
 
Join Date: May 2005
Posts: 7,420
Default Re: Make yourself a bootable Grub 2 rescue CD

I'll check and if it works, add to grub2 tutorial.
Mrk
__________________
http://www.dedoimedo.com

All your base are belong to us

Linux Systems Expert / Systems Programmer, Linux System Administrator, LPIC-1, LPIC-2 (WIP), GSEC, CCHD, CCHA
  #9  
Old May 4th, 2010, 11:53 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Herman has updated his site ... http://members.iinet.net/~herman546/...l#GRUB2_CD-ROM
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux
  #10  
Old May 4th, 2010, 12:27 PM
mack_guy911's Avatar
mack_guy911 mack_guy911 is offline
Very Frequent Poster
 
Join Date: Mar 2007
Posts: 2,483
Default Re: Make yourself a bootable Grub 2 rescue CD

thanks Ocky for link great stuff .........indeed herman is very knowledgeable person )
  #11  
Old May 4th, 2010, 01:44 PM
mack_guy911's Avatar
mack_guy911 mack_guy911 is offline
Very Frequent Poster
 
Join Date: Mar 2007
Posts: 2,483
Default Re: Make yourself a bootable Grub 2 rescue CD

Ocky please can you give a demo of restoring grub i mean grub 1 (menu.lst) i know little bit but grub 2 is still new thing for me

let me get what i understand

step 1 grub-mkrescue --output=rescue.iso /boot/grub

in ubuntu 10.04 it will make a grub config script and making it bootable cd iso

step 2 burn iso in image formate then boot from it and press c to get command mode

step 3 from command mode configfile /grub.cfg

now why herman (configfile (hd0,1)/boot/grub/grub.cfg)

now will it configure grub as the previous one or i need to reinstall the grub then use this to configure it

please it would be kind if you give a demo step by step considering newbie in mind its will help others as well
  #12  
Old May 4th, 2010, 02:20 PM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Quote:
Originally Posted by mack_guy911
Ocky please can you give a demo of restoring grub i mean grub 1 (menu.lst) i know little bit but grub 2 is still new thing for me

let me get what i understand

step 1 grub-mkrescue --output=rescue.iso /boot/grub

in ubuntu 10.04 it will make a grub config script and making it bootable cd iso

step 2 burn iso in image formate then boot from it and press c to get command mode

step 3 from command mode configfile /grub.cfg

now why herman (configfile (hd0,1)/boot/grub/grub.cfg)

now will it configure grub as the previous one or i need to reinstall the grub then use this to configure it

please it would be kind if you give a demo step by step considering newbie in mind its will help others as well

For grub legacy (old grub) I would use a live cd. For grub 2 it's very easy:-
(If Grub version = 1.97 use: grub-mkrescue --overlay=/boot/grub Grub2CD.iso
If Grub version = 1.98 use: grub-mkrescue --output=rescue.iso /boot/grub)
If you have 10.04 which uses grub 1.98 use the command for 1.98 as above.
Burn the iso named rescue.iso to CD-RW.
Boot from it.
At the grub prompt simply type configfile /grub.cfg
This will get you your Grub 2 Menu with all the kernels splash image modifications etc.
Select the kernel and hit enter to boot into your 10.04 OS
Then from within 10.04 you can repair your damaged Grub 2 : sudo grub-install /dev/sdX

You could also do this at the grub prompt instead of the above configfile way ..

grub> linux (hd0,1)/vmlinuz root=/dev/sdX
grub> initrd (hd0,1)/initrd.img
grub> boot

... Replacing the (hd0,0) and sdX with the appicable disk/partition descriptions for your setup.
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux

Last edited by Ocky : May 4th, 2010 at 02:57 PM.
  #13  
Old May 4th, 2010, 03:33 PM
mack_guy911's Avatar
mack_guy911 mack_guy911 is offline
Very Frequent Poster
 
Join Date: Mar 2007
Posts: 2,483
Default Re: Make yourself a bootable Grub 2 rescue CD

Quote:
Originally Posted by Ocky
For grub legacy (old grub) I would use a live cd. For grub 2 it's very easy:-
(If Grub version = 1.97 use: grub-mkrescue --overlay=/boot/grub Grub2CD.iso
If Grub version = 1.98 use: grub-mkrescue --output=rescue.iso /boot/grub)
If you have 10.04 which uses grub 1.98 use the command for 1.98 as above.
Burn the iso named rescue.iso to CD-RW.
Boot from it.
At the grub prompt simply type configfile /grub.cfg
This will get you your Grub 2 Menu with all the kernels splash image modifications etc.
Select the kernel and hit enter to boot into your 10.04 OS
Then from within 10.04 you can repair your damaged Grub 2 : sudo grub-install /dev/sdX

You could also do this at the grub prompt instead of the above configfile way ..

grub> linux (hd0,1)/vmlinuz root=/dev/sdX
grub> initrd (hd0,1)/initrd.img
grub> boot

... Replacing the (hd0,0) and sdX with the appicable disk/partition descriptions for your setup.


thanks Ocky thanks very much

this is exactly what i was looking for
  #14  
Old May 5th, 2010, 04:40 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Forgot to mention. After the grub-install command, remember to run either:-

sudo grub-mkconfig -o /boot/grub/grub.cfg (or)
sudo update-grub

in Terminal.
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux
  #15  
Old May 5th, 2010, 07:54 AM
Trespasser's Avatar
Trespasser Trespasser is offline
Frequent Poster
 
Join Date: Mar 2005
Location: Clintwood, Virginia
Posts: 965
Default Re: Make yourself a bootable Grub 2 rescue CD

I was wondering...will this iso that's created work on both 32 and 64 bit systems or is it specific to either?

This iso could be a hassle free solution should grub2 corruption ever occur. Thanks for this, Ocky.
__________________
Ubuntu Precise (Cinnamon DE) 12.04 32bit on one laptop, Ubuntu Precise Gnome Fallback 12.04 32bit on another laptop, Ubuntu Precise (Cinnamon DE) 12.04 64bit on our main Desktop, and Xubuntu 12.04 64bit on our spare Desktop.


"I wish I knew as much as I think I do"...
  #16  
Old May 5th, 2010, 08:16 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Quote:
Originally Posted by Trespasser
I was wondering...will this iso that's created work on both 32 and 64 bit systems or is it specific to either?

This iso could be a hassle free solution should grub2 corruption ever occur. Thanks for this, Ocky.
Trespasser, yes must work as long as we are talking Grub 2.

Regards.

Edit: Just remember when there has been a kernel update, make a new recue cd so that you can boot into the OS with the latest kernel.
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux

Last edited by Ocky : May 5th, 2010 at 09:09 AM.
  #17  
Old October 11th, 2010, 09:30 AM
Ocky's Avatar
Ocky Ocky is offline
Very Frequent Poster
 
Join Date: May 2006
Location: George, S.Africa
Posts: 2,537
Default Re: Make yourself a bootable Grub 2 rescue CD

Now mentioned in the Ubuntu forum's Grub Guide. http://ubuntuforums.org/showthread.php?t=1195275

Quote:
grub-rescue-cdrom.iso - When burning the image to a CD, select the option to copy an image and not the files.
Generate the image using the following command:
Code:
grub-mkrescue --output=<path/filename>
If an error message "/usr/bin/grub-mkrescue: 324: xorriso: not found", install the xorriso package and rerun the command.
Copy the ISO image to a CD using the CD burning app of your choice.
You need to install package grub-rescue-pc and xorriso.
Then:- grub-mkrescue --output=rescue.iso /boot/grub

Tried it no problems. At prompt type configfile /grub.cfg
__________________
Ubuntu Kubuntu Xubuntu Scientific Linux
  #18  
Old February 7th, 2011, 01:03 PM
wat0114
 
Posts: n/a
Default Re: Make yourself a bootable Grub 2 rescue CD

This am I found and used these very handy instructions to repair my Mint 10's Grub 2. The difference for me is my non-standard location of Grub 2 ( I was fooling around carelessly ), as I like it on the root partition (sdg6 for me), rather than the standard beginning of sdg. Instead of: #grub-install /dev/sdg I used #grub-install /dev/sdg6 --force (--force because of the warning it's not recommended to install it to a partition. I use dual-boot with Win7, and setup the Linux Grub 2 entry in EasyBCD so I can choose which O/S I want to boot from.
 

Wilders Security Forums > Software, Hardware and General Services > all things UNIX « Previous Thread | Next Thread »

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:08 AM.


Powered by vBulletin® Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2013, Wilders Security Forums