LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 09-06-2007, 09:28 PM   #1
apolix
LQ Newbie
 
Registered: Sep 2007
Posts: 1

Rep: Reputation: 0
Booting from Grub Rescue


I have just installed Ubuntu 7.4 , I made the mistake of choosing "continue without a bootloader" because grub and lilo failed to install.. I have xp on another partition and it fails to load now.
When i start my machine I get the grub rescue command prompt.

How can I boot to Ubuntu from this prompt? and can I install grub once I boot to Ubuntu ?
 
Old 09-07-2007, 07:17 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
If you know the name of the kernel you are using and the partition name you installed to, then you should be able to boot to Ubunut from the command line. But in your case I wonder if it wouldn't be easier to try to install GRUB from your live CD (assuming that is how you installed in the first place).

To do that, after booting the live CD, bring up a terminal window (Applications -> Accessories -> Terminal), and verify you know what partitions you have by typing (what you type is in red):

Code:
$sudo fdisk -l
You will probably see two partitions, with the first being the MS Windows (NTFS) partition and the second being your Linux installation. If so, proceed:

Code:
$sudo grub
grub> root (hd0,1)
grub> setup (hd0)
grub> quit
$
If all goes well, you should be able to reboot, remove the CD and boot into Ubuntu. You can then adjust /boot/grub/menu.lst (if needed) so that at boot time you choose either operating system.
 
Old 09-07-2007, 10:54 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,500

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Mmmm - that will (usually) recover a previously working grub. The OP said grub failed to install. Setup will only build the loader code (in the MBR with the above commands), and maybe stage 1.5
Boot will require the support files normally found in /boot/grub/*

With something like Ubuntu, probably easiest to re-install.
 
Old 09-08-2007, 01:11 AM   #4
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by syg00 View Post
The OP said grub failed to install.
Yea, I wasn't sure from the first post just how far things had gotten when the failure occurred. I'll note that since XP no longer boots, the Ubuntu installation must have done something to the MBR. Since this is fresh install, a reinstall might be easier -- unless the same problem occurs again. I figured I'd wait for feedback from the OP and adjust my advice accordingly ... unless somebody beat me to it.
 
Old 09-08-2007, 01:51 AM   #5
snares
Member
 
Registered: Mar 2006
Distribution: Ubuntu Gusty Gibbon
Posts: 108

Rep: Reputation: 16
A reinstall would probably be easiest but if you wanted to fix it instead of startover. I would boot into the Windows Cd start the recovery console type fixmbr. That will make it so that you can boot into windows at least. Then you can boot into windows and edit the boot.ini file through msconfig. But yes the easy way is to do a reinstall.
 
Old 09-08-2007, 04:38 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: 112Reputation: 112
When Ubuntu says the boot loader not installed it means only "to" the MBR or root partition. Grub is part of the kernel and will have been available regardless. blackhole54's advice is therefore the best and the one I would recommend too since the OP has already confirm Grub "is" available with a Grub prompt on booting up.

There is no necessity to go through a Linux in this case the equivalent "fdisk -l" in a Grub prompt is simply
Code:
geometry (hd0)
and so if the partition 1 of disk (hd0) is the first one with Type 83, indicating /boot or the root partition of Ubuntu, then Grub can be installed into the MBR of the first disk (hd0) by "sourcing" the files from partition (hd1,0) by command in Grub prompt
Code:
grub> root (hd0,1)
grub> setup (hd0)
It will boot immediately by command in Grub prompt
Code:
configfile (hd0,1)/boot/grub/menu.lst
or
Code:
chainloader (hd0)+1
snares's advice is the long way and IMO unnecessary because Grub is available as a Grub prompt which is the most powerful booting tool in the planet.

There is no operational PC system in existence that cannot be booted up in a Grub prompt!

To avoid it, restore Winddows' MBR to check the health of the MS Windows first and then do a re-install of the Linux second is a total disregard of what Grub can do.

Last edited by saikee; 09-08-2007 at 04:45 AM.
 
Old 09-08-2007, 05:10 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,500

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Quote:
Originally Posted by saikee View Post
Grub is part of the kernel and will have been available regardless.
Say what ???.
It is not.

Try a gentoo install - even Slack. You want grub you have to install it - likewise for any other boot-loader.
 
Old 09-08-2007, 05:45 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: 112Reputation: 112
syg00,

OK I rephrase it. Grub or Lilo is usually built into as an optional part of the kernel commands.

Since every Linux needs a boot loader it will have either Grub or Lilo built into it. Many distros like Mandriva, Knoppix, Suse etc have both available. Slackware and Slax families are the die-hard users of Lilo but they can be booted with Grub "half-installed" (without Grub built into the kernel). There has been a significant shift toward Grub at the expenses of Lilo in the recent distributions.
 
Old 09-08-2007, 01:16 PM   #9
drakebasher
Member
 
Registered: Aug 2004
Location: Proprio Qui
Distribution: Debian
Posts: 85

Rep: Reputation: 16
This link is a really good GRUB reference. Note especially the part about "Having Grub Do Your Research For You" including filename completion.
 
Old 09-09-2007, 03:56 AM   #10
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by saikee View Post
OK I rephrase it. Grub or Lilo is usually built into as an optional part of the kernel commands.

Since every Linux needs a boot loader it will have either Grub or Lilo built into it.
While you need some kind of a bootloader to load the kernel and start the boot sequence, the bootloader is never a part of the kernel. (I am not sure what you mean by "kernel commands.") In addition to Lilo and GRUB, you have isolinux, syslinux, and don't forget about LOADLIN. (I've used the last to boot Damn Small Linux on an old laptop! ) While I've not used it, I believe something called the Smart Boot Loader (or something similar) can also handle the job. There may be others.

Maybe we should wait to hear from the OP again before we continue giving advice.


Hey apolix,

How are things coming along?
 
Old 11-03-2010, 02:32 PM   #11
acesound
LQ Newbie
 
Registered: Nov 2010
Posts: 5

Rep: Reputation: 0
Exclamation

Hello Everyone, diging for an answer I found this thread, my problem is very similar I followed the instructions but hit a dead end and need futher help.

So my situation is that I had an WINXP partition set as primary and bootable. I then tried an install of Ubuntu 10.10 but had problems configuring the boot options and left it there. Then Install a second Ubuntu 10.10 on another partition made but the installion wizard and after that one I could use that last ubuntu installation with a boot menu and everything work fine until I decided that first ubuntu install (lets called it Ubuntu_A) had to go. So I went into the disk utilily from Ubuntu_B and deleted the linux and swap partitions of the first ubuntu install (ubuntu_A).

Today at startup my boot menu was gone and I got the same sympton described by the OP, with a grub rescue> prompt.

So in my case I need to restore the boot menu but I have a working and configured ubuntu 10.10 and a working winXP also. What I need is to restore the grub boot menu without reinstalling the ubuntu.

So far what I have done:

Loaded the Live CD
Installed Grub package on the live session

This is the output of the geometry (hd0) command:
grub> geometry (hd0)
drive 0x80: C/H/S = 60801/255/63, The number of sectors = 976773168, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0xde
Partition num: 1, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type is ext2fs, partition type 0x83
Partition num: 5, Filesystem type unknown, partition type 0x82

So my valid ubuntu is on partition number 4, the other ubuntu was effectively erased.

Then I run:

grub> root (hd0,4)

Then:

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found

And this is where I am right now. How can I install GRUB to partition 4 of my disk and active the boot menu to be able to access WinXP and Ubuntu 10.10?

Thanks.

Last edited by acesound; 11-03-2010 at 02:52 PM. Reason: More info.
 
Old 11-03-2010, 03:50 PM   #12
yancek
Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 5,117

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
Are you using the Ubuntu 10.10 Live CD to run these commands?
Did you mount your Ubuntu partition from the Live CD to see if you had any Grub files on it?
If your Ubuntu partition is sda4, open a terminal from the Live CD:

Quote:
sudo mkdir /mnt/sda4
mount -t ext4 /dev/sda4 /mnt/sda4
Navigate to the /boot directory to see if you actually have any Grub files.
If not, you will have to copy them to the /boot directory on sda4.

Last edited by yancek; 11-03-2010 at 03:52 PM.
 
Old 11-03-2010, 04:28 PM   #13
acesound
LQ Newbie
 
Registered: Nov 2010
Posts: 5

Rep: Reputation: 0
I did, I found on /boot a Grub directory and inside that files with a mod extension, also one with a kernel.img, grub.cfg, etc. Is that correct?
 
Old 11-03-2010, 07:23 PM   #14
acesound
LQ Newbie
 
Registered: Nov 2010
Posts: 5

Rep: Reputation: 0
This is what I found on the fstab file:
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda7 during installation
UUID=180dcf2b-e80a-4e16-9619-d9583a013926 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda8 during installation
UUID=6c0e349e-48c4-4241-8ac9-c988d96196f3 none swap sw 0 0

Here is the result for fdisk -l>
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3425a251

Device Boot Start End Blocks Id System
/dev/sda1 1 14 112423+ de Dell Utility
/dev/sda2 * 15 15312 122881185 7 HPFS/NTFS
/dev/sda3 15313 60802 365391873 5 Extended
/dev/sda5 19223 60037 327839744 83 Linux
/dev/sda6 60037 60802 6141952 82 Linux swap / Solaris
 
Old 11-03-2010, 07:47 PM   #15
yancek
Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 5,117

Rep: Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817Reputation: 817
since you are using Ubuntu 10.10, the Grub you are using is Grub2. The files referenced in the earlier posts of this thread refer to Grub Legacy which has different files. If you have a grub.cfg file in the /boot/grub directory, that is the main configuration file. I don't have any systems using Grub2, but there should be a number of files in the /boot/grub directory.

Interesting that the geometry command output you posted earlier shows partitions starting at zero making your Linux partition #4. Your fdisk output shows your only Linux partition as sda5.

Run the same commands you did earlier with one change: root (hd0,5)

Grub 2 counts partitions from one, drives from zero.
Grub Legacy referenced in all the earlier posts counts drives AND partitions from zero.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restoring GRUB using a rescue cd aus9 Linux - Software 7 05-13-2013 02:31 AM
Need to (re)install GRUB: fedora c4 rescue cd (and GRUB) unable to see the harddisk whencat Fedora 4 03-05-2006 03:01 PM
Kernal Panic while booting from rescue disk p3980 Slackware 23 12-19-2005 10:51 AM
grub reinstall from rescue CD shashikanth Linux - Software 12 08-22-2004 05:40 AM
How do I rescue a non-booting partition? CodeCrush Linux - General 2 03-08-2004 09:10 AM


All times are GMT -5. The time now is 02:03 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration