LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-22-2010, 06:15 AM   #1
muckybucket
Member
 
Registered: May 2010
Posts: 37

Rep: Reputation: 15
Grub rescue


I stupidly repartioned a triple-boot laptop, with the intention of creating two partitions...

However, after rebooting realised I hade inadvertently removed grub. Now the system just boots into 'Grub Rescue'.

Is there anything I can do to get it booted? It won't boot from either CD or USB, but seems to see these when it starts. What commands can I use for grub rescue? Failing this might have to pull the drive and hook it up to something else and re-partition and recreate GRUB.
 
Old 06-22-2010, 06:18 AM   #2
gasdim
Member
 
Registered: Jun 2010
Location: Volos GREECE
Distribution: ubuntu derivative
Posts: 157

Rep: Reputation: 28
Hello
If you want to boot from CD you should change the boot priority from bios of your laptop.
Usually when you install win the bios option to boot from CD changes and boot from Hard-disk is the first option.

Kostas
 
Old 06-22-2010, 06:23 AM   #3
muckybucket
Member
 
Registered: May 2010
Posts: 37

Original Poster
Rep: Reputation: 15
Thanks for the advice, but I already know that. Whatever settings I make to the boot menu, this laptop will not boot from CD. I have used PLop in the past but I cannot access that at the moment either.
 
Old 06-22-2010, 07:45 AM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Grubrescue is 1/3 of Grub2. It can't be used for booting but typing "help" will show you the commands available.

You can use the "ls" command to find out what the partitions are and what files available. Grub2 can read ntfs partitions too. Grub2's ls command is similar to Linux's ls.

The cure is to restore Grub2 and this can be done by any Linux Live CD with Grub or booted up Linux from your PC.

The steps are

(1) Identify the partition that has Grub2, say this is sda3
(2) Mount /dev/sda3 on /mnt/sda3
(3) Bind the /dev of the current boot up Linux with the mounted /mnt/sda3/dev
(4) Do a Grub-install with the root directory pointed to the mounted partition and the destination of the MBR.

Typical Commands are
Code:
sudo su
mkdir /mnt/sda3
mount /dev/sda3 /mnt/sda3
bind /dev /mnt/sda3/dev
grub-install --root-directory=/dev/mnt/sda3 /dev/sda
use "su" instead of "sudo su" for non-Ubuntu and non-Debian family distros.

The reason of binding is inside /mnt/sda3/dev the deivice names will be empty as they only get populated on booting when each device can be detected.

Grub-install will work if /mnt/sda3 is "empty" because it will fill it up with the needed system files but you won't get the grub.cfg.

You can make a Grub2 or Grub1 (doctored version for Ext4 partition) floppy to fire up the Linux or any OS. A Linux is bootable even the Linux has no boot loader installed!

Last edited by saikee; 06-22-2010 at 07:52 AM.
 
Old 06-22-2010, 07:53 AM   #5
muckybucket
Member
 
Registered: May 2010
Posts: 37

Original Poster
Rep: Reputation: 15
What can be done without booting from disk? 'Help' just brings up 'unknown command' so it looks like there might not be much available.

'ls' produces the following (with USB stick in):

(hd0) (hd0,2) (hd0,1) (hd1) (hd1,2) (hd1,1)

Think hd1 is the stick as it doesn't appear when it is not connected.

Like I said a normal boot from USB or CD is not an option. I can either find a way to boot one or other from grub rescue or pull the disk and repartition by hooking it up to another machine...
 
Old 06-22-2010, 08:02 AM   #6
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
To boot a system you need Grub2 (or Grub1) to have the ability to hand over the control to a Linux or a MS Windows.

With the former Grub2 needs the command "linux" and Grub1 needs "kernel".

To do the latter you need "chainloader" command from either Grub.

Grubrescue is the bit that left behind in the MBR after to nuked the partition that hold its inteeligence which is a file called "core.img".

core.img can be fired up by Grub1 with the "kernel" command.

If you have no bootable means of floppy, CD and USB and rely exclusively booting from a hard disk then the only way out would be to remove the disk and add a Grub partition to it to make it bootable.

The ls command confirms that there are two disks; one with 1 partition and the other with 2. You can ls the content of say partition (hd1,2) by command
Code:
ls (hd1,2)/
and so on

If (hd1,2) has Grub2 inside you can fire it up with
Code:
set root=(hd1,2)
configfile /boot/grub/grub.cfg

Last edited by saikee; 06-22-2010 at 08:06 AM.
 
Old 06-22-2010, 08:34 AM   #7
muckybucket
Member
 
Registered: May 2010
Posts: 37

Original Poster
Rep: Reputation: 15
Sounds like I'll have to pull the disk.

The grub was on a partition that was removed...
 
Old 06-22-2010, 10:51 AM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Ever consider a USB floppy drive?
 
Old 06-22-2010, 11:10 AM   #9
muckybucket
Member
 
Registered: May 2010
Posts: 37

Original Poster
Rep: Reputation: 15
I haven't got one, but surely if it can't see a USB drive or CD this wouldn't work either?

Anyway, I have pulled the drive and hooked it up to another machine, hopefully I can get it sorted this way.
 
Old 01-04-2011, 07:24 PM   #10
BewilderedStranger
LQ Newbie
 
Registered: Aug 2010
Posts: 5

Rep: Reputation: 0
http://www.makeuseof.com/tag/how-to-...t-environment/
This will save you i hope. It saved me haha. I did the same thing got aggrivated with ubuntu after trying for months to install and I deleted the partitions obviously killing my mbr.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB error: unknown filesystem, grub rescue magnecticfield Linux - Newbie 28 07-30-2013 03:35 AM
grub rescue> please help boogaloo2oo2 Linux - Newbie 4 05-15-2010 04:21 PM
Grub rescue sayitmeme Zenwalk 6 05-02-2010 07:22 PM
grub rescue Emma77 Debian 6 03-11-2010 06:22 AM
Need to (re)install GRUB: fedora c4 rescue cd (and GRUB) unable to see the harddisk whencat Fedora 4 03-05-2006 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration