PDA

View Full Version : How to install Grub from a live Ubuntu cd.



Pages : [1] 2 3 4 5

catlett
July 28th, 2006, 01:34 AM
EDIT: I have not been around in a long time, but it appears grub can still give people headaches:) I notice people are still referring to this guide now and then, so I wanted to post a link to a grub2 guide. There are differences so you may want to check there as well http://ubuntuforums.org/showthread.php?t=1195275. Glad to see Ubuntu is still going strong:) Take care.

This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see "sudo" that will mean to you that the following command should be entered at a root terminal.)

Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.

When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)


sudo grub

This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands


find /boot/grub/stage1

This will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)


root (hd?,?)
Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr


setup (hd0)

Finally exit the grub shell

quit

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.

Now the explanation.
Sudo grub gets you the grub shell.
Find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub's files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.
So root (hd?,?) tells grub it's files are on that partition.
Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive's mbr.
Quit will exit you from the grub shell.



THIS IS AN EDIT. 5-HT MADE A GOOD POINT AND I AM JUST GOING TO COPY/PASTE IT HERE


Just have recommendation to add that may be irrelevant: it might be of benefit to give an explicit warning (though it is mentioned) that this guide will write GRUB to the MBR (just in case someone is using a different boot loader on their MBR and would like to reinstall GRUB to a partition).

If someone wants GRUB on a partition, the 'setup (hd0)' step can be modified to 'setup (hdX,Y)'. Where X is the hard disk, and Y the partition using GRUB's nomenclature of starting from 0 (first partition=0, second=1,...).

THIS IS ANOTHER EDIT. TOSK POSTED A WAY TO MOUNT PROC AND UDEV. THIS WAS NEEDED BECAUSE GRUB WASN'T RECOGNISING THE DRIVE. I THOUGHT IT WAS A VALUABLE COMMENT AND DECIDED TO PUT IT IN THE ORIGINAL POST SO PEOPLE WILL SEE IT AT THE TOP. IT MAY BE MISSED AS JUST A REPLY POST DOWN THE PAGE.
ALL KNOWLEDGE IS WELCOME!


Mine was a slightly different story. I couldn't get grub to find the stage1 file or even recognize my drive. So I borrowed some knowledge I picked up while using Gentoo:

You have to mount your root partition using the livecd:
Code:

$
sudo mkdir /mnt/root $
sudo mount -t ext3 /dev/sda6 /mnt/root

Then you have to mount the proc subsystem and udev inside /mnt/root also:
Code:

$
sudo mount -t proc none /mnt/root/proc $
sudo mount -o bind /dev /mnt/root/dev

Doing this allows grub to discover your drives. Next you have to chroot:
Code:

$
sudo chroot /mnt/root /bin/bash

Now that you're chrooted into your drive as root everything should work.
Code:

#
sudo grub I edited in the sudo, just to be safe. When I enter grub and not sudo grub, grub cannot find the file. I do not know if the chroot changes this because I did not try it that way. In the end I figured it was better to err on the side of caution. Tosk I hope you don't mind my editing of your reply.
grub>
find /boot/grub/stage1

It found mine on (hd0,5)
Code:

grub>
root (hd0,5)

It successfully scanned the partition and recognized the filesystem-type
Code:

grub>
setup (hd0)

That was it. It installed and on reboot I was thrown back into Ubuntu.

This might help some people who are having issues so I thought I would post it.

PLEASE NOTE: My Ubuntu was installed to /dev/sda6. This may not be the same for everyone. /dev/sdaX means it's SCSI/SATA/USB/FireWire drive. And it's partition 6 because I have a weird partitioning scheme in place.

--Tosk



**This set of instruction is a combination of 2 guides I saw before. One was a Mepis grub how to but I never found it again. The other is the grub manual. It's section explained the find, root, setup process but never mentioned it could be done from a live session.

This is the grub link http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-natively.html#Installing-GRUB-natively

Post script;
Just to post as much information as possible, this is an older how to for resoring grub to the mbr. The original post is directions for using the install cd and then there are replies that mention the method I posted here, as well as the chroot method mlind mentioned. If this method fails, you may want to try this http://ubuntuforums.org/showthread.php?t=24113

mlind
July 28th, 2006, 02:33 AM
This looks very useful info. Is the result same as running grub-install /dev/xxx ?

catlett
July 28th, 2006, 04:20 AM
The end result is the same but grub-install /dev/hd? doesn't work with a live cd. When I run grub-install from a live cd, I get an error about grub not being able to read the bios.
When I first installed ubuntu there was a grub re-install guide. It said something about mounting the ubuntu partition. Then cd to the directory and chroot. At the time it was over my head and I didn't pay much attention to it. Now I can't find it.
The other guide was the Breezy guide where you trick the install cd into re-installing grub.I gues it worked for people but I thought there had to be a simpler way to do it.
I finally found the grub manual entry on native installs and tried it from a live cd and it worked.
Hopefully reinstalling grub will now be a simple thing to do from a live cd.

mlind
July 28th, 2006, 05:25 AM
You probably mean something like this as root


mkdir /mnt/root
mount /dev/xxx? /mnt/root
chroot /mnt/root /bin/bash
grub-install /dev/xxx


Thanks for your HOWTO though, I'll try it next time I screw up my grub. Which is probably at weekend when I testdrive Edgy.

catlett
July 28th, 2006, 08:49 AM
You probably mean something like this as root


mkdir /mnt/root
mount /dev/xxx? /mnt/root
chroot /mnt/root /bin/bash
grub-install /dev/xxx


Thanks for your HOWTO though, I'll try it next time I screw up my grub. Which is probably at weekend when I testdrive Edgy.

Please try the chroot grub-install and post what happens. Like I said I saw the how to when I didn't understand commands and never saw it again. Then I saw the grub manual describing the find, root, setup commands and I went with that.I think find, root, setup doesn't return the bios error because they are given from the grub shell.
Just for FYI, this is the error I get with grub-install from the live session.

ubuntu@ubuntu:~$ sudo grub-install /dev/hda
Probing devices to guess BIOS drives. This may take a long time.
Could not find device for /boot: Not found or not a block device.This is the output of find, root, setup


grub> find /boot/grub/stage1
(hd0,1)
(hd0,10)

grub> root (hd0,10)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... failed (this is not fatal)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,10)"... failed (this is not fatal
)
Running "install /boot/grub/stage1 d (hd0) /boot/grub/stage2 p /boot/grub/menu
.lst "... succeeded
Done.

catlett
August 2nd, 2006, 04:55 AM
Just wanted to post with more concrete proof. I knew it was right from the documentation and I got feedback from one success story plus I ran it but it was just replacing the same list so it was hard to tell.
BUT NOW, I have absolute proof. I just installed Fedora Core 5 yesterday. I allowed Fedora to install grub. Fedora's grub didn't recognise Ubuntu's installation.
I thought to myself, Perfect! Lets put the guide to work. This is just the scenario I was hoping to help people with. You had grub but lost it to another install (or another issue that caused grub to return an error or what not. The main thing is that grub is already installed somewhere. The issue is you can't access it)
This is actually how anyone could handle this. I copied down Fedora's grub entry , then I rebooted and put the Ubuntu Live installation cd. When I got to the desktop I opened the terminal and did the 4 commands. One from the regular ubuntu terminal and 3 at the grub shell.

sudo grub
then at grub>

find /boot/grub/stage1
It returned 2 listings, hd0,2 and hd0,6. I forgot Ubuntu's root partition believe it or not but I knew I just put Fedora on /dev/hda3 (that is hd0,2 to grub)
Now that I know Ubuntu's grub is on hd0,6 I let the grub shell know what grub files I wanted to use
Still at grub>


root (hd0,6)
Now the command to install grub on the mbr with hd0,6's grub files

setup (hd0)
Grub then prints a little read out in the terminal about how it found the kernel and everything else until it says "succeeded". Now all I have to do is get out of the shell
grub>
quitThen I shutdown Ubuntu and restarted the computer.
Gone was Fedora's grub and in it's place was my Ubuntu grub menu. Success.
(As for accessing Fedora, I just inserted the Fedora entries I copied from Fedora's grub before I booted the live cd. Now I have Ubuntu's grub back and it is booting to fedora.)

To sum up, hd0,6's grub installed flawlessly on the mbr. It took all of 2 minutes from putting the cd in to restarting.

Here it is again just to put it to bed.

sudo grub

find /boot/grub/stage1
whatever the find command returns use for root

root (hd?,?)

setup (hd0)
hd0 is the mbr of the first drive (as far as grub is concerned)

quit

5-HT
August 2nd, 2006, 06:18 AM
Thanks for the HowTo!
Just have recommendation to add that may be irrelevant: it might be of benefit to give an explicit warning (though it is mentioned) that this guide will write GRUB to the MBR (just in case someone is using a different boot loader on their MBR and would like to reinstall GRUB to a partition).

If someone wants GRUB on a partition, the 'setup (hd0)' step can be modified to 'setup (hdX,Y)'. Where X is the hard disk, and Y the partition using GRUB's nomenclature of starting from 0 (first partition=0, second=1,...).

catlett
August 3rd, 2006, 01:09 AM
Thanks for the HowTo!
Just have recommendation to add that may be irrelevant: it might be of benefit to give an explicit warning (though it is mentioned) that this guide will write GRUB to the MBR (just in case someone is using a different boot loader on their MBR and would like to reinstall GRUB to a partition).

If someone wants GRUB on a partition, the 'setup (hd0)' step can be modified to 'setup (hdX,Y)'. Where X is the hard disk, and Y the partition using GRUB's nomenclature of starting from 0 (first partition=0, second=1,...).

Thanks for the feed back. I have been worried I would forget something and it would effect someone's system. I hope you don't mind, I just copy/pasted your comments into the how to. They stated the issue and were to the point so why not use them? (as long as you don't object of course)

true_friend
August 4th, 2006, 01:08 AM
find /boot/grub/stag1
this command is resulting can not find the file
what i do for this????????

true_friend
August 4th, 2006, 01:09 AM
file is there. i saw it after mounting the partition having linux installed on it.
i tried to give /B/boot/grub/stag1 command while /B is the mount folder but it did the same error.
i am sick of this reinstallation process.

5-HT
August 4th, 2006, 01:50 AM
find /boot/grub/stag1
this command is resulting can not find the file
what i do for this????????

Looks like it may be a typo. What about trying
find /boot/grub/stage1

This step isn't necessary, it's only a convenient way of finding which partition grub's stage1 is on. If you know which hard drive and partition /boot/grub is on, you can simply bypass the find step, while following the other steps in catlett's guide, and plug in the proper values for the root (hdX,Y) command.

e.g., if you've only one hard drive and /boot/grub is on the first partition


root (hd0,0)
e.g., if you've only one hard drive and /boot/grub is on the second partition


root (hd0,1)

Thanks for the feed back. I have been worried I would forget something and it would effect someone's system. I hope you don't mind, I just copy/pasted your comments into the how to. They stated the issue and were to the point so why not use them? (as long as you don't object of course)

No worries, glad to be of help. Even if most people probably have grub on the MBR, it's nice to have mention of how you can put it on a partition.
Though if I knew it was going to be tacked on to the guide I'd have done a better proof read for grammar and coherence. #-o

Jabran Asghar
August 4th, 2006, 08:19 PM
Hi,

I got my PCs MBR overwritten by XPs, boot loader. is it possible that instead of restoring GRUB Boot Loader, I somehow write the boot sector (512 bytes) to a file, and then add an entry for the file to boot.ini of ntloader? I remember I saw it somewhere, but dont remember now.

Thanks for any hint.

5-HT
August 4th, 2006, 08:38 PM
Hi,

I got my PCs MBR overwritten by XPs, boot loader. is it possible that instead of restoring GRUB Boot Loader, I somehow write the boot sector (512 bytes) to a file, and then add an entry for the file to boot.ini of ntloader? I remember I saw it somewhere, but dont remember now.

Thanks for any hint.

Does this help? http://www.ubuntuforums.org/showpost.php?p=1229036&postcount=9
(thread: http://www.ubuntuforums.org/showthread.php?t=211370)

Jabran Asghar
August 5th, 2006, 09:32 AM
Yes, this is what I was looking for. Thanks for the link.

true_friend
August 5th, 2006, 10:28 AM
my problem was not the stage spelling. but path
root (hd0,0) was missing.

catlett
August 5th, 2006, 11:12 AM
my problem was not the stage spelling. but path
root (hd0,0) was missing.

Grub need the grub files to run the setup. The path is where grub will find them. When you do the find command, it is telling you where the file are located on the hard drive. The root (hd?,?) is how you tell grub where the files are. The setup (hd?) is grub installing itself and the patyh you enter there is telling grub where you want it instaled.
You can try running setup (hd0) to see what happens but it appears grub wasn't installed previously. If you know it, enter the path root is on even if grub isn't there. You may get lucky.

Adrian_b
August 5th, 2006, 02:31 PM
Thanks!
Was exactly what i needed..
I kept doing 'sudo grub-install '(hd0,0)'' which obviously didn't work :p

kurup
August 5th, 2006, 04:54 PM
I follwed your procedure to the T, infact the live cd (6.06 LTS) took everything in beautifully. It even gave me the output that the grub has been succesfully loaded.

I have a dual boot (windows 2000 and dapper). This is how my menu.1st looks like

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=/dev/hda2 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,1)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery mode) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title Ubuntu, kernel 2.6.15-26-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-26-386 root=/dev/hda2 ro quiet splash
initrd /boot/initrd.img-2.6.15-26-386
savedefault
boot

title Ubuntu, kernel 2.6.15-26-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-26-386 root=/dev/hda2 ro single
initrd /boot/initrd.img-2.6.15-26-386
boot

title Ubuntu, kernel 2.6.15-23-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-23-386 root=/dev/hda2 ro quiet splash
initrd /boot/initrd.img-2.6.15-23-386
savedefault
boot

title Ubuntu, kernel 2.6.15-23-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-23-386 root=/dev/hda2 ro single
initrd /boot/initrd.img-2.6.15-23-386
boot

title Ubuntu, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Windows 2000
root (hd0,0)
savedefault
#makeactive
chainloader +1


Could I have a corrupted grub? If so..how do I go about rectifying it?

Thanks in advance.

catlett
August 6th, 2006, 12:48 AM
That appears to be a perfectly fine grub menu. Is it having an issue?
Right now it is booting with the 2.6.15-23-386 kernel to the second partition of your first hard drive, where it expects to find ubuntu. Are you getting into Ubuntu?
It is also booting to the first partition of your first hard drive where it expects to find windows. Are you getting into windows?

This file can be edited by any text editor as long as you have root priveleges. The file's path is /boot/grub/menu.lst.
If you needed to access this document from Ubuntu, the commmand would be
sudo gedit /boot/grub/menu.lst

But this appears to be a perfectly fine menu. It has windows on the first partition and ubuntu on the second partition.

catlett
August 6th, 2006, 01:06 AM
Thanks!
Was exactly what i needed..
I kept doing 'sudo grub-install '(hd0,0)'' which obviously didn't work :p

Glad you found it and it worked. I drove myself crazy ever since I first started adding other distros to my system.
I started with windows and ubuntu. Never had a problem, grub would install during the ubuntu install and that would be it.
Once I started multi-booting and constantly installing,deleting partitions, installing another etc I would end up with grub issues.
I never could find an easy way to install grub without being booted into a Linux distribution.
Not for nothing but what good is "grub-install" when you can't boot into your desktop to issue the command?!
My temporary solution was to install grub to a floppy on installation. Then I would have a copy of grub on the floppy that I could always use. Once the floppy booted me into my desktop I would issue grub-install.
I even found out how to make a grub floppy (that is my only other how to) but it still wasn't what I wanted. I wanted a simple way to install grub without being in an installed Linux distro. I couldn't believe the grub developers didn't make a way to install from a boot disk. They did, of course, but it wasn't easy to find. The find, root, setup string is buried in the grub manual and it doesn't mention using a live CD. They state it as an alternative to grub-install. I then saw a mempis how to about using a live cd and find, setup etc. I am always looking for grub info so I bookmarked it to go into it later but I must not have saved it. I searched and searched but never found it again. I finally decided to look into it myself and see if it can be done. Once I knew it worked, I thought I would share it with others who are have grub issues.
I hope this ends the agony of grub. As far as the "help I installed windows and grub is gone" or "grub was working yesterday but today I get error ##?

kurup
August 6th, 2006, 07:07 AM
That appears to be a perfectly fine grub menu. Is it having an issue?
That is correct. It gives me the grub menu on boot-up..but when I scroll down to the 'Windows 2000' line..it flips me back to the first line. Strange..have no clue why?!


Right now it is booting with the 2.6.15-23-386 kernel to the second partition of your first hard drive, where it expects to find ubuntu. Are you getting into Ubuntu?
Ubuntu is booting up just fine..no problems there whatsoever


It is also booting to the first partition of your first hard drive where it expects to find windows. Are you getting into windows?
No. That is really the problem!

Here's what my fdisk looks like

Disk /dev/hda: 40.0 GB, 40060403712 bytes
255 heads, 63 sectors/track, 4870 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1305 10482381 7 HPFS/NTFS
/dev/hda2 1306 4780 27912937+ 83 Linux
/dev/hda3 4781 4870 722925 5 Extended
/dev/hda5 4781 4870 722893+ 82 Linux swap / Solaris
Its supposed to be set to boot thru Windows.

Any suggestions for me?

confused57
August 6th, 2006, 07:34 AM
catlett, your "HowTo" worked perfectly...I had installed Mepis after Dapper on another partition, allowing Mepis to overwrite grub to the mbr. However, Ubuntu wasn't automatically added to Mepis grub...I was able to add the Dapper into my Mepis menu.lst in order to boot Dapper.
Used your method with the Live CD to reinstall Dapper's grub to the mbr, then added the entry to boot Mepis. Thanks.

kurup, you might try removing the # in front of makeactive:


title Windows 2000
root (hd0,0)
savedefault
#makeactive
chainloader +1

If that doesn't work, try rootnoverify (hd0,0)

catlett
August 6th, 2006, 01:01 PM
No. That is really the problem!

Here's what my fdisk looks like
Quote:
Disk /dev/hda: 40.0 GB, 40060403712 bytes
255 heads, 63 sectors/track, 4870 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1305 10482381 7 HPFS/NTFS
/dev/hda2 1306 4780 27912937+ 83 Linux
/dev/hda3 4781 4870 722925 5 Extended
/dev/hda5 4781 4870 722893+ 82 Linux swap / Solaris
Its supposed to be set to boot thru Windows.

Any suggestions for me?
Open the grub menu with this command (if you are in ubuntu, if you are using a distro that uses su instead of sudo, su to root and leave out sudo from the command)

sudo gedit /boot/grub/menu.lstThe only thing strange is what confused57 pointed out. There is a comment in front of makeactive. A # tells the system that the following text is to be ignored. That the text is a comment by the writer and not a commnand.
Since "makeactive" is commented out, grub isn't setting the partition active and this may be the issue. So remove the # in front of makeactive and try to boot.
The only other thing to try is mentioned by confused57 as well, replace root with rootnoverify. This tells grub not to try and mount the partiution



# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Windows 2000
rootnoverify (hd0,0)
savedefault
makeactive
chainloader +1See what happens. It should be booting because
/dev/hda1 * 1 1305 10482381 7 HPFS/NTFSdev/hda1 is written by grub as (hd0,0). So the entry is correct. Try removing the # and then try rootnoverify.

If there is still an issue, you can re-installl grub again from the terminal. To install grub from the terminal
sudo grub-install /dev/hda

kurup
August 9th, 2006, 06:29 PM
tried doing what you said..even followed this (http://doc.gwos.org/index.php/Restore_Grub) thread. still can't figure out where I'm screwing up?

Below is part of my dmeg:

[17179590.420000] NTFS driver 2.1.25 [Flags: R/O MODULE].
[17179590.452000] NTFS-fs warning (device hda1): is_boot_sector_ntfs(): Invalid boot sector checksum.
[17179590.452000] NTFS-fs error (device hda1): read_ntfs_boot_sector(): Primary boot sector is invalid.
[17179590.452000] NTFS-fs error (device hda1): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover.
[17179590.456000] NTFS-fs error (device hda1): ntfs_fill_super(): Not an NTFS volume.

disk-manager app to fails to read the windows partition..any clues on what the real problem could be?

tincbtrar
August 10th, 2006, 12:04 AM
Catlett,

Many thanks for your howto. I hosed my grub about 2 months ago after some Windows Updates for my ThinkPad. Today, after installing some other updates, grub was again broken. Your howto saved me from pulling out my hair!

Cheers.
Brian.

tosk
August 10th, 2006, 04:15 AM
Mine was a slightly different story. I couldn't get grub to find the stage1 file or even recognize my drive. So I borrowed some knowledge I picked up while using Gentoo:

You have to mount your root partition using the livecd:

$ sudo mkdir /mnt/root
$ sudo mount -t ext3 /dev/sda6 /mnt/root
Then you have to mount the proc subsystem and udev inside /mnt/root also:

$ sudo mount -t proc none /mnt/root/proc
$ sudo mount -o bind /dev /mnt/root/dev
Doing this allows grub to discover your drives. Next you have to chroot:

$ sudo chroot /mnt/root /bin/bash
Now that you're chrooted into your drive as root everything should work.

# grub
grub> find /boot/grub/stage1
It found mine on (hd0,5)

grub> root (hd0,5)
It successfully scanned the partition and recognized the filesystem-type

grub> setup (hd0)
That was it. It installed and on reboot I was thrown back into Ubuntu.

This might help some people who are having issues so I thought I would post it.

PLEASE NOTE: My Ubuntu was installed to /dev/sda6. This may not be the same for everyone. /dev/sdaX means it's SCSI/SATA/USB/FireWire drive. And it's partition 6 because I have a weird partitioning scheme in place.

--Tosk

catlett
August 10th, 2006, 11:27 AM
This might help some people who are having issues so I thought I would post it.
I for one appreciate it. I did not know about mounting proc and udev.

Just a comment to your self and anyone else,
Please post any helpful information about grub. I made this "how to" not to show I was smart or as "the final word", I wanted it to be a source of help. I struggled with grub issues and I never found an easy way to re-install. When I finally did, I posted the info for otheres. So please, anyone, post any information that you know of that isn't here, it is welcome by me and I am sure it will be by people looking for grub help.
Thanks for the info tosk/

P.S. tincbtrar....Glad it helped.

petri
August 11th, 2006, 11:12 AM
I used this HOWTO and now I can't start any hd, only cdrom and live cd works. BIOS finds hd's but GRUB doesn't show up. PC just stops.

On my second hd I have Edubuntu and when it's kernel is updated it chances grub and I can't start Ubuntu on my first hd. w2k starts although it's in my first hd. I thought that this howto would help me out but it did make everything just worse.

How is it possible that my PC can't find any hd after this howto? I didn't chance any BIOS or anything else, just followed this howto and everything vanished. :confused:

petri
August 11th, 2006, 04:34 PM
Just forget it. I reinstalled Ubuntu instead.

Welcome back to Windows! =D>

pt78
August 11th, 2006, 07:02 PM
I'm also having problems reinstalling grub (after installing XP). After doing either shorter or longer method described above (everything works just fine - no error messages) I reboot my machine ad get empty screen with blinking prompt. I tried installing to hd0, hd0,0 - always the same situation.
Any gueses what am I doing wrong?

pt78
August 11th, 2006, 07:42 PM
This reminds me: Does the same procedure aplly if /boot is on separate partition? I have / on hda6 and /boot on hda1. Would this make difference? And what about having /boot/grub/stage1 on both hda1 and hda6? Could this confuse grub? (not mentioning me :-) )

OK. Got this working finally. I have /boot on /dev/hda1 and / on /dev/hda6. Here is what I did:
1. Boot Ubuntu CD
2. Start Terminal
3.
sudo mkdir /mnt/root
4.
sudo mount -t ext3 /dev/hda6 /mnt/root
5. You probably won't need this:
sudo mv /mnt/root/boot/grub/stage1 stage1.bkp
6.
sudo mount -t proc none /mnt/root/proc
7.
sudo mount -o bind /dev /mnt/root/dev
8.
sudo chroot /mnt/root /bin/bash
9. Now I mounted my /boot as follows:
sudo mount -t ext3 /dev/hda1 /boot
10. And finally, instead of running grub I used grub-install:
sudo grub-install /dev/hda
11. Rebooted and that's it!

catlett
August 11th, 2006, 11:44 PM
Just a note to anyone who posts, I live in Boston, MA USA. My time is Eastern Standard Time USA or GMT -4. I am most likely the only person who will regularly check this thread. It can be 20 hours between my log-ons, (i.e. In bed at 10pm. Up at 5:30am and off to work. Home, shower, dinner and then log on around 6pm) so I am not abandoning anyone or nor do I not care. It's just I am not online to respond.
This method is from the grub manual http://www.gnu.org/software/grub/manual/grub.html In the "install grub natively" section http://www.gnu.org/software/grub/manual/grub.html#Installing-GRUB-natively

Just for the sake of full disclosure and to show this method is not a creation of mine but is a feature of grub. Here is the grub manuals description of the 2 ways to install grub. find/setup and grub-install


3.2 Installing GRUB natively

Caution: Installing GRUB's stage1 in this manner will erase the normal boot-sector used by an OS.

GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD directly, so using it on a boot sector (the first sector of a partition) should be okay. But generally, it would be a good idea to back up the first sector of the partition on which you are installing GRUB's stage1. This isn't as important if you are installing GRUB on the first sector of a hard disk, since it's easy to reinitialize it (e.g. by running `FDISK /MBR' from DOS).

If you decide to install GRUB in the native environment, which is definitely desirable, you'll need to create a GRUB boot disk, and reboot your computer with it. Otherwise, see Installing GRUB using grub-install.

Once started, GRUB will show the command-line interface (see Command-line interface). First, set the GRUB's root device4 to the partition containing the boot directory, like this:

grub> root (hd0,0)

If you are not sure which partition actually holds this directory, use the command find (see find), like this:

grub> find /boot/grub/stage1

This will search for the file name /boot/grub/stage1 and show the devices which contain the file.

Once you've set the root device correctly, run the command setup (see setup):

grub> setup (hd0)

This command will install the GRUB boot loader on the Master Boot Record (MBR) of the first drive. If you want to put GRUB into the boot sector of a partition instead of putting it in the MBR, specify the partition into which you want to install GRUB:

grub> setup (hd0,0)

If you install GRUB into a partition or a drive other than the first one, you must chain-load GRUB from another boot loader. Refer to the manual for the boot loader to know how to chain-load GRUB.

After using the setup command, you will boot into GRUB without the GRUB floppy. See the chapter Booting to find out how to boot your operating systems from GRUB.

Next: Making a GRUB bootable CD-ROM, Previous: Installing GRUB natively, Up: Installation
3.3 Installing GRUB using grub-install

Caution: This procedure is definitely less safe, because there are several ways in which your computer can become unbootable. For example, most operating systems don't tell GRUB how to map BIOS drives to OS devices correctly—GRUB merely guesses the mapping. This will succeed in most cases, but not always. Therefore, GRUB provides you with a map file called the device map, which you must fix if it is wrong. See Device map, for more details.

If you still do want to install GRUB under a UNIX-like OS (such as gnu), invoke the program grub-install (see Invoking grub-install) as the superuser (root).

The usage is basically very simple. You only need to specify one argument to the program, namely, where to install the boot loader. The argument can be either a device file (like `/dev/hda') or a partition specified in GRUB's notation. For example, under Linux the following will install GRUB into the MBR of the first IDE disk:

# grub-install /dev/hda

Likewise, under GNU/Hurd, this has the same effect:

# grub-install /dev/hd0

If it is the first BIOS drive, this is the same as well:

# grub-install '(hd0)'

Or you can omit the parentheses:

# grub-install hd0

But all the above examples assume that GRUB should use images under the root directory. If you want GRUB to use images under a directory other than the root directory, you need to specify the option --root-directory. The typical usage is that you create a GRUB boot floppy with a filesystem. Here is an example:

# mke2fs /dev/fd0
# mount -t ext2 /dev/fd0 /mnt
# grub-install --root-directory=/mnt fd0
# umount /mnt

Another example is when you have a separate boot partition which is mounted at /boot. Since GRUB is a boot loader, it doesn't know anything about mountpoints at all. Thus, you need to run grub-install like this:

# grub-install --root-directory=/boot /dev/hda

By the way, as noted above, it is quite difficult to guess BIOS drives correctly under a UNIX-like OS. Thus, grub-install will prompt you to check if it could really guess the correct mappings, after the installation. The format is defined in Device map. Please be quite careful. If the output is wrong, it is unlikely that your computer will be able to boot with no problem.

Note that grub-install is actually just a shell script and the real task is done by the grub shell grub (see Invoking the grub shell). Therefore, you may run grub directly to install GRUB, without using grub-install. Don't do that, however, unless you are very familiar with the internals of GRUB. Installing a boot loader on a running OS may be extremely dangerous.

Elcoco
August 19th, 2006, 03:07 AM
hi i tried doing this on my systemi did setup (hd2) after doing root (hd1,0) hd2 is sda1 which is where my windows is installed and hd1 is where my linux is installed. i did this because when i tried to boot of my iwndows drive grub was never called and if i booted off the linux one i got an error 17, now it boots grub first in both cases but if i do it with my sda drive it jsut hagns after writing grub on the screen and on the linux one i still get error 17. how can i erase grub from my windows partition or make it work at least?

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=/dev/hdd1 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd1,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash (IDE=nodma)

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery mode) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title Ubuntu, kernel 2.6.15-23-386
root (hd1,0)
kernel /boot/vmlinuz-2.6.15-23-386 root=/dev/hdd1 ro quiet splash (IDE=nodma)
initrd /boot/initrd.img-2.6.15-23-386
savedefault
boot

title Ubuntu, kernel 2.6.15-23-386 (recovery mode)
root (hd1,0)
kernel /boot/vmlinuz-2.6.15-23-386 root=/dev/hdd1 ro single
initrd /boot/initrd.img-2.6.15-23-386
boot

title Ubuntu, memtest86+
root (hd1,0)
kernel /boot/memtest86+.bin
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hdc1
#title Microsoft Windows XP Professional
#root (hd0,0)
#savedefault
#makeactive
#chainloader +1


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Windows XP Media Center Edition
root (hd2,0)
savedefault
makeactive
map (hd1) (hd2)
map (hd2) (hd1)
chainloader +1

soham
August 19th, 2006, 03:44 AM
thanks

Drakkor
August 19th, 2006, 04:26 AM
A BIG THANKS, CATLETT !! =D>
You just saved me,lol !! Had Ubuntu/XP dual boot working fine,both on different drives with grub on the mbr.Was working great till I got the brilliant idea of installing the GAG bootloader, wanted to see if I could boot 9 different OSs on my computer,like it says, I guess and installed GAG on my mbr, Long story short, it wouldn't boot to Ubuntu, said "boot device missing or invalid" Holy Shiite !! So anyway your guide fixed it up,just like new,lol !! Thanks Again :D

catlett
August 19th, 2006, 04:45 AM
soham & Drakkor, you are very welcome. This is why I posted it. I battled grub re-installation for quite a while until I found this method.

Now to Elcoco

how can i erase grub from my windows partition or make it work at least?

Grub has been having alot of issues with sata. It is a recurring post on the forum that people install grub on sata and can't boot.
If I was you, I would restore windows botloader. That way you can access your windows instalolations. Then I would try another bootloader for accessing linux.

You need an XP installation disk. Not a recovcery disk that a computer maker sends you with your system but a real XP install disk.

Boot to the installation disk. Enter into the recovery option. Eventually you will get to a command prompt ( i.e. C:\ ) At the prompt enter
fixmbr Just in case you want some screen shots http://www.geocities.com/kilian0072002/recconsole2.html


Now bot into the cd again and run the commands to install grub. But install grub to the partition not the mbr. Meaning enter setup (hd1,0).

Now you shopuld have the windows loader on the mbr and grub on linux's partition. This is where I would try GAG. It is another bootloader. It can boot xp and linux. Hopefully it will do the trick. http://gag.sourceforge.net/
http://users.bigpond.net.au/hermanzone/p12.htm
(but it appears it didn't help Drakkor)

You could also try the grub super disk.
http://adrian15.raulete.net/grub/tiki-index.php
http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html

theadventuresofanidealist
August 23rd, 2006, 11:33 PM
the command find /boot/grub/stage1 doesnt find anything.
also cant do the sudo mount -t ext3 /dev/sda6 /mnt/root says no such device sda6. where do i go from here?

theadventuresofanidealist
August 24th, 2006, 12:43 AM
neither of these two work for me.
the first method cant find the the file.
the second it says :

mount: wrong fs type, bad option, bad superblock on /dev/hda7,
missing codepage or other error
In some cases useful info is found in syslog - try dmesg tail or so.

pls help.

catlett
August 24th, 2006, 03:36 AM
Did you have ubuntu installed and Grub working? If so, how did you lose grub? The find command is looking for the files. It needs to find your root partition. If you erased your root partition, this isn't going to work. It sounds like your partition has been deleted or corrupted. I only say it because find/grub... didn't find anything and mount came up with a wrong fs type. You need to have ubuntu installed on a partition and for the partition to be uncorrupted. This will put grub on the mbr but everything else has to be fine. The mbr can be corrupted or gone but your root has to be there and have ubuntu installed on it.

But first things first. Did you have grub installed and working and how did it stop functioning?

cleentrax
August 24th, 2006, 08:53 PM
Thanks for the tips. But I'm having no luck. When I run grub> /boot/grub/stage1, I get error 15, file not found.

If I try an install from the live cd I get an error that it cannot install grub.

I have five hard drives: one for the boot, and 4 for a software raid 5. The drives all show up, but I can't get an install to work. I must have some mbr messing me up somewhere. How can I wipe all the drive's MBRs and start over? Or am I having some other problem?

catlett
August 25th, 2006, 01:03 AM
Raid has become a big problem. Grub just has a problem identifying the correct mbr (or so it appears). You can try one more thing. Don't bother with find /boot/grub/stage1. Just run the root and setup commands. The only thing is you have to know which partition your ubuntu installation is on. If you know the partition then try it with just root and setup.
There are other methods to try as well.
You could also try the grub super disk. This is the download site.
http://adrian15.raulete.net/grub/tiki-index.php
This is a tutorial on it.
http://users.bigpond.net.au/hermanzo...bDiskPage.html

There is also GAG. It is another bootloader. Here is it's site. http://gag.sourceforge.net/
This is another one of Hermans guides. It is about gag.
http://users.bigpond.net.au/hermanzone/p12.htm

If you feel like a little research, here is grub's manual http://www.gnu.org/software/grub/manual/grub.html

jerry_c
August 27th, 2006, 08:55 PM
Dear Catlett,

I sure appreciate your expertise in this area and your willingness to share it. I've been fighting this problem for 3 days now. I've been posting to my lug, googling, reading some of the ubuntu forum posts, and your post is definitely the closest to my problem. I'm working from the Dapper Live CD.

A little historical background: This computer originally came with Windows XP Home Edition about 3 years ago. As soon as I got it home I immediately removed Windows and installed Linux. A couple years ago I had to recover the HD and the recovery cd's reinstalled Windows. However, I never used Windows on it until the other day. I had what seemed like a hardware problem with my ethernet card not letting me connect to the Internet. Remembering that I had Windows on the computer, I decided to see if Windows had the same problem with the network card. Sure enough, it did. So I installed another ethernet card. Unfortunately, one time while fiddling with the cables behind the computer I bumped the power cord while the computer was booted into Windows. When I put the cord all the way back in, it seems that Windows automatically "fixed" the MBR and now the computer only boots to Windows.

Here are my partitions:

hda1 - MBR FAT32
hda2 - Windows NTFS
hda3 - Linux swap (This placement because suggested Windows will sometimes write a little beyond its partition limits. Placing swap here prevents Windows from overwriting the beginnings of a Linux install or data partition.)
hda4 - extended partition pointers
hda5 - /boot ext2
hda6 - previous install (no longer used) ext3
hda7 - current Ubuntu Dapper install ext3
hda8 - /home ext3

/boot on hda6 and hda7 point to hda5
/home on hda6 and hda7 point to hda8

What I've done so far:

sudo grub-install /dev/hda
sudo grub-install /dev/hda1
sudo grub-install /dev/hda5
sudo grub-install hd0

All returned: "Could not find device for /boot: Not found or not a block device."

"sudo fdisk -l" listed hda2 as the boot partition.

So I did:

"sudo fdisk /dev/hda"

followed by "a" Enter, "1" Enter, "w" Enter, then turned off the computer and restarted. (Just rebooting did not work.) It put an * in the boot column for both hda1 and hda2. I retried the "sudo grub-install hd*" commands, and still got "Could not find device for /boot: Not found or not a block device."

So, I tried "sudo grub" followed by "find /boot/grub/stage1" which returned, "Error 15: File not found."

I mounted the ubuntu partition using "sudo mount -t ext3 /dev/hda7 /mnt/ubuntu". I mounted proc and udev like tosk described and chrooted:

sudo mount -t proc none /mnt/ubuntu/proc
sudo mount -o bind /dev /mnt/ubuntu/dev
sudo chroot /mnt/ubuntu bin/bash

They all seemed to work fine. Then, when I tried "sudo grub" I got:

sudo: unable to lookup ubuntu via gethostbyname()

I tried chrooting to /mnt/boot, where hda5 is mounted but got:

chroot: cannot run command `/bin/bash': No such file or directory

grub> root (hd0,4)
Filesystem type is ext2fs, partition type 0x83

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

Error 15: File not found

Also, fwiw, I cannot read the files in the mounted hda5 with nautilus or gedit, but gparted shows they are still there. It is possible that hda5 is corrupted.

So, I'm still running from the Live CD. If I try to boot from the hard drive, it goes directly to Windows.

My first preference would be to be able to boot from grub, even if it means not being able to boot Windows. My second preference would be for the Windows boot loader to give me the option to boot Ubuntu.

In the meantime, if I could even use the Live CD to boot the Ubuntu distro that's on my hard drive, that would be a big step forward. My floppy drive does not work, nor does the CD writer, so making a boot floppy or a boot CD is not an option.

Is it possible to install grub to the hd using apt-get or some other command from the Live CD? Maybe only stage1 is needed. The CD seems to contain grub. Can stage1 just be made with gedit or pasted in from a post?

If you notice what seems to be a range of some rather sophisticated pieces mixed in with some noob sounding questions or thinking, it is because I had some help in some of the setup. I am only part geek, myself.

Any help would sure be appreciated. I sure miss my usual Ubuntu setup and all my files.

Thanks.

P.S. I notice you're in Boston. I was bon and raised in Woosta.

catlett
August 27th, 2006, 09:57 PM
I would recomend the super grub disk but making any kind of boot disk is out of the question. There are a couple of things to do though. One you could try booting from the windows bootloader. I never did this but there are a couple of how tos, crap I forgot they need a floppy.

You could try to chroot into your root partition. NEVERMIND.. You tried that and got an error.

Before you go any farther, I would install the ext2 driver for windows, if you haven't already. http://www.fs-driver.org/ Copy anything important to a flash drive or upload it to a file hosting site http://s7.quicksharing.com/ (just in case you loose the ability to boot altogether) and then you can try 2 things.

You could try apt-get. I never apt-get installed grub from a live cd. I do not know what it does. Hopefully it will put grub's file's somewhere so you can use them for the setup (hd0).
If that doesn't work, you can try apt-get install lilo. Lilo, as you know, was the first linux bootloader. Again I never installed it from a live cd. They are both in synaptic but I do not know the effect of using a live cd. Maybe you can get lucky and it will let you select where you want to install grub and you can choose your mounted partition.

If you have important data, then the safest way is to use windows with the ext2 driver. Upload/copy off all important data and reinstall ubuntu from an installation cd. Now that I think of it, if you are going to reinstall, you only have to copy data to your windows parttitionm with the ext2 driver because the installer will leave that partition alone.

I know this is a bit rambling, I've been thinking and writing at the same time. To sum it up, your only options appear to be using spt-get from the liove cd to install grub or lilo.
The safe way would be to get your data off the computer and re-install ubuntu.
Do you have an installation disk? If you don't, pm me with your address and I'll mail one out to you. Ship-It sent me 5 so I have a few extra to spare. I only mention it because you don't have the ability to download abd burn an iso and ship-it takes a month.
Let me know.

P.S. This is the old grub restore How To for ubuntu. I never liked it and it is the reason I posted this one but it may help you. If you have an installation disk, you can try this. I do not know if this matters but this how to was originally made during Breezy and using the 5.10m install disk, I think you can get the results from any install disk but I just wanted to mention it. http://doc.gwos.org/index.php/Restore_Grub


ONE MORE THING. I was just looking at your chroot error. try chrooting without the !bin/bash. I was just searhing for gub restore and I found the old how to and it had a reply about chroot. It did not mentiuon ! bin/bash. Maybe it will work without adding it.

jerry_c
August 27th, 2006, 10:46 PM
Thanks for your quick reply. The Live CD I'm using does have an install option. I'm hesitant to reinstall, though, because I have added a LOT of extra packages and I don't want to have to reinstall them. I tried doing apt-get from the CD. I used post # 3 from this thread as a guideline:

http://ubuntuforums.org/showthread.php?t=223975

It said:

Or... use a Ubuntu live CD on your computer with a faster connection. Let's say you wanted to install alien, kword, and epiphany.

Boot up the live CD on the faster connection computer. Then go to the terminal and type in

Code:

sudo apt-get clean sudo aptitude update sudo aptitude install kword epiphany-browser alien

Then go to /var/cache/apt/archives and copy all the .deb files to a USB key or iPod or some external drive.

Then copy those .deb files to the other computer's desktop and then

Code:

cd ~/Desktop sudo dpkg -i *.deb

I tried this for grub, but when I went to /var/cache/apt/archives there were no .deb files there to copy. If they were there, I would have just copied them to the mounted partition of my ubuntu distro on my hd.

So, the suggestion you posted at http://doc.gwos.org/index.php/Restore_Grub seemed like a good idea. I tried it, but when I got to step 4, it wanted a mount point for everything, not just / /boot and swap. I gave mount points for them all and finished step 5. Then, instead of going to step 6 and asking me to save, it said it was now going to install. I'm hesitant to go that far without more assurance that it won't really install.

Any pointers?

How about a way to boot to my ubuntu distro on my HD from the install CD?

catlett
August 27th, 2006, 11:09 PM
I didn't look at the link but if you want a deb for grub, go to the Dapper packages site and download the deb http://packages.ubuntu.com/dapper/admin/grub

I do not knmow about the dependencies or if that is it.
You can get any ubuntu package here http://packages.ubuntu.com/

jerry_c
August 28th, 2006, 01:03 AM
It got me the deb, thanks. I downloaded it and copied it into where I have my ubunto distro mounted on my hard drive, but running
sudo dpkg -i --root=/mnt/ubuntu grub_0.97-1ubuntu9_i386.deb
still didn't seem to make a stage1 file anywhere.

I know you never liked the old grub restore, and it does seem a little like an overkill, but might there be some script that would restore grub without risking installing a whole new distro?

Also, is there a way to use the install CD to boot a distro that's already installed on the HD?

catlett
August 28th, 2006, 01:18 AM
Do you know what partition holds ubuntu's root? For sake of arguement let's say it is on (hd0,2). Try running it without the find command and go right to root and setup. Can't hurt to try.


sudo grub
at grub<

root (hd0,2)

setup (hd0)

quit

What does that do? Also did you chroot without bin/bash?

jerry_c
August 28th, 2006, 02:40 AM
Good try, catlett, but when I do setup (hd0), I get the same error message as I did when I tried to do setup after making hda5 the root
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found

Even without putting /bin/bash on the end of chroot, I get that error message. It is the default of chroot.

I have figured out that hda5 was either corrupted or reformatted somehow. So, I mounted /dev/hda5 on /mnt/ubuntu/boot, and did
dpkg -i --root=/mnt/ubuntu --force-overwrite for both grub and the latest kernel. That did put something meaningful into my /boot partition. However, there is still no file called stage1.

catlett
August 28th, 2006, 03:10 AM
since it is a partition issue, Azz's gparted recovery method may help. The live cd should have gparted but if not just apt-get install gparted.

Here is the link, hope it somehow helps http://www.ubuntuforums.org/showthread.php?t=226836

jerry_c
August 28th, 2006, 06:56 AM
Dear catlett,

I got it working.

To recap from some earlier posts and update, I have a separate /boot partition that seems to have gotten corrupted by a Windows recovery boot. A more detailed description of my system and what I tried that did not work is here: http://ubuntuforums.org/showpost.php?p=1429899&postcount=42

Here's what worked to restore grub using only the Live/Install CD to access the problem hard drive. No other drives, floppies, pen drives, or other CD's were used.

1. Made a new directory under /mnt as a mountpoint for mounting the ubuntu root partition
sudo mkdir /mnt/ubuntuExplanation: The live cd does not automatically mount your hard drive. You have to do this manually, partition by partition.

2. Mounted the ubuntu root partiton
sudo mount -t ext3 /dev/hda7 /mnt/ubuntu
3. Mounted the boot partition to the boot directory of the mounted ubuntu root
sudo mount -t ext2 /dev/hda5 /mnt/ubuntu/boot
Explanation: This mounts the boot partiton in the same place it would be mounted if the hard drive were booted to the ubuntu distro installed on hda7.

4. Changed to the package archives directory.
cd /var/cache/apt/archives
Explanation: This is where the latest kernel package would be.

5. Found the latest kernel image.
ls -l linux*
6. Forced a kernel install into the /boot partition.
sudo dpkg -i --root=/mnt/ubuntu --force-overwrite linux[XXX].deb
Explanation: Running dpkg on a kernel package places the kernel image into the /boot directory. In this case, since the /boot directory of the mounted ubuntu root is really the /boot partition mounted on the mounted ubuntu root, the kernel ends up in the /boot partition.

7. Since the previous item gave some notification of grub errors, downloaded the latest grub .deb file, then did a force install of the grub package.
sudo dpkg -i --root=/mnt/ubuntu --force-overwrite grub[XXX].deb
8. Said yes when asked to have a menu.lst file created.

9. Repeated step 6. This time there were no grub errors reported. It is possible that reversing steps 6 and 7 would have avoided this step.

10. Ran grub-install to the device, not the partition, using the mounted ubuntu partition as the root directory.
sudo grub-install --root-directory=/mnt/ubuntu /dev/hda This also created the previously missing stage1 file, the lack of which was preventing earlier attempts to fix grub from working.

Note. This did not work an earlier time when the boot partition was not mounted on /boot of the mounted root partition.

I also believe that using the
--root-directory=[path to your mounted root directory] option is critical with using this command from the live CD. Others have reported that this command does not work from the live CD. It should work fine if you use this option.

11. Used
sudo gedit to edit the root line of /mnt/ubuntu/boot/grub/menu.lst from (hd0,0) to (hd0,4).

NOTE_0,0 (note_a1): If a boot partition exists (as in this case), use its location instead of the location of the root partition. This can be confusing because it is asking for the root location and you are answering with the boot location. On many systems they are the same, but not if you have a /boot partition.

NOTE_0,1 (note_a2): There are two counting systems. The alphabetized system, e.g.: hda, hdb, etc, begins counting partitions at 1, whereas the numerical system, e.g.: hd0, hd1, etc, begins counting partitions at 0. So, for example, in this case, the boot partition, hda5, is hd0,4.

NOTE_0,2 (note_a3): I realize now that, at this point, I could have used sudo grub and followed the instructions in catlett's opening post to this thread http://ubuntuforums.org/showpost.php?p=1308395&postcount=1 to set the root partition, since I now had a stage1 file. I had tried it before I had a stage1 file and that solution wasn't working because it couldn't find the stage1 file. Because step 10 created the missing stage1 file, catlett's solution would probably have worked at this point, but I didn't think of it at the time.

NOTE_0,3 (note_a4):At some time in the future, I can edit the meun.lst for more choices, such as to my alternate distro on hda6, booting to a command prompt, or even booting to Windows (if I ever wanted to do that again).

12. Shut the computer completely down. When doing major changes, particularly when dealing with booting issues, I have found that changes stick more often than when just rebooting. YMMV.

13. Restarted.

14. Logged onto this site to share what worked and express my gratitude.

While this might not be the most elegant way to restore grub, the bottom line is that it did work. I'm so glad to be back up on my usual system with all my programs, settings and files. Thanks for all your help. Thanks to the folks in my local LUG who helped, too.

afx
August 28th, 2006, 09:47 AM
Hello peeps!
My grub is also gone to hell so i'm trying to get it back. My partition table looks like this:

/dev/hda1 /boot Linux Boot
/dev/hda2 /win Windows XP
/dev/hda3 / Linux root
/dev/hda4 (extended partition)
/dev/hda5 /swap Linux swap
/dev/hda6 /home Linux home
/dev/hda7 /wind Widows second partition (d:)

As you can notice, I installed my boot files on hda1 /boot partition. I followed the howto from above to recover my grub files, but when I type find /boot/grub/stage1 it returns nothing!
Assumably I should type root (hda0,0) (hda1 right?) for setup to fetch the grub files from that partition and then... this is what bothers me - install it to MBR hd(0) or to /boot hd(0,0) partition? Please help me clear these things out, I don't want my boot files to be lost forever!

jerry_c
August 28th, 2006, 10:05 AM
Here's what I'd do first. Boot with the live/install CD.

The CD does not mount your hard drive. Use the partition editor to view your partitons, then mount all your partitions.

Then run
sudo nautilus and browse your system. If you want to edit anything, use
sudo gedit which will give you root permission to edit any file you have mounted. Of course, back up anything before you edit. Do not rely on the gedit auto backup feature. Those backup files get overwritten with each automatic backup. After the second automatic backup, the backup file is no longer your original file.

You might want to copy all your key files from your /boot partition to some new directory you create on your /home partition before you edit or run anything. Running Nautilus as sudo should make that easy to do.

You should be able to recover from what's going on. If you have to remake your /boot partition it's not that big of a deal, far simpler than reinstalling your whole distro or some of the problems Windows users have been known to have.

I'm headed to bed. catlett, the expert on this subject, will probably check in sometime after daylight here on the east coast. It's only 5am now. Good luck.

catlett
August 29th, 2006, 11:01 AM
Jerry,
That was some work! Persaverence paid off. Glad you are up and running.

afx,
sorry to not get online yesterday. I need to move to werstern mass. with Jerry. My car was vandalised yesterday amd it was an all day project to fix the windows and tire. Life in the city#-o
I do not knmow if your issue is resolved or not but, you are right about boot. Your grub files are in boot and since you have a boot partition, grub is installed there. You can try to rub setup without find if you know boot has grub. Hopefully nothing happened to the partition. Just run
sudo grub
root (hd0,0)
setup (hd0)
quit
You want to install to hdo because you need the first part of grub on the nbr. If you use setup (hd0,0) then grub will not start at boot, you would need another bootloader to send the boot to grub on hd0,0

afx
August 29th, 2006, 06:29 PM
Thanks guys...
it worked just fine, of course ;-)

@jerry_c: i mounted the /boot partition and copied it just in case... case that didn't happen ;-)

Thanks again!

jerry_c
August 30th, 2006, 06:52 AM
I'm in Western NC, catlett, not Western MA. New England is too cold for me and, yes, it's nice to be out of the big city. I found another thread where a Tomosaur wrote a script called GrubED that gives a gui for editing grub. It's here: http://ubuntuforums.org/showthread.php?t=228104 If anybody would be able to evaluate it, it would be you. Thanks again for all your help. Good luck getting your car restored.

imhdd
August 30th, 2006, 08:23 PM
Thank you catlett.

I was experimenting using Norton Ghost 2003 to clone dual boot Win98SE and Ubuntu 6.06 from 80GB drive to 40 GB drive. Clone went fine but Ghost clone doesn't recognize GRUB so I couldn't boot the clone.

After much trying to restore GRUB I gave up and began a search.
Found your directions. Used live CD per your first post and it worked on first try. GREAT! Another lesson learned.

Thanks very much.
imhdd

themusicwave
September 5th, 2006, 01:05 AM
I am trying to help a friend fix his dual boot. He accidentaly overwrote GRUB when he installed XP.

I followed the directions in the first post and Grub is now working. There is just 1 problem, now Windows isn't showing on the GRUB list.

Is there an easy fix to this issuse? My friends use of Ubuntu rests on my figuring this out. If I don't get it soon he will propably ditch Ubuntu for just windows.

jerry_c
September 5th, 2006, 01:24 AM
The menu.lst file probably just needs editing. It's in /boot/grub.

Note that it uses a numerical system starting at 0 for drives and partitions. hda1 = hd0,0. hda2 = hd0,2. hdb1 = hd1.0. hdb2 = hd1,1.

Good luck.

confused57
September 5th, 2006, 02:53 AM
I am trying to help a friend fix his dual boot. He accidentaly overwrote GRUB when he installed XP.

I followed the directions in the first post and Grub is now working. There is just 1 problem, now Windows isn't showing on the GRUB list.

Is there an easy fix to this issuse? My friends use of Ubuntu rests on my figuring this out. If I don't get it soon he will propably ditch Ubuntu for just windows.

You'll need to open a terminal and edit the menu.lst file:

cd /boot/grub
sudo cp menu.lst menu.lst_backup
gksudo gedit menu.lst

then add something like this to the bottom of the file:


title Windows XP
root (hd0,0)
savedefault
makeactive
chainloader +1

the above should boot Windows, if it is on the first partition of the first(or only) hard drive.

Edit: You can actually have savedefault set to more than one entry in grub and if you have the entry:
default saved

grub will boot the last OS that you booted into.

themusicwave
September 5th, 2006, 03:15 AM
thanks GRUB is working now!

jerry_c
September 5th, 2006, 03:28 AM
Good clarification, 57. Here are a few more:

If the menu does not show, comment out this line:

hiddenmenuso that it looks like this:
# hiddenmenu

If the menu is defaulting too fast, you can also change this line:
timeout Xto whatever amount of seconds you are comfortable with.

The line:
savedefaultgoes into the boot menu option you want as your default, e.g: Windows, Ubuntu, etc. and should only be in one option.

Hope this helps.

antisho
September 12th, 2006, 02:35 AM
Hello, I am having a problem with using grub to boot Windows from a logical partition, and was referred here. I don't feel like typing the whole thing again or even copying it (:P), so I'll just link to the thread (http://ubuntuforums.org/showthread.php?t=255053).

devilkin
September 22nd, 2006, 11:22 AM
Hello,

I've got a similar-ish problem, with Windows XP 64bit and Grub under Kubuntu.

link to thread: http://ubuntuforums.org/showthread.php?t=262766

quickwitt
September 24th, 2006, 03:56 AM
Brilliant!

I am back into Unbutu on my tri-boot XP/OSX/Ubuntu machine!

Thanks!:p

heri0n
September 30th, 2006, 11:44 PM
after reinstalling windows i need to reinstall grub however it doesnt seem to be working this is what i get

setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,6)/boot/grub/stage2
/boot/grub/menu.lst"... failed

Error 22: No such partition

can someone tell me whats wrong
i tried doing fixmbr from the windows recovery mode that didnt help
ubuntu is installed on (hd0,6)

jerry_c
October 1st, 2006, 01:13 AM
Dear heri0n,

It looks like your menu.lst file needs editing. You may need to mount it first. Earlier posts on this thread explain this. If that doesn't work, post again. Catlett checks in periodically on this thread and he's the real expert on this subject. There are some others here who also know way more than I do on this subject.

I can tell you this much. I was way more stuck than you are a few weeks ago, and the posts on this thread gave me what I needed to get unstuck overnight.

Good luck.

confused57
October 1st, 2006, 03:33 AM
after reinstalling windows i need to reinstall grub however it doesnt seem to be working this is what i get

setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,6)/boot/grub/stage2
/boot/grub/menu.lst"... failed

Error 22: No such partition

can someone tell me whats wrong
i tried doing fixmbr from the windows recovery mode that didnt help
ubuntu is installed on (hd0,6)
Here is an excellent explanation of grub:
http://users.bigpond.net.au/hermanzone/p15.htm

What do you get when you enter?:

grub> find /boot/grub/stage1

You might want to boot with the live cd and check the output of:

sudo fdisk -l
The -l is a small "L".

As jerry_c mentioned, catlett checks in frequently and I'm sure he can help you.

heri0n
October 1st, 2006, 06:19 AM
fdisk -l produces

Device Boot Start End Blocks Id System
/dev/hda1 * 1 637 5116671 7 HPFS/NTFS
/dev/hda2 638 9725 72999360 f W95 Ext'd (LBA)
/dev/hda3 4462 4588 1020096 82 Linux swap / Solaris
/dev/hda5 638 4461 30716217 b W95 FAT32
/dev/hda6 4589 9725 41262921 83 Linux

find /boot/grub/stage1

find /boot/grub/stage1
(hd0,6)

ill check out that link thankls

confused57
October 1st, 2006, 08:44 AM
Your Linux partition hda6 is the same as root (hd0,5) in grub...so you might be able to use the live cd, get to a grub prompt as described at the beginning of this thread, then root (hd0,5)...setup (hd0)...quit.

May or may not work.

heri0n
October 1st, 2006, 05:28 PM
ok i tried that, it shows me the fat partition though but i just followed through

grub> root (hd0,5)
Filesystem type is fat, partition type 0xb

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

Error 15: File not found


yeah, didnt work

but i think what you said is the problem

i think something is wrong with the device mapping
cuz when i try to do grub-install /dev/hda
it says it cant find /dev/hda7 which is true
i need it to look for hda6...

heri0n
October 1st, 2006, 05:47 PM
ok i think it is my partition table that may be messed up
i ran parted and i tried print and it says cant have overlapping partitions

and gparted shows my whole disk as unallocated
but windows boots fine

it may be because i killed the two ntfs partitions before and i made a ntfs and fat, but i looked at the table and it had like 2 small partitions in between < 1 mb...

is there any solution to this
or do i have to kill my partitions and restart?

lee101
October 1st, 2006, 06:04 PM
is there any way of installing this without the live cd i have lost mine:( :mad:

jerry_c
October 2nd, 2006, 03:45 AM
If you can boot to ubuntu with what you've got on your hard drive and all you need to do is edit grub so you can also boot to windows, the instructions on this thread should work, and you won't need to do any mounting. If you can't get ubuntu booted because grub isn't letting you, that's where the live/install CD comes in.

You or a friend can just download and burn one from another computer if you can't find your copy. You don't need to wait for one in the mail. Even an old CD of an earlier version of ubuntu should have everything you need on it to fix grub.

Good luck.

catlett
October 2nd, 2006, 06:59 AM
Hey Jerry and C57. Glad you check in on the thread. I moved this weekend and it has been a long weekend. I don't have internet service until tomorrow.
I am checking in because I bought a wireless card before I moved on the outside chance I could grab a channel. Well here I am :twisted:
Anyways, glad to see you guys and if there are still issues, post an update and I'll be back on 5pm Eastern Standard Time US to see if I can help.

jerry_c
October 2nd, 2006, 07:35 AM
ok i think it is my partition table that may be messed up
i ran parted and i tried print and it says cant have overlapping partitions

is there any solution to this
or do i have to kill my partitions and restart?

Dear Heri0n,

As you can see by Catlett's recent post, he's out for another day moving. So, I'll do the best I can to help you in the meantime, and maybe between me, c57, and some of the others here, we can get you going.

I'd say you have a problem that's beyond just a grub problem. If you overlaped your partition boundaries, grub isn't the only problem you'll have. I don't know any other way to fix that problem than to repartition.

I had an expert partition mine the first time I installed linux, many years ago, and I still use his system. It's posted at http://ubuntuforums.org/showpost.php?p=1458107&postcount=16, (http://ubuntuforums.org/showpost.php?p=1458107&postcount=16)along with the reasons why.

I hope this helps. Good luck.

VCSkier
October 5th, 2006, 06:12 AM
thanks! this saved my butt. i thought i was going to have to reinstall ubuntu...

heffo_j
October 5th, 2006, 12:38 PM
G'day all,

This is a very informative thread. Thank you Catlett et. al. for your significant input.

Can I pose another problem? I want to delete my windows xp partition and replace it with FAT32 (so my vmware xp can use it). What is the safest way to do this without wrecking everything?

Best regards
John

petri
October 5th, 2006, 12:42 PM
This should have got another thread, heffo_j

Why not just reformat it with Gparted? If you don't have it install with Synaptic. After installation paste this in terminal
sudo update-grub to get an updated grub menu. Yours XP will be gone and doesn't have an entry in grub.

cactaur
October 14th, 2006, 10:03 PM
Ok, emergency here. I tried this method, and when I try to boot, my hard drive makes a funny noise and I get a GRUB read error. Now, I'm dependent on the live CD. My Ubuntu is in hda(0,1). If it makes a difference, I originally put Warty (EDIT: Sorry, I meant Breezy) then did a dist-upgrade to Dapper. If I can get a quick reply, that would be very very helpful. Before I did this, my GRUB worked great.

petri
October 14th, 2006, 10:35 PM
This isn't a quick reply and you are not going to like it. you shouldn't have upgraded and skipping Breezy. From Warty to Breezy and from Breezy to Dapper. These upgrades can be quite a mess. Is't too late now but I'm afraid your OS is gone. You could try to boot to recovery mode and type
apt-get update and enter then
apt-get dist-upgrade and enter. Try to boot to older kernel also.

What is the Grub error number?

cactaur
October 14th, 2006, 10:53 PM
Oh whoops, sorry, I meant from Breezy. I got them confused for a moment right there, well, anyways, I went from Breezy to Dapper, and GRUB's been working wonders up until I reinstalled from the Dapper live CD. The problem is, GRUB doesn't show up at all. If I booted from the CD first, it hangs. If I chose to boot from the Hard Drive first, it merely says "GRUB read error".

catlett
October 15th, 2006, 02:48 AM
What was the original error that made you need to restore grub? All this method does is restore a copy of grub that is on your hard drive, it doesn't add or take away anything.
For example I have a copy of grub for my Dapper install and my Puppy linux install. If I run the commands with dapper's root, I get the menu list from my dapper install. If I run the commands with Puppy's root, I get Puppy's menu when I boot to grub.
That is why this only works if you already had grub installed.

I guess my questions are, "What was the original problem with grub?" "Did the dist-upgrade run through to the end and did it boot after running?" I ask the second one because a new version of grub may have been part of the upgrade and there is a possibility the new version wasn't installed correctly.

If you know how to mount your hard drive's partitions, mount your dapper partition and open up the boot folder. Post the menu.lst from the grub folder and then post the output of
sudo fdisk -lIf you don't know how to mount, post the fdisk result and I'll give you the commands.

cactaur
October 15th, 2006, 03:51 AM
The reason I decided to reinstall grub was because I was trying to get grub to display Fedora, and it was recommended that I reinstall (last post) (http://www.ubuntuforums.org/showthread.php?t=274298) grub so that it might update and display it. My dist-upgrade went perfectly, I did it months ago and grub worked wonderful. So, I don't think there are any problems directly related to the upgrade, but apparently, my upgraded ubuntu is incompatable with the one I downloaded on the Live CD.

Here's my fdisk -l


Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 4864 39070048+ 7 HPFS/NTFS
/dev/hda2 4865 11523 53488417+ 83 Linux
/dev/hda3 14218 14593 3020220 5 Extended
/dev/hda4 11524 14217 21639555 83 Linux
/dev/hda5 14406 14593 1510078+ 82 Linux swap / Solaris
/dev/hda6 14218 14405 1510047 82 Linux swap / Solaris

Partition table entries are not in disk order


Hmmmm......I think we discovered something, very surprisingly enough, the menu.lst is gone! I see the plot thickens, maybe I should try putting a copy of my menu.lst back in the grub folder. I'll let you know how this turns out.

EDIT: Wait, can you post how I can change my file system from my live CD?

catlett
October 15th, 2006, 04:00 AM
All you have to do is mount the partition. First create a mount point.

sudo mkdir /media/ubuntu
Then mount your partition to it.

sudo mount /dev/hda2 -t ext3 /media/ubuntu
It is possible that ubuntu is in hda4 but I would think that is fedora. Now you will find the partition in the media folder.
To open the menu,lst just remember that it is in /media/ubuntu

sudo gedit /media/ubuntu/boot/grub/menu.lst
You may have to use the menu from fedora. Just to be safe, mount the hda4 partition as well. We'll assume it is fedora

sudo mkdir /media/fedora

sudo mount /dev/hda4 -t ext3 /media/fedora

cactaur
October 15th, 2006, 05:54 AM
Wow, it worked. It turned out that when I reinstalled, my menu.lst just "vanished". Well, it works now. And I can't thank you enough.

gairik
October 19th, 2006, 04:53 AM
Hey....
I badly need help with this
I followed the steps and got this

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,5)/boot/grub/stage2 /boot/grub/menu.lst"... failed

Error 12: Invalid device requested


What does that mean? What should i try now?
i tried setup (hd0,5) .......... same error

catlett
October 19th, 2006, 10:52 PM
I do not know if you are still hunting for an answer since you posted 17hours ago. I am in Boston, MA USA. I am only around a few hours a night after work (6 to 10pm eastern standard time US) 17 hours ago was 11pm and I was in bed. It is 6pm now and I just got online so sorry I couldn't reply sooner.
Anywasy, it appears to be an issue with your mbr. Was grub working on this hard drive before?
The first thing I would do to just get a booting system is install grub to a floppy. If you have a floppy drive, use setup fd0 so your commands would be

sudo grub
grub> root (hd0,5)
grub> setup (fd0)
This way you can boot from the floppy. Do you know why there are 15 sectors embedded? Is there anything out of the ordinary on your mbr? If grub was working before it should install again and work.
The long and short of it seems to be the embedded sectors of your mbr. It appears grub cannot write enough info to the mbr because of those sectors. At lest that would be my guess. Try installing to a floppy, if you have one, and see if it boots.
You may also want to try the Super Grub Disk http://adrian15.raulete.net/grub/tiki-index.php

jimchristopher
November 9th, 2006, 12:40 AM
Thanks! This saved my install on an external USB drive. I have reinstalled twice now because of this problem, both times reformatting and setting up everything again from scratch. Does this seem like a somewhat common problem with 6.10 or are there many people with 6.06 having this problem too?? Anyway, thanks again!!!

djbentrem
November 20th, 2006, 08:05 AM
Thanks catlett...big help :-)

fsanders
December 3rd, 2006, 01:01 AM
Awesome explanation catlett! It worked perfectly for me! I'm a Systems/Network Admin who is a diehard Linux guy, but I have to evaluate Windows Vista for work (I support Linux, Solaris, and Windows). Well, I didn't want to mess up my nicely tweaked Ubuntu Edgy 6.10 install which I use all day long, so I installed Vista (replacing the previous Windows XP Partition) and then followed your instructions to get my Grub back! Perfect!

Thanks Again!
Fred :KS :)

WishMaster
December 6th, 2006, 10:18 PM
I was installing TortoiseSVN and it needed to reboot to complete the installation.
That's when I got "grub error 17".

Thanx to the Live CD and this How-to, my grub was fixed.
Thank you thank you thank you !!!

catlett
December 8th, 2006, 01:27 AM
I just got my internet copnnection up and running after a week + :confused: I am always concerned someone will be asking for help and I cannot reply. Anyways after a frustrating week it is great to see people wer helped and took the time to post a thank you reply.
To everyone, your welcome. It is great to be able to help and thank you for taking the time to post a thank you to me. It means alot.
I'll stop rambling but I'll leave with the now famous saying "Don't pay me back, pay it forward." http://www.payitforwardfoundation.org/home.html

randiroo76073
December 8th, 2006, 02:01 PM
May Santa be very kind to you Christmas! Your tutorial saved me alot of hassle. I'm still a newbie to linux & a bad kernel update thru update mngr had me borked, not too detailed but I've got 18 partitions, home & root for 7 distros, swap, windows 98se. Using your tutorial I was able to get to menu.lst and replace with backup copy :D
Thanks for your dedicated work!
Randy

WishMaster
December 9th, 2006, 12:17 PM
hmm... seems like it don't work out 100%

I got my grub menu back, and booting WinXP does work fine.
But when I tried to boot into Ubuntu today, I got this error:

root (hd0,6)
Filesystem type unknown, partition type 0x82
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/hda7 ro quiet splash
Error 17: Cannot mount selected partition
Press any key to continue...With the Live CD, I did this:

sudo grub
grub> find /boot/grub/stage1
(hd0,5)
grub> root (hd0,5)
grub> setup (hd0)


That worked all fine, and booting into Windows works fine.
But booting into Ubuntu gives the above error...

catlett
December 9th, 2006, 12:30 PM
I only have a minute so I won't be able to respond after I post but I hope I can be clear.

You setup the 0,5 partition as root but ubuntu is listed as 0,6. One of them is wrong. I would bet on 0,6


root (hd0,6)
Filesystem type unknown, partition type 0x82
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/hda7 ro quiet splash
Error 17: Cannot mount selected partition
Press any key to continue...

sudo grub
grub> find /boot/grub/stage1
(hd0,5)
grub> root (hd0,5)
grub> setup (hd0)

Next time you boot press
e At the grub menu with ubuntu highlighted as the selection. This will allow you to edit the ubuntu menu selection. Change the (hd0,6) to (hd0,5)
You edit by moving the cursor with the arrow keys and then backspace to erase and hitting e (of course) then press
bTo boot.
I am off to work, good luck.

WishMaster
December 9th, 2006, 01:39 PM
Okay, I changed it to hd0,5
and got this:

BusyBox v1.1.3 (Debian 1:1.1.3-2ubuntu3) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
/bins/sh: can't access tty; job control turned off
(initramfs)_](*,) :p

*edit* on another forum they told me to change grub to hd(0,5) and root=/dev/hda6
and that worked :)
Very bizarre since hda6 is my swap.... Ubuntu is on hda7
Anyway, I changed my /boot/grub/menu.lst to hd(0,5) and dev/hda6
Hopefully it works...

HeSh
December 13th, 2006, 10:12 PM
I'm having quite a problem.

Fist i installed ubuntu from live cd and it appeared that no grub was installed (i left default option to install grub on hd0 after the installation). Then i followed instructions written here. Grub found stage1 on my hd2,2, so i installed it as:
root (hd2,2)
setup (hd2)

And as such grub was installed but it reported "error 17".
My hdd is SATA and ubuntu partition is sda3. I had 2 more IDE hard disks installed (hdc and hde) and cdrom on hdb.

Then i removed the 2 disks and reinstalled ubuntu. Again no grub was installed so again i ran grub command from live cd and now it found stage1 on hd0,2. Ubuntu partition is sda3 and grub is still reporting error 17.

Any ideas what's going on? Where should i install grub?

catlett
December 14th, 2006, 03:33 AM
as you can see from somew of the posts, grub has issues with sata. But you can try some troubleshooting.
There arte a few things you want to check. You want to know how linux sees your drives. You want to know how grub sees your drives, through the device map. And then you want to see how grub's menu lists your drives.
First you need to boot to the live cd. Then mopuint your ubuntu partition. Entert this to mount ubuntu from the live c


ACTUALLY try this real quick with just the ubuntu drive installed

sudo grub

root (hd0,2)

setup (hd0)

That should work but if not lets go back to trouble shooting.

Boot to live cd

sudo mkdir /media/ubuntu

sudo mount /dev/sda3 -t ext3 /media/ubuntu

It is easiesty if you launch the file manager as root. This way you can just open the grub files by double clicking on them
Launch as root

gksudo nautilus

Now go to the media folder. Then go into the ubuntu folder and open the boot folder. That is where you will find the grub folder. Error 17 is usually grub booting to the wrong partitionm. So you need to check the grub menu to the file that tells grub about your drives. Anyways open up the device map file and then open up the menu.lst file.
The last file is your system "view" Open a terminal and enter
sudo fdisk -l (That's a lower case l)

All you want to do is see if your ubuntu drive and partition are listed the same in all. If not, that could be your issue.

IU would try just the ubuntu drive and sewtup (hd0,2) root (hd0)

You coul keep you original setup but use hd0 instead of hd2
root (hd2,2)
setup (hd0)

I won't be on again until tomorrow night. Try the setup hd0 and if nothing, post the three files and hopefully we'll find something

charlie.
January 4th, 2007, 08:34 AM
I'm also getting "Error 15: File not found" from the "find" command. I mounted the root, proc and dev mounts as instructed and used the chroot environment. I used sudo where instructed.

Symmetry
January 4th, 2007, 02:17 PM
Hello,like everyone else posting here I'm having trouble with GRUB. My box origionally ran Windows XP on an IDE drive, but I decided to install Ubuntu on a new serial drive I purchased. I was dual booting happily for a while, but then I tried to get a windows program to recognize my ext3 space at bootup as a valid drive and things broke. Whenever I tried to boot up the system it would say I was starting GRUB stage 1.5, but then give me error 17.

My system has an Asus K8N-E motherboard, and I had it setup with the windows drive as the boot drive. The motherboard still sees both my main drives fine, and experimentally yanking drives physically shows that yanking my PATA drive results in no GRUB at all, and yanking my SATA drive changes the error code to 21.

I've tried the techniques I found in this thread, but its still not working. When I ask GRUB to find stage1 it doesn't work even if I've already mounted my SATA drive, merely telling me "Error 15: File not found". When I try to setup manually it seems to like the root command fine, but when I run setup it gives me "Error 17: Cannot Mount Selected Partition" which I'm guessing might be what GRUB stage 1.5 was failing on as well.

The Gnome partition editor is correctly recognizing all three drives (I have a small extra NTFS PATA drive too) and the partitions on them. As I said I've managed to mount my SATA drive just fine. Interestingly when I run fdisk this is what I get for my SATA drive:



Disk /dev/sda: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 36104 290005348+ 7 HPFS/NTFS
/dev/sda2 36105 36481 3028252+ 5 Extended
/dev/sda5 36105 36481 3028221 82 Linux swap / Solaris

So it seems to think that my linux partition, which GParted correctly recognizes as an ext3 partition, is NTFS for some reason and I guess that could explain the failures in the boot loader. For completeness, here are some entries from menu.lst in the Grub directory



title Ubuntu, kernel 2.6.17-10-generic
root (hd2,0)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sda1 ro quiet splash
initrd /boot/initrd.img-2.6.17-10-generic
quiet
savedefault
boot

# on /dev/hda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

I also noticed that in my grub directory there was a menu.lst~ I compared the two versions, and the new one had this inserted into it near the top between the two examples:


Disk /dev/sda: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 36104 290005348+ 7 HPFS/NTFS
/dev/sda2 36105 36481 3028252+ 5 Extended
/dev/sda5 36105 36481 3028221 82 Linux swap / Solaris

I think I'll try reverting back to the old menu.lst and see if that helps any. Right now I'm happy to have my Ubuntu live CD, a Windows2000 OEM cd which came with my old box, a Windows XP upgrade CD which I used to port my HD over to my new machine through a reinstall, and a bit more swap space than data if it should prove neccesary to copy stuff over from one place to another.

Symmetry
January 5th, 2007, 06:29 PM
I decided to reinstall Ubuntu on a new partition. Teh installer put GRUB on the new partition, so I'm booting fine into it and into Windows. My thoughts that this was due to ext3fsd are pretty much confirmed because due to some accident of fate they've made changes in their latest release to prevent this from happening to people link (http://ext2fsd.sourceforge.net/projects/projects.htm)...

I still can't boot into the old partition, but its no longer a GRUB problem it seems.

chandrakant_silver
January 5th, 2007, 08:16 PM
This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see "sudo" that will mean to you that the following command should be entered at a root terminal.)

Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.

When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)


sudo grub

This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands


find /boot/grub/stage1

This will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)


root (hd?,?)
Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr


setup (hd0)

Finally exit the grub shell

quit

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.

Now the explanation.
Sudo grub gets you the grub shell.
Find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub's files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.
So root (hd?,?) tells grub it's files are on that partition.
Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive's mbr.
Quit will exit you from the grub shell.



THIS IS AN EDIT. 5-HT MADE A GOOD POINT AND I AM JUST GOING TO COPY/PASTE IT HERE



THIS IS ANOTHER EDIT. TOSK POSTED A WAY TO MOUNT PROC AND UDEV. THIS WAS NEEDED BECAUSE GRUB WASN'T RECOGNISING THE DRIVE. I THOUGHT IT WAS A VALUABLE COMMENT AND DECIDED TO PUT IT IN THE ORIGINAL POST SO PEOPLE WILL SEE IT AT THE TOP. IT MAY BE MISSED AS JUST A REPLY POST DOWN THE PAGE.
ALL KNOWLEDGE IS WELCOME!





**This set of instruction is a combination of 2 guides I saw before. One was a Mepis grub how to but I never found it again. The other is the grub manual. It's section explained the find, root, setup process but never mentioned it could be done from a live session.

This is the grub link http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-natively.html#Installing-GRUB-natively

Post script;
Just to post as much information as possible, this is an older how to for resoring grub to the mbr. The original post is directions for using the install cd and then there are replies that mention the method I posted here, as well as the chroot method mlind mentioned. If this method fails, you may want to try this http://ubuntuforums.org/showthread.php?t=24113
I tried the above steps through Live Cd, but all in vain.
Since I have /boot as a separate partition and thus it was not working.
Therefore I did this... (the only step missing above is the auto-mounting of other fstab listed partitions)


sudo mkdir /mnt/root


sudo mount /dev/xxx? /mnt/root


sudo chroot /mnt/root


sudo mount -a ##this will auto-mount other fstab listed partitions



sudo grub


grub> find /boot/grub/stage1

grub> root (hd?,?)
Replace above "?" by the values returned from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)


grub> setup (hd?)
Again, use the value returned from the find command i.e. if find returned (hd0,1) then you would enter setup (hd0)


grub> quit

This worked for me!!!!

chandrakant_silver
January 5th, 2007, 08:24 PM
This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see "sudo" that will mean to you that the following command should be entered at a root terminal.)

Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.

When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)


sudo grub

This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands


find /boot/grub/stage1

This will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)


root (hd?,?)
Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr


setup (hd0)

Finally exit the grub shell

quit

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.

Now the explanation.
Sudo grub gets you the grub shell.
Find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub's files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.
So root (hd?,?) tells grub it's files are on that partition.
Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive's mbr.
Quit will exit you from the grub shell.



THIS IS AN EDIT. 5-HT MADE A GOOD POINT AND I AM JUST GOING TO COPY/PASTE IT HERE



THIS IS ANOTHER EDIT. TOSK POSTED A WAY TO MOUNT PROC AND UDEV. THIS WAS NEEDED BECAUSE GRUB WASN'T RECOGNISING THE DRIVE. I THOUGHT IT WAS A VALUABLE COMMENT AND DECIDED TO PUT IT IN THE ORIGINAL POST SO PEOPLE WILL SEE IT AT THE TOP. IT MAY BE MISSED AS JUST A REPLY POST DOWN THE PAGE.
ALL KNOWLEDGE IS WELCOME!





**This set of instruction is a combination of 2 guides I saw before. One was a Mepis grub how to but I never found it again. The other is the grub manual. It's section explained the find, root, setup process but never mentioned it could be done from a live session.

This is the grub link http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-natively.html#Installing-GRUB-natively

Post script;
Just to post as much information as possible, this is an older how to for resoring grub to the mbr. The original post is directions for using the install cd and then there are replies that mention the method I posted here, as well as the chroot method mlind mentioned. If this method fails, you may want to try this http://ubuntuforums.org/showthread.php?t=24113

I tried the above steps through Live Cd, but all in vain.
Since I have /boot as a separate partition and thus it was not working.
Therefore I did this... (the only step missing above is the auto-mounting of other fstab listed partitions)


sudo mkdir /mnt/root


sudo mount /dev/xxx? /mnt/root


sudo chroot /mnt/root


sudo mount -a ##this will auto-mount other fstab listed partitions

sudo grub


grub> find /boot/grub/stage1

grub> root (hd?,?)
Replace above "?" by the values returned from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)


grub> setup (hd?)
Again, use the value returned from the find command i.e. if find returned (hd0,1) then you would enter setup (hd0)


grub> quit

This worked for me!!!!

Firedog
January 6th, 2007, 09:44 PM
ok.. i hope u guys can help me out...

i have had alot of problems.. and i am ALL new to linux.. just installed ubuntu..

the first problems where alot of windows / Linux boot problems.. as my windows all crashed..

so i painfully came thru all this.. so i started a fresh.

I have 1 disk, so i decided to install Linux first and decide how it should install it.. and it took it all as i wanted, except that it used the whole drive, so i resized it before it installed linux down to 5 gb.... and the swap partion where there still..

then after that i installed Windows ont he other drive.. now everything if perfect except i had now Grub loader, so i couldnt load linux.. so i used ur guide here, and now then there is only linux..

how can i get em both into Grub loader??? :)

fpois
January 7th, 2007, 12:03 PM
ok.. i hope u guys can help me out...

i have had alot of problems.. and i am ALL new to linux.. just installed ubuntu..

the first problems where alot of windows / Linux boot problems.. as my windows all crashed..

so i painfully came thru all this.. so i started a fresh.

I have 1 disk, so i decided to install Linux first and decide how it should install it.. and it took it all as i wanted, except that it used the whole drive, so i resized it before it installed linux down to 5 gb.... and the swap partion where there still..

then after that i installed Windows ont he other drive.. now everything if perfect except i had now Grub loader, so i couldnt load linux.. so i used ur guide here, and now then there is only linux..

how can i get em both into Grub loader??? :)
to have grub multi-boot, you need to have the other OS installed *BEFORE* grub is installed, so you should've installed Linux last... Especially when you're dealing with Windows, which will just over-write your MBR without mentioning it. if you've never done grub install before and i assume you want a rather painless way to do this, reinstall Linux again.

juwaidah1990
January 7th, 2007, 03:28 PM
Hello,

I have Windows on my internal hdd and I have Linux on the external one so I have

/dev/hda Windows XP's bootloader
/dev/hda1 Windows XP's partition (NTFS)
/dev/hda2 The data partition on the internal hdd (FAT32)

/dev/sda Where I want GRUB to be
/dev/sda1 The Linux partition (ext3)
/dev/sda2 The data partition on the external hdd (FAT32)

I had GRUB installed with when I installed ubutnu but when I try to boot I Linux I get Error 17: Unable to mount the selected partition and when I try to boot Windows I get Error 19: Unknown executable format or something like this... I want things this way so that my parents can still work on Windows when I remove my hdd and when I connect it I can boot from Linux and I can boot from Windows without the need to remove my hdd, here's my menu.lst without the comments:

title Ubuntu, kernel 2.6.17-10-generic
root (hd1,0)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sda1 ro quiet splash
initrd /boot/initrd.img-2.6.17-10-generic
quiet
savedefault
boot

title Ubuntu, kernel 2.6.17-10-generic (recovery mode)
root (hd1,0)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sda1 ro single
initrd /boot/initrd.img-2.6.17-10-generic
boot

title Ubuntu, memtest86+
root (hd1,0)
kernel /boot/memtest86+.bin
quiet
boot


title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Microsoft Windows XP Home Edition
root (hd0,0)
savedefault
chainloader +1

And here is my device.map:

(hd0) /dev/hda
(hd1) /dev/sda

Anyone?

mrquick
January 18th, 2007, 12:47 AM
great post, saved me hours of digging through old debian netinst cds' thanks

Choad
January 23rd, 2007, 02:47 AM
just want to say thanks for this how to. im rather drunk yet still managed to get my ubuntu system back after a windows install with no pain due to this guide. thanks!

hannav85
February 6th, 2007, 02:18 PM
Hi,

I've managed to get grub working again, so that it shows ubuntu but not windows. I can probably sort that out myself apart from the biggest problem im having at the moment... when i go into ubuntu, I type my username and password into the login screen and it shows the nvidia logo and then goes straight back to the login screen! :confused: so now i cant get into windows or linux!!

any help would be very much appreciated :)

Hanna

hannav85
February 6th, 2007, 03:33 PM
Edit: I found the solution to the problem below! I changed grub to (hd0,3)! and now all works perfectly!

Hi,

I worked out why i was getting returned to the login screen; i had no hard disk space left so deleted some using the live cd.

But having said i would prob be able to work out how to add windows to grub, i cant!

Basically my fdisk -l looks like:

Disk /dev/sdc: 164.6 GB, 164696555520 bytes
255 heads, 63 sectors/track, 20023 cylinders
Units = cylinders of 16065 * 512 = 8225280

Device Boot Start End Block Id System
/dev/sdc1 1 20023 160834716 c W95 FAT32 (LBA)


Also according to gparted, my windows partition is under /dev/sda4
(nb swap is sda1, linux OS is sda2, my files are under sda3)

I installed windows after ubuntu (because after 9 months of using linux i needed windows for one programme :( ) and so its at the end of the hard drive.

My grub file has: title Microsoft Windows
root (hd0,0)
savedefault
makeactive
chainloader +1

so i'm guessing the problem is knowing what to have instead of (hd0,0)


Again, any help would be very much appreciated

confused57
February 6th, 2007, 03:40 PM
Hi,

I worked out why i was getting returned to the login screen; i had no hard disk space left so deleted some using the live cd.

But having said i would prob be able to work out how to add windows to grub, i cant!

Basically my fdisk -l looks like:

Disk /dev/sdc: 164.6 GB, 164696555520 bytes
255 heads, 63 sectors/track, 20023 cylinders
Units = cylinders of 16065 * 512 = 8225280

Device Boot Start End Block Id System
/dev/sdc1 1 20023 160834716 c W95 FAT32 (LBA)


Also according to gparted, my windows partition is under /dev/sda4
(nb swap is sda1, linux OS is sda2, my files are under sda3)

I installed windows after ubuntu (because after 9 months of using linux i needed windows for one programme :( ) and so its at the end of the hard drive.

My grub file has: title Microsoft Windows
root (hd0,0)
savedefault
makeactive
chainloader +1

so i'm guessing the problem is knowing what to have instead of (hd0,0)


Again, any help would be very much appreciated

You may have difficulty booting Windows from grub, since it's located on a partition after Linux...what you can do is at the grub menu at bootup, scroll(arrow down) to your Windows entry, press "e" for edit, then change the root from (hd0,0) to root (hd0,3), then I think it's "b" to boot. If it boots, this is only temporary, you'd need to make it permanent in your menu.lst.

lukanium
February 7th, 2007, 12:11 AM
I have 2 HDD
HDD-0 : Windows
HDD-1 : Ubuntu feisty
Grub is installed on the 1st HDD.
Then HDD-0 crashed :( ... so I have to install grub on the 2nd HDD. I've tried all that thing but no use. It said that it can't find stage1.
I push apt-get remove grub. Then apt-get install --reinstall grub.
Then repeat the steps above and thanks God it works fine.
Thnks all !

NorgeNerd
February 23rd, 2007, 07:03 AM
This looks like the answer to my slightly different issue: My dual-boot install bombed because Grub defaulted to the MBR, preventing Windows from booting. If I let Windows take back the MBR, I can reinstall Grub elsewhere, using this procedure, right? And this will leave my current Edgy installation intact and allow me to dual-boot, as originally planned, correct?

confused57
February 23rd, 2007, 06:21 PM
This looks like the answer to my slightly different issue: My dual-boot install bombed because Grub defaulted to the MBR, preventing Windows from booting. If I let Windows take back the MBR, I can reinstall Grub elsewhere, using this procedure, right? And this will leave my current Edgy installation intact and allow me to dual-boot, as originally planned, correct?

If Edgy is on a separate hard drive, you should be able to repair your Windows mbr & install grub to Edgy's mbr(using this guide with the live cd)...if you only have one hard drive, it would be more difficult...you'd need to search the forum for methods to boot Linux from Windows mbr.
Let me know if you have 2 hard drives & I'll try to help you get it set up.


You might want to burn a copy of the Super Grub Disk:
http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html

NorgeNerd
February 24th, 2007, 06:56 AM
Ooh. Not good news. With 300 GB, I'm set with one hard drive for a while. I'll tell you, though--I followed the standard Ubuntu dual-boot install intructions pretty closely (don't believe I overlooked anything). Didn't see a word about keeping Grub out of the MBR. I only found that tidbit after Windows bombed, and I was doing a post-mortem. I really wish the std. install instructions were clear on this.

Oh well--back to the search.

Thanks much for your offer of help.

confused57
February 24th, 2007, 07:34 AM
Ooh. Not good news. With 300 GB, I'm set with one hard drive for a while. I'll tell you, though--I followed the standard Ubuntu dual-boot install intructions pretty closely (don't believe I overlooked anything). Didn't see a word about keeping Grub out of the MBR. I only found that tidbit after Windows bombed, and I was doing a post-mortem. I really wish the std. install instructions were clear on this.

Oh well--back to the search.

Thanks much for your offer of help.

What kind of errors are you getting when trying to boot Windows, if there is a Windows entry in grub?
You still might want to burn a copy of the Super Grub Disk(approx 500 kb download), you can do this in Ubuntu with no problems. The SGD can boot Windows or Linux, restore mbr, etc.
The more you can tell us about your Windows booting problem, the better chance someone may be able to, hopefully, help you.

JohnPhys
February 25th, 2007, 05:35 PM
Hey all,

I tried using the method in the first post (grub, root, setup, quit), from the edgy live cd to restore grub (was on a dapper install) and no matter how many times I tried it, it would't work. Specifically,


sudo grub

then (at grub prompt)


root (hd0,0)


setup (hd0)


quit

My dapper install was located on the first partition of the first drive (which is hdc, actually, hda is cd rom).

To resolve the problem, I had to use a grub boot cd, manually boot the partition, and once I was in ubuntu, do a grub-install.

Is there a reason for the inititial failure?

Is there a quicker fix?

NorgeNerd
February 25th, 2007, 05:52 PM
Windows shows up as an option in the Grub boot menu. When I select Windows, the Win logo splash screen comes right up, but is followed by a blue screen stating that Windows encountered errors and and cannot boot. Then there's the usual offer of a full memory dump. Could this be due to something other than Grub taking up residence in the MBR?

Azakus
February 25th, 2007, 08:56 PM
No, that sounds more like you either didn't do a chain-loader, or your NTFS partition is corrupt.

confused57
February 25th, 2007, 09:07 PM
Windows shows up as an option in the Grub boot menu. When I select Windows, the Win logo splash screen comes right up, but is followed by a blue screen stating that Windows encountered errors and and cannot boot. Then there's the usual offer of a full memory dump. Could this be due to something other than Grub taking up residence in the MBR?

Grub on the mbr "shouldn't" affect booting Windows, unless there's a setting in bios that might prevent Windows booting properly without Windows bootloader in the mbr.

You could try booting up the Windows install cd(not a recovery cd), enter "R" for recovery, then issue the command fixboot, which should restore the ntldr boot sector in Windows. The command fixmbr restores Windows mbr, which you can try as a last resort

Here's another way:
http://www.ubuntuforums.org/showpost.php?p=2203511&postcount=4

If you happen to try "fixmbr" & it still doesn't boot Windows, you can reinstall grub to the mbr with the live cd, as described in this thread.

I haven't actually had to restore Windows mbr or bootsector, but the instructions I've given "may" give you some ideas to try.

akirksey
March 11th, 2007, 05:08 AM
i had a intresting problem come up as a result from this tutorial. I hope you can offer some sorta answer or sudgestion for its resolution. I split my partition in half to install windows xp and then followed your instructions to restore the grub. Done and done. I log in though, and all of the display fonts are gone. All my windows my calender have been replaced with little squares or something, rectangles. I'm going to monkey a bit with the system preferences and try changing the fonts to see if that fixes it. Oddly enough i still have working fonts in open office.

Beruka
March 11th, 2007, 01:58 PM
I found these instructions useless....thanks for trying though

sudo grub from the live cd will result in an error

daz23
March 14th, 2007, 08:47 PM
Thank you for the guide.

I bought this computer 5 months ago for a Dual Boot Winxp/Ubuntu. Yesterday was the first time I was able to do get it working. I spent the last 3 days researching every link I could think of and I finally was able to understand the problem and the solution.

I'll post the steps I did to get my system up and running. I hope this will help somebody.



Issue: I could not get grub to boot into Ubuntu nor WinXP with my 3 SATA and 1 IDE hard drives. Errors received were Error 22 - No such partition for Linux and No ntloader found for WinXP.

Reason for failure: Ubuntu installation installs and points grub to the wrong HD MBR when using multiple SATA hard drives or combination SATA/IDE hard drives. When Grub loads it's boot menu, it sees the hard drives order a certain way (example hd0, hd1, hd2), but when you have booted into a live cd the hard drives order is different than the way Grub sees it(example hd2, hd1, hd0). (This is a known bug https://launchpad.net/ubuntu/+source/grub/+bug/8497 )

Solution: Configure grub to point to correct hard drive MBR.

1. Check your Bios for the order of your Hard Drives (In my BIOS the order is SATA1 (Contains Winxp/Ubuntu partitions), SATA2 (NTFS), SATA3 (NTFS), and IDE1 (NTFS))

2. Boot from the live CD.

3. Type sudo fdisk -l in a terminal window.
#As you can see, on my system, Winxp is installed on "/dev/sdb1" meaning 2nd hard drive partition 1, and ubuntu is installed on "/dev/sdb2" meaning 2nd hard drive partition 2.
Notice how Ubuntu sees the hard drives order different than the BIOS sees it. My Bios sees it as sdb, sda, sdc, hda while ubuntu live CD sees it as sda, sdb, sdc, hda. Not only that, but grub sees it differently too. On my system it sees it as hda, sdb, sda, sdc. This is the cause of this whole mess.




Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 38913 312568641 7 HPFS/NTFS

Disk /dev/sdb: 74.3 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 3648 29302528+ 7 HPFS/NTFS
/dev/sdb2 3649 8816 41511960 83 Linux
/dev/sdb3 8817 9039 1791247+ 5 Extended
/dev/sdb5 8817 9039 1791216 82 Linux swap / Solaris

Disk /dev/sdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 38913 312568641 7 HPFS/NTFS

Disk /dev/hda: 251.0 GB, 251000193024 bytes
16 heads, 63 sectors/track, 486344 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 486341 245115832+ 7 HPFS/NTFS


4. Type sudo mkdir /mnt/root
#We need to mount the linux partition.
5. sudo mount -t ext3 /dev/sdb2 /mnt/root
#My linux patrition is sdb2. See step 3 to find your linux partition.
6. sudo mount -t proc none /mnt/root/proc
7. sudo mount -o bind /dev /mnt/root/dev
#Step 7 errored out for me. I ignored it.

8. Type sudo grub
9. Type find /boot/grub/stage1
10.(hd2,1)
#On my computer this is the location I am interested in. Your location is different
11.Type root (hd?,?)
#Use the result you got in step 10
12.Type setup (hd2)
#Use the result you got in step 10
13.Type quit

14.Type sudo gedit /mnt/root/boot/grub/device.map
#Now we need to check the logs that grub created.

15.This is my device.map. What the? (hd0) is the drive that Linux uses to boot. Why has /dev/hda my IDE drive been assigned to (hd0)? This is wrong needs to be corrected.

Not Working:


(hd0) /dev/hda
(hd1) /dev/sda
(hd2) /dev/sdb
(hd3) /dev/sdc


16. Lets back up the file first. Type sudo cp /mnt/root/boot/grub/device.map /mnt/root/boot/grub/device.map.bakup

17. Modify the /mnt/root/boot/grub/device.map to look similar to mine where the correct drive is listed by (hd0). Save the file.

Working:


(hd0) /dev/sdb
(hd1) /dev/sda
(hd2) /dev/hda
(hd3) /dev/sdc


18. Type sudo /mnt/root/boot/grub/menu.lst
#This is my menu.lst file. What the? Look at the root (hd2,1). Compare this with the device.map "(hd2) /dev/hda" It's pointing to the wrong drive, it needs to point to my linux drive which is "(hd0) /dev/sbd"

Not Working:


# groot=(hd2,1)


title Ubuntu, kernel 2.6.17-10-generic
root (hd2,1)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sdb2 ro quiet splash
initrd /boot/initrd.img-2.6.17-10-generic
quiet
savedefault
boot

title Ubuntu, kernel 2.6.17-10-generic (recovery mode)
root (hd2,1)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sdb2 ro single
initrd /boot/initrd.img-2.6.17-10-generic
boot

title Ubuntu, memtest86+
root (hd2,1)
kernel /boot/memtest86+.bin
quiet
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title Microsoft Windows XP Professional
root (hd2,0)
savedefault
makeactive
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1


19. Lets back up the file first. Type sudo cp /mnt/root/boot/grub/menu.lst /mnt/root/boot/grub/menu.lst.bakup

20. Modify the /mnt/root/boot/grub/menu.lst to look similar to mine where the correct drive is listed by root. Note the changes in the WinXp section also. Save the file.

Working:



# groot=(hd0,1)


title Ubuntu, kernel 2.6.17-10-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-10-386 root=/dev/sdb2 ro quiet splash
initrd /boot/initrd.img-2.6.17-10-386
quiet
savedefault
boot

title Ubuntu, kernel 2.6.17-10-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-10-386 root=/dev/sdb2 ro single
initrd /boot/initrd.img- 2.6.17-10-386
boot

title Ubuntu, kernel 2.6.17-10-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sdb2 ro quiet splash
initrd /boot/initrd.img-2.6.17-10-generic
quiet
savedefault
boot

title Ubuntu, kernel 2.6.17-10-generic (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sdb2 ro single
initrd /boot/initrd.img- 2.6.17-10-generic
boot

title Ubuntu, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin
quiet
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1


21. We need to install grub again because we made changes to /mnt/root/boot/grub/device.map

22. Type sudo grub-install --root-directory=/mnt/root /dev/sdb
# see link for more info and make sure you use your drive and not mine https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows#head-bf3232f10ddf1b078de064622ccbb25225cdb3c0

23. We should now have a bootable system. Reboot.

Notes: After a kernel upgrade, the menu.lst got changed again with the root pointing to the wrong hard drive. This is not an issue if # groot=(hd0,1) is set correctly in menu.lst. (Thanks confused57)

confused57
March 15th, 2007, 01:09 AM
daz23,
Impressive, thanks for sharing.

You also need to change this line in your menu.lst:

# groot=(hd2,1)
to

# groot=(hd0,1)

When a kernel is updated, update-grub looks at this line to assign the root partition to the kernel boot entries, when it automatically updates your menu.lst.

daz23
March 15th, 2007, 06:13 PM
confused57, thanks for the info. I forgot to change that line.

granny4linux
March 19th, 2007, 09:50 PM
Catlett, thank you so much for this very helpful guide. I was able to reinstall my Grub without a hitch following your "How To".

morequarky
March 23rd, 2007, 09:53 AM
I am frustrated.

I have read almost this entire thread. The howto seems so simple.

My wife has messed up my GRUB twice on two different computers.

This how-to doesn't work for me.

Here's the deal.

I boot the live CD.

I sudo grub

I run the commands.

I quit

I reboot

And I get errors. This time when I boot...It shows like three ubuntu kernals and windows. Grub boots windows FINE, but all three of the ubuntu kernels don't work.

I wonder. I use the driver to read the linux drive in windows. Could that driver have messed up my Ubuntu harddrive in a way so it won't boot?

Let me see what errors I get....and get back to you in a few minutes.

daz23
March 24th, 2007, 01:41 AM
morequarky, I would try to follow the steps here: http://users.bigpond.net.au/hermanzone/p15.htm#cli

This page helped me solve all my grub problems.

diebels
March 30th, 2007, 02:22 PM
This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

Using the feisty live-cd, my chroot had no hardisk devices in /dev,
so what i did was something like this:

sudo -s
mkdir /target
mount /dev/sda2 /target
mount --bind /dev /target/dev
mount --bind /proc /target/proc
mount --bind /sys /target/sys
chroot /target
grub-install /dev/sda

Azakus
March 30th, 2007, 03:37 PM
Using the feisty live-cd, my chroot had no hardisk devices in /dev,
so what i did was something like this:

sudo -s
mkdir /target
mount /dev/sda2 /target
mount --bind /dev /target/dev
mount --bind /proc /target/proc
mount --bind /sys /target/sys
chroot /target
grub-install /dev/sda

Yes. This is what I had to do last time.

djindepth
March 31st, 2007, 02:38 PM
I'm trying to install on a Mac Mini, and have run into the same issue with the grub. That's what I know. I have tried a number of these terminal scripts t try to reinstall grub but I continue to run into the same problem. I am using a CD I burned from the website (i386) and I have setup a linux partition (sda3 ext3) and a swap (sda4 swap). Any suggestion why I'm not able to complete install?

confused57
March 31st, 2007, 04:12 PM
I'm trying to install on a Mac Mini, and have run into the same issue with the grub. That's what I know. I have tried a number of these terminal scripts t try to reinstall grub but I continue to run into the same problem. I am using a CD I burned from the website (i386) and I have setup a linux partition (sda3 ext3) and a swap (sda4 swap). Any suggestion why I'm not able to complete install?
I don't know anything about installing on a Mac Mini, but you would probably get more replies from someone who does, by posting a new thread in the "Absolute Beginner" section. Make sure your thread title includes the words "grub install mac mini"... you should get plenty of help.

morequarky
April 2nd, 2007, 12:32 PM
thanks, great website
http://users.bigpond.net.au/hermanzone/p15.htm#cli

kubobbu
April 8th, 2007, 08:32 PM
Catlett... thanks for your response, and thanks also to those who added additional comments.

I ran the procedure outlined, closed the terminal, and exitied the live CD. Then rebooted the computer, and got Grub Error 18 again, so I guess the bios still can't find Grub to load the kernal.

I guess I'll have to reinstall, but I need someone to give me the partition information that will be needed so that the boot ends up in the right place... the first cylinders on the disk so it can be found.

Thanks!

maccawolf
April 12th, 2007, 01:29 PM
Catlett,
I want to say thank you, cos I also lost my mountpoint for Grub, and following your instructions I was able to re point to it.:KS :KS 8-) 8-)

THANK YOU!

Nightmist
April 22nd, 2007, 04:07 PM
Hello,

I am trying to help a guy installing Ubuntu on an older computer. It's got enough RAM and HD space, so it should be no problem. The computer has one HDD, a couple of CD/DVD drives (I think only one works) and Windows 98 installed. It had a lot of unpartitioned space, and I used this for the Linux installation.

Installation worked well with the Live CD, but when I rebooted I got the Grub Error 17. I have seen a lot of complicated partition set-ups here, but I am baffled that the simple setup of 1 HD and 3 partitions (hda1 = win98 fat 32, hda2 = linux ext3, hda3 = linux swap) gives me Error 17.

Grub should point to (hd0) since there is only 1 HD (or can one of the CD drives take up this position somehow?), and hopefully think Linux is on (hd 0,1). Is there a chance Grub thinks Linux is on (hd 0,0)? And would that give me Error 17?

I can't check anything right now (the PC is not mine), but I will check on it tonight. I didn't have much time to fiddle with it when I installed it, but will have some time tonight. So I hope someone can answer these questions so I know what to do when I see how Grub is set up.

Thanks.

[EDIT: The following is from another thread I started before I discovered this one]

I've done some testing to fix the Error 17. First I tried the following...

sudo grub
find /boot/grub/stage1
root (hd0,1)
setup (hd0)

...and (hd0,1) is the only option that worked. Everything was successful, and then I rebooted. But I still got Error 17.

The computer has got only one HD, with 3 partitions (hda1 windows, hda2 linux, hda3 swap), and menu.lst seems to be properly set up, as well as the setup of grub (see above). So how come Grub can't find itself when I only have one HD?

Booting a Windows CD and running "fdisk /mbr" reset the mbr so I can get into windows when I need to use the computer, but Grub is stuck with Error 17 when I install it again. Any tip to get Grub to work would be appreciated.

parkermauney
April 25th, 2007, 12:06 AM
This happens to me at least 2 times a month. I just get ubuntu setup perfect, then BOOM! A windows install screws it to pieces. This sure will be helpful. :D

ssican
April 25th, 2007, 10:27 AM
Nightmist, on Super Grub Disk Page, there is a reference about GRUB error 17: http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html#17
See all the INDEX of SUPER GRUB DISK PAGE http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html

bravemosquito
April 28th, 2007, 03:41 PM
If someone has a freetime and knowledge could take a look to my problem:
http://ubuntuforums.org/showthread.php?t=426191

Thanks

micfreedom
May 2nd, 2007, 05:48 PM
Sorry to butt in this lengthy article on GRUB.
I made a mistake in the partioning program. In GParted I clicked on "reboot from external drive".The program downloaded my booting program. But then I made the mistake in partitioning the External hard drive again!. This time, obviously, the booting program is not in the external hard drive any more. So The bootloader tried in vain to reboot.
I constantly come up0 with the error Grub stage 1.5 error 21.

I have changed the CMOS to read type = user, LBA Mode=on, P10 Mode= auto, Primary slave = Auto
yet, I still cannot by apss error 21.


I did go into Ubuntu terminal on the Live CD. When I tried find /boot/grub/stage1
it said "cannot find"
So I am with a blank screen and error 21 (I write this from my wife's computer!)

Staach
May 10th, 2007, 01:54 PM
Sigh..
I reinstalled a win-xp on the same hd as my ubuntu..So I tried to reinstall my grub. This is what I got:
grub> find /boot/grub/stage1
(hd0,5)

grub> root (hd0,5)

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,5)/boot/grub/stage2
/boot/grub/menu.lst"... failed

Error 22: No such partition

Can anyone help me on this?

n8bounds
May 10th, 2007, 02:23 PM
Once again these forums gave me exactly what I needed. Thanks guys!

TimelessRogue
May 15th, 2007, 01:43 AM
Thanks, Catlett ... simple, straight forward and, more importantly, it works ... at least on a "normal" system setup, as are both my far-from-normal self-built base station and the older generic HP laptop, after upgrading (???) from Win2k to ******* XP (strictly as a back up system and to allow access to some data/files that have not be transferred over to Ubuntu (yet ... yeah, I know: I'm a habitual, lifelong procrastinator ... which perhaps contributes to that longlife) and few esoteric programs not available in Ubuntu ... which is just fine with me.) It should work just fine on more "exotic" configurations also with, a bit of tweaking to accommodate such particular situations ...

The only difference is I used Super Grub to log onto Ubuntu and your instructions to install the grub/menu.lst to the MBR of the ******* disc. From there all was well.

Another point to emphasize is MAKE A BACKUP OF YOUR ******* MBR ... just on the off chance that things get all bolluxed up and you need to reinstall said MBR ... using the following from a terminal window: sudo dd if=/dev/hda of=/dev/hdambr bs=512 count=1.

This will give you an MBR backup from which you can restore said MBR with: sudo dd if=/tmp/hdambr of=/dev/hda bs=512 count=1 (again, in a terminal window.)

I used both on my system and everything worked out fine ...

barcaxi
May 16th, 2007, 03:27 PM
Thank you.

I tried to install Ubuntu 7.04 to a external USB disk and subsequently got the error message at boot time:-

GRUB loading stage1.5
GRUB loading, please wait...
Error 21


The commands mentioned above (and listed below) fixed my grub setup. Thanks!


$ sudo grub
grub>find /boot/grub/stage1
(hd0,0) # a old Debian version
(hd0,2) # the existing Ubuntu version I want to recover

grub>root (hd0,2)

grub>setup (hd0)

grub>quit

$ sudo reboot # Grub works again!!

dolaksiz
May 17th, 2007, 11:16 PM
Hi,

I get the following messages after I did all the things as described..

Checking..... yes
Checking.....yes
Checking.....yes

Running.... 15 sectors are embedded succeeded

but after this:

Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,5)/boot/grub/stage2 /boot/grub/menu.lst" ... failed

error 12: invalid device requested


What should I do now?

ShirishAg75
May 18th, 2007, 11:03 AM
Sorry I haven't read the whole thread but are u guys using GRUB 0.97 or the latest 1.95 . !.95 is supposed to have increased features for USB-based drives.

JRS
June 3rd, 2007, 10:26 AM
Thank you catlett
I have (had) a dual boot system with windows and ubuntu. I decided to see what gentoo was all about
and install it on the windows partition. It wiped out grub and I had no way to boot ubuntu. Because of people like
you I have always been able to find answers to what I was looking for. With that said..Thank you..thank you..
thank you so much. Your instructions worked great! One day I hope to be good enough to help people, who decide to become Linux users.

Hooked on Ubuntu

doubledave
June 4th, 2007, 11:39 PM
wow, i just wanted to post how appreciative i am!

this worked for ubuntu moron numero uno (me)-

i had wiped my kubuntu partition after having problems with ubuntu (feisty), and my boot screen was big time effed.

got grub looking back to normal, which is a huge relief.

now off to try to fix one of my other huge mistakes...

ArchangelUriel
June 5th, 2007, 09:53 AM
Good morning from Greece... Well, as most ppl who read this thread, I had a working dual-boot systmem with Ubuntu Feisty and Windows XP. Unfortunately I had to format my Windows partition and reinstall them. So there goes the GRUB... Since I do not want just to reinstall Ubuntu but only to get GRUB working I followed your instruction and here is what i got...




ubuntu@ubuntu:/$ sudo mkdir /mnt/root
ubuntu@ubuntu:/$ sudo mount -t ext3 /dev/sda5 /mnt/root
ubuntu@ubuntu:/$ sudo mount -t proc none /mnt/root/proc
ubuntu@ubuntu:/$ sudo mount -o bind /dev /mnt/root/dev
ubuntu@ubuntu:/$ sudo chroot /mnt/root /bin/bash
root@ubuntu:/# grub
Probing devices to guess BIOS drives. This may take a long time.

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> find /boot/grub/stage1
find /boot/grub/stage1
(hd0,5)
grub> root (hd0,5)
root (hd0,5)
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,5)/boot/grub/stage2 /boot/grub/menu.lst"... failed

Error 22: No such partition
grub>



Trying to see what is going wrong I tried "fdisk -l". Here is the result.



root@ubuntu:/# fdisk -l
omitting empty partition (5)

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 510 4096543+ 12 Compaq diagnostics
/dev/sda2 * 511 17219 134215042+ 7 HPFS/NTFS
/dev/sda3 17220 19457 17976735 5 Extended
/dev/sda4 19333 19457 1003968 82 Linux swap / Solaris
/dev/sda5 17220 19332 16972609+ 83 Linux

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 30401 244196001 c W95 FAT32 (LBA)
root@ubuntu:/#


I think heri0n had the same problem.... So is there any way to recover GRUB, or should I format the disk and start over?

Thank you in advance

Archangel Uriel

komsas
June 5th, 2007, 01:28 PM
I have same problem like ArchangelUriel :) help somebody please :)

Delirious
June 27th, 2007, 03:16 PM
This is the message i get when looking for a boot loader.

Probing devices to guess BIOS drives. This may take a long time.

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> find /boot/grub/stage1
find /boot/grub/stage1

Error 15: File not found
grub>

Then when i try to install it on hd0 it says that it doesn't exist. So far i have waste 3 days trying to just install this. For now i gave up on dual boot and am just focusing on booting this.

I finally found the grub file looking through the gui and it looks like its installed on the swap partition i created on my raid array which is about as far from the primary sata drive that /boot and / are installed on as it can get.

[rant] Seriously im trying to restrain myself but i cant believe ubuntu has this big of a problem doing something this simple. but i guess if having a full featured mouse menu is too hard then this shouldn't surprise me [rant]

forevereating
June 29th, 2007, 08:37 PM
I have GRUB already installed on my windows partition, but I want to reinstall windows, this would thus delete my GRUB. And using the find command shouldn't come back with anything. So my question is, how do I do a clean install of GRUB again? I want to keep my current install of Ubuntu btw. Thanks in advance.

Azakus
June 29th, 2007, 08:50 PM
I have GRUB already installed on my windows partition, but I want to reinstall windows, this would thus delete my GRUB. And using the find command shouldn't come back with anything. So my question is, how do I do a clean install of GRUB again? I want to keep my current install of Ubuntu btw. Thanks in advance.

You don't have to delete GRUB to install Windows. Just put windows in a different partition. The only thing Windows will overwrite will be your MBR, which shouldn't be confused with GRUB. GRUB is the linux bootloader located in /boot/. The MBR is the first 512 bytes of the harddrive that tells the BIOS where to look for a bootloader. Windows overwrites teh MBR when installed, but with dd, you can backup your MBR, install Windows, then replace the Windows MBR with the one you backed up. Then, you can add Windows into your GRUB list to boot Windows from GRUB.
Note: make sure to replace all instances of /dev/hdx with the /dev listing of your harddrive

Step 1: Backup GRUB's MBR

dd if=/dev/hdx of=~/MBRbackup.dd count=1 bs=512

Step 2: Install Windows

Step 3: Restore GRUB's MBR

dd if=~/MBRbackup.dd of=/dev/hdx count=1 bs=446

Step 4: Add Windows to GRUB bootlist
Run this:

sudo /usr/sbin/update-grub
It should automatically add Windows to the boot list.
Then double-check your /boot/grub/menu.lst file and make sure something like this is at the bottom
EXAMPLE!

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hdc1
title Microsoft Windows XP Home Edition
root (hd0,3) #Windows is fourth partition
savedefault
makeactive
chainloader +1

forevereating
June 29th, 2007, 09:01 PM
Thanks for the guide, but IIRC my GRUB is not installed in the MBR. I installed it onto a usb stick then using a command created a file called boot.lnx, copy and pasted boot.lnx onto usb stick then onto c:\, and then I edited the hidden windows file boot.ini and added in a line at the end so that it refers to boot.lnx to start GRUB thus booting ubuntu. So when I format my sda1 (windows partition with GRUB inside) I would lose my GRUB, and I would like to reinstall windows to the same partition. Perhaps in other words, is there a sole GRUB installer of some sort? I think thats all I need.

Azakus
June 30th, 2007, 03:25 AM
Thanks for the guide, but IIRC my GRUB is not installed in the MBR. I installed it onto a usb stick then using a command created a file called boot.lnx, copy and pasted boot.lnx onto usb stick then onto c:\, and then I edited the hidden windows file boot.ini and added in a line at the end so that it refers to boot.lnx to start GRUB thus booting ubuntu. So when I format my sda1 (windows partition with GRUB inside) I would lose my GRUB, and I would like to reinstall windows to the same partition. Perhaps in other words, is there a sole GRUB installer of some sort? I think thats all I need.

I think this guild will work better in your case. It installs the full version of grub on any harddisk you wish.
Installing GRUB using grub-install (http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-using-grub_002dinstall.html#Installing-GRUB-using-grub_002dinstall)

forevereating
June 30th, 2007, 05:17 AM
:confused: so I guess there isn't an easier way to do it? I don't really get the image and root it talks about. Would this method let me install it like I did before?

Bacardilvr
July 1st, 2007, 04:21 AM
Catlett:

Thank you SO much for this guide. I was actually able to use to compete the addition of Ubuntu to my Vista Bootloader. Without the instruction on how to install GRUB to my linux partition, it couldn't have worked. So, thanks again.

OzzMosiz
July 3rd, 2007, 03:03 PM
Ok, I've done the same as most here. Reinstalled Windows XP and voila Grub doesn't work.
I've booted into ubuntu using the CD. Find command in grub doesn't find anything and I cannot mount the /dev/hda drives (tried 0-9).

Any suggestions?

wwoollff
July 3rd, 2007, 04:41 PM
sorry to post another Grub problem but I'm really stuck . I have installed WinXp and tried to restore my grub with a LiveCd.After doing the 'find /boot/grub/stage1 , root (sdX,Y) setup (sdX,Y) ' with absolutely no error, I have restarted my pc and nothing worked.I've tried with the chroot, and the same stuff...and also by mounting the proper partition with the livecd, and checked the devices.map and menu.lst ...

btw, I'm using Ubuntu 7.04 thx.
my fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1215 9759456 7 HPFS/NTFS
/dev/sda2 1216 8254 56540767+ f W95 Ext'd (LBA)
/dev/sda5 1216 5470 34178256 b W95 FAT32
/dev/sda6 5471 8187 21824271 b W95 FAT32

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2550 20482843+ 7 HPFS/NTFS
/dev/sdb2 2551 28938 211961610 f W95 Ext'd (LBA)
/dev/sdb3 28939 30401 11751547+ 83 Linux
/dev/sdb5 2551 15298 102398278+ 7 HPFS/NTFS
/dev/sdb6 15299 28871 109025091 7 HPFS/NTFS
/dev/sdb7 28872 28938 538146 82 Linux swap / Solaris

my find /boot/grub/stage1: (hd1,2)
and my menu.lst:



# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1


title Ubuntu, kernel 2.6.20-15-386
root (hd1,2)
kernel /boot/vmlinuz-2.6.20-15-386 root=UUID=8128ee1b-2a29-4a8a-a68a-45107f35067d ro quiet splash
initrd /boot/initrd.img-2.6.20-15-386

B33R
July 3rd, 2007, 05:45 PM
Thanks for the guide, exactly what I needed!

Now I use ******* for games and Ubuntu for everything else.

a85lee
July 7th, 2007, 04:11 AM
Grub need the grub files to run the setup. The path is where grub will find them. When you do the find command, it is telling you where the file are located on the hard drive. The root (hd?,?) is how you tell grub where the files are. The setup (hd?) is grub installing itself and the patyh you enter there is telling grub where you want it instaled.
You can try running setup (hd0) to see what happens but it appears grub wasn't installed previously. If you know it, enter the path root is on even if grub isn't there. You may get lucky.

Thanks for the tips, just use the way you said without finding it, the GRUB reinstalled successfully, but there is one more problem, there is no Vista in the grub list and ubuntu is not working properly right now..:(:(:( so sad

clinto
July 8th, 2007, 04:20 AM
This is throwing me through a frickin' loop. I'm using the Ubuntu Feisty live cd to reinstall the grub after installing xp. For some reason, the live cd isn't mounting my partitions. The only way I can find them is by using the gui under places>computer. When I open it in Nautilus, it mounts the partition in media but calls it "disk."

So, I decided to try it from there and see if grub would pick it up...


grub> find /media/disk/grub/stage1

Error 15: File not found

grub>

I have my /boot on a separate partition. I can't do anything with the live cd if it doesn't even allow me to access my partitions. I tried looking under /dev and they're not listed. I peeked at /mnt and of course not.

This laptop has two sata drives. I remember changing something in the BIOS to allow windows to read the hard drives. Maybe that's my problem?

RAH66
July 12th, 2007, 12:00 PM
thanx man you saved my *** I dual boot xp for gaming and so on on a seperate drive and old faithful xp crashed and I had to reinstall and it screwed my boot loader didn't know what to do


anyway thanx ......... :)

terabyte1
July 15th, 2007, 03:58 PM
Ooh! Catlett is cool for info - i've saved that reply in case I have that kind of problem (Grub can be grumpy at times) :) !

terabyte1

odin_dax
July 22nd, 2007, 07:39 PM
I have a problem with my GRUB. I followed all the steps in the guide, but when I reboot without the live CD I get "booting Ubuntu..." as normal, followed by "> root (hd0,1)" and nothing else, no boot.
In the steps I've followed, GRUB said (hd0,0). Also, I never saw any text responses after inputting commands in this guide except for "find ...stage1"

HELP!

UPDATE: Tried setting up for (hd0,1), but it says it can't find the partition.

odin_dax
July 22nd, 2007, 08:24 PM
Here's a copy I managed to find through the live CD.

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,1)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title Ubuntu, kernel 2.6.20-16-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro quiet splash
initrd /boot/initrd.img-2.6.20-16-386
savedefault

title Ubuntu, kernel 2.6.20-16-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro single
initrd /boot/initrd.img-2.6.20-16-386

title Ubuntu, kernel 2.6.17-11-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-11-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro quiet splash
initrd /boot/initrd.img-2.6.17-11-386
savedefault

title Ubuntu, kernel 2.6.17-11-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-11-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro single
initrd /boot/initrd.img-2.6.17-11-386

title Ubuntu, kernel 2.6.15-28-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-28-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro quiet splash
initrd /boot/initrd.img-2.6.15-28-386
savedefault

title Ubuntu, kernel 2.6.15-28-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-28-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro single
initrd /boot/initrd.img-2.6.15-28-386

title Ubuntu, kernel 2.6.15-26-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-26-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro quiet splash
initrd /boot/initrd.img-2.6.15-26-386
savedefault

title Ubuntu, kernel 2.6.15-26-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-26-386 root=UUID=51e19179-96d5-404a-a6c7-abdd4d962dda ro single
initrd /boot/initrd.img-2.6.15-26-386

title Ubuntu, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin

### END DEBIAN AUTOMAGIC KERNELS LIST

confused57
July 22nd, 2007, 08:34 PM
Post the output of:

sudo fdisk -l
-l is a small "L"

If you resized the root partition, your UUID may have changed, you can enter the command "blkid" and compare it with the UUID in your kernel line:

blkid

odin_dax
July 23rd, 2007, 12:32 AM
Post the output of:

sudo fdisk -l
-l is a small "L"

If you resized the root partition, your UUID may have changed, you can enter the command "blkid" and compare it with the UUID in your kernel line:

blkid

If I run GParted off the CD, will that work? All this started after a failed dual-boot partition. Anyway, working on the fdisk.

Also, some files are locked under my (owner) ID. Is there any way to access those under a live CD for backup?

odin_dax
July 23rd, 2007, 12:35 AM
fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 12958 104077102+ 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 12959 14232 10233405 7 HPFS/NTFS
/dev/sda3 14233 14593 2899732+ 5 Extended
/dev/sda5 14233 14593 2899701 82 Linux swap / Solaris

---------------------------------
blkid

/dev/sda1: UUID="51e19179-96d5-404a-a6c7-abdd4d962dda" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda2: TYPE="ntfs"
/dev/sda5: TYPE="swap" UUID="b855e3e2-29b7-4fcc-bb65-a1279a08d5db"

confused57
July 23rd, 2007, 02:05 AM
fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 12958 104077102+ 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 12959 14232 10233405 7 HPFS/NTFS
/dev/sda3 14233 14593 2899732+ 5 Extended
/dev/sda5 14233 14593 2899701 82 Linux swap / Solaris

---------------------------------
blkid

/dev/sda1: UUID="51e19179-96d5-404a-a6c7-abdd4d962dda" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda2: TYPE="ntfs"
/dev/sda5: TYPE="swap" UUID="b855e3e2-29b7-4fcc-bb65-a1279a08d5db"

You could try highlighting your Ubuntu entry in your grub boot menu when you're booting your computer(without the live cd), press "e" to edit, highlight the line beginning with root, press "e" again, change root from (hd0,1) to (hd0,0), press "enter", then press "b" to boot...this is just a temporary change, but can be made permanent if it works.

Is the /dev/sda3 an installed Windows or just a ntfs partition?

odin_dax
July 23rd, 2007, 02:24 AM
You could try highlighting your Ubuntu entry in your grub boot menu when you're booting your computer(without the live cd), press "e" to edit, highlight the line beginning with root, press "e" again, change root from (hd0,1) to (hd0,0), press "enter", then press "b" to boot...this is just a temporary change, but can be made permanent if it works.

Is the /dev/sda3 an installed Windows or just a ntfs partition?

sda3 is a failed Windows install. The story goes, I was installing Windows XP for a dual-boot, it said it had to restart, then it locked on a blank screen after reboot, I tried rebooting manually, same result, then I got the grub errors after removing the XP CD.

After all this, I'll GPart the partition back to Ubuntu.

*********
I'll try your steps. I have to run for a party, but I'll post the results after I get back and try them.

@anybody - any methods in recovering locked personal files from a live CD?

odin_dax
July 23rd, 2007, 04:17 AM
Thank you, confused, it worked!!!!!

Once everything loaded properly, I edited the grub menu and it worked perfectly. Well, there is one screen after it says "Loading GRUB..." that says near the bottom "blah blah blah... savedefault..." that lasts about ten seconds, but the splash screen is faster, so I guess it's a trade off. I'm not too bothered, the thing works again, and I rarely turn the computer off.

Thanks again, confused!

confused57
July 23rd, 2007, 05:01 AM
Thank you, confused, it worked!!!!!

Once everything loaded properly, I edited the grub menu and it worked perfectly. Well, there is one screen after it says "Loading GRUB..." that says near the bottom "blah blah blah... savedefault..." that lasts about ten seconds, but the splash screen is faster, so I guess it's a trade off. I'm not too bothered, the thing works again, and I rarely turn the computer off.

Thanks again, confused!
Glad to help & that it worked. If you want to make the change permanent in your menu.lst:

cd /boot/grub
sudo cp menu.lst menu.lst_backup
gksudo gedit menu.lst

If you haven't already, change your root entries to (hd0,0) and be sure to change the line beginning with #groot to (hd0,0):
http://users.bigpond.net.au/hermanzone/p15.htm#groot

Then just quit & save.

lonrot
July 26th, 2007, 09:55 PM
excellent, it was quite simple.

lonrot
July 26th, 2007, 10:13 PM
Guys I need big help, I have done these steps before and they worked in the past, but now, I can't be able to see the grub at startup again, here is the terminal log.


GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> find /boot/grub/stage1
(hd0,1)

grub> root (hd0,1)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0,1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0,1)"... failed (this is not fatal)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,1)"... failed (this is not fatal)
Running "install /boot/grub/stage1 (hd0,1) /boot/grub/stage2 p /boot/grub/menu
.lst "... succeeded
Done.

grub>

I'm using also Windows XP x64 on other parition.

ccalvinfowler@aol.com
August 3rd, 2007, 11:21 PM
All you gus are a GodSend. I would never be able to get as much help from Mcrosoft as I get from you all. I am glad that I switched to using Xubuntu. Once I get my networking issues taken care of I will probably delete the Windows OS. I will have to wait until my grlfriend gets a little more practice with Xubuntu. I am really loving it and could not be any more happier with the help that I have received from everyone on these forums.

Thank You all very very much

ccalvinfowler@aol.com
August 3rd, 2007, 11:54 PM
okay now i have done what the psots say to do and my comp boots straight to Winxp with no option of loading xubuntu n ow what

confused57
August 4th, 2007, 01:53 AM
okay now i have done what the psots say to do and my comp boots straight to Winxp with no option of loading xubuntu n ow what
If you have 2 hard drives, you might try booting first to the other hard drive.

JoJo
August 4th, 2007, 03:58 AM
I wanted to install Feisty on a blank partition, so I did. I can't get GRUB to load though. It just goes straight to Windows. I tried reinstalling GRUB as per the instructions at the beginning of this topic, but to no avail. It still goes straight to Windows, even though it says that that hard drive was recognized and the installation of GRUB was successful on the correct partition, which the partition I want it on is the partition with Ubuntu on it. It may have something to do with the version of Windows I have, which is the x64 edition. I don't know and I'm stumped. Please help!

murak
August 4th, 2007, 03:24 PM
I installed XP on my pc and after that installed Ubuntu. This resulted in XP breaking, so I installed XP agin, wich made the Grub dissapare. I installed the grub again following the guide on this forum (well one of them) Grub was up again, but I got the "error 17" when trying to boot Ubuntu. No guides have helped so far, only thing left to try is the "super grub bootcd" wich I will try later. Anyway, just now I pressed "e" while marking the Ubuntu alternative in Grub, wich let me edit some lines. I changed the value "(hd0,3)" to "(hd0,2)" and pressed "b" to boot, wich worked! Ubuntu booted fine. But the value is not saved so I guese there is some textfile somewhere where I can change the value permanently.

Hope this helps someone.

hypnos
August 6th, 2007, 04:32 PM
... I changed the value "(hd0,3)" to "(hd0,2)" and pressed "b" to boot, wich worked! Ubuntu booted fine. But the value is not saved so I guese there is some textfile somewhere where I can change the value permanently.

Hope this helps someone.

Edit the menu.lst file located in /boot/grub/ folder. At the end of file you will see exactly the same entries which you've edit while booting the machine.

murak
August 10th, 2007, 11:30 PM
Thank you Hypnos!

JoJo
August 13th, 2007, 08:08 PM
I wanted to install Feisty on a blank partition, so I did. I can't get GRUB to load though. It just goes straight to Windows. I tried reinstalling GRUB as per the instructions at the beginning of this topic, but to no avail. It still goes straight to Windows, even though it says that that hard drive was recognized and the installation of GRUB was successful on the correct partition, which the partition I want it on is the partition with Ubuntu on it. It may have something to do with the version of Windows I have, which is the x64 edition. I don't know and I'm stumped. Please help!

I still need help with this problem which I posted a week ago.

confused57
August 14th, 2007, 12:46 AM
I wanted to install Feisty on a blank partition, so I did. I can't get GRUB to load though. It just goes straight to Windows. I tried reinstalling GRUB as per the instructions at the beginning of this topic, but to no avail. It still goes straight to Windows, even though it says that that hard drive was recognized and the installation of GRUB was successful on the correct partition, which the partition I want it on is the partition with Ubuntu on it. It may have something to do with the version of Windows I have, which is the x64 edition. I don't know and I'm stumped. Please help!

I still need help with this problem which I posted a week ago.
Have you tried setting the bios to boot first to the other hard drive, if it's capable of doing this?

You might want to boot the Ubuntu live cd, open a terminal(Applications---Accessories---Terminal), post the output of:

sudo fdisk -l
-l is a lowercase "L"

You can also mount your root partition from the live cd:
http://users.bigpond.net.au/hermanzone/p10.htm#Mounting_Ubuntu_with_Dapper_Desktop_LiveCD
you might want to post the boot entries in your /boot/grub/menu.lst

Have you tried using the Super Grub Disk to boot Ubuntu?:
http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html

Another thing you could do is install grub to the root partition, using the live cd, then try a GAG floppy or cd to boot Ubuntu:
http://users.bigpond.net.au/hermanzone/p12.htm

ofrexo
August 18th, 2007, 12:49 PM
I have tried various ways to fix the grub (error 21)
Could someone help me?.

My fdisk.


ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 23564 189277798+ 83 Linux
/dev/sda2 23565 24321 6080602+ 5 Extended
/dev/sda5 23565 24321 6080571 82 Linux swap / Solaris

confused57
August 18th, 2007, 08:36 PM
I have tried various ways to fix the grub (error 21)
Could someone help me?.

My fdisk.


ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 23564 189277798+ 83 Linux
/dev/sda2 23565 24321 6080602+ 5 Extended
/dev/sda5 23565 24321 6080571 82 Linux swap / Solaris

Here are some possible solutions for grub error 21:
http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html#21

You might want to try using the Super Grub Disk to boot Ubuntu:
http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html
I would try SGD to see if it confirms the error 21, if it's not able to boot your system.

Also, you probably don't need more than 2 Gb of swap...if you have 1 Gb memory, 1 Gb swap should be sufficient.

gardara
August 23rd, 2007, 09:32 PM
Great tutorial. Helped me after my grub screwed up after ghosting.

4partee
September 4th, 2007, 02:08 PM
Vista is owning the MBR.

I am setting up a dual-boot notebook, Compaq F572US.

When I start Vista from the grub menu, I am forced to do a system recovery by Vista. When I recover and reboot, the grub menu is gone and the notebook boots directly into Vista. Those dirty cork soakers!

I believe what I need is to create a DVD or flash/usb that can be used to boot into Ubuntu. How to do that?

John

I installed grub to a usb/flash per http://users.bigpond.net.au/hermanzone/p15.htm#How_to_add_Grub_to_your_USB_thumb_drive. and now I get error 22:.

mahasmb
September 6th, 2007, 02:04 AM
I just re-installed Windows XP. After doing so, GRUB didn't show up. Windows just booted up by itself.

So I followed this HOWTO. Now GRUB shows up and Ubuntu boots... but I can't get Windows to boot up. I've tried changing from root (hd0,0) to root (hd0,0) with GRUB, but nothing loads up Windows.

EDIT:
I went here (http://users.bigpond.net.au/hermanzone/p10.htm#Mounting_Ubuntu_with_Dapper_Desktop_LiveCD ) and after mounting my disk and changing my menu.lst file, Windows booted!

mahasmb
September 11th, 2007, 03:26 AM
When I reboot my laptop, and GRUB boots up, I get a "GRUB error 17". The GRUB menu won't come up.

I tried this How To, and it says it's installed GRUB again and even written to menu.lst, but when I reboot, nothing changes. I still get the same error.

What should I do?

confused57
September 11th, 2007, 04:11 AM
When I reboot my laptop, and GRUB boots up, I get a "GRUB error 17". The GRUB menu won't come up.

I tried this How To, and it says it's installed GRUB again and even written to menu.lst, but when I reboot, nothing changes. I still get the same error.

What should I do?

Here are some possible solutions for grub error 17:
http://users.bigpond.net.au/hermanzone/p15.htm#17

Check out the link to the thread by American Yellow.

mahasmb
September 11th, 2007, 10:08 AM
Thanks, but it's still not fixing my problem. I even tried Super Grub Disk.

One thing I have to note is that I always get the following error whenever I try to mount my Ubuntu partition


mount -t ext3 /dev/hda3 /mnt/ubuntu
mount: wrong fs type, bad option, bad superblock on /dev/hda3,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

Campingman
September 14th, 2007, 10:32 PM
Thanks catlett,

Ended a couple of hours of messing about for me, nice one

I was returning an error 15, used the supergrub CD to boot into Xubuntu and did the repair from the OS I wanted to boot. Worked a treat!

:):):):):):)

applegrew
September 16th, 2007, 08:12 PM
Hey thanks for the great and simple post. Nice trick. Anyway I thought that this process will reset my menu.lst (which I had modded a little), but it didn't, so that was good for me, but also it gave me a little surprise. I could now reach to Grub menu but I could no longer boot. Grub complained that the partition was not found.......

Anyway I had figured it out. Initially my partitons were (hd0,2), but after I deleted a partiton it became (hd0,1). All I had to do was edit my menu.lst at /boot/grub.

For those who face such problem and are thinking of going back to the Live CD and boot and edit the menu.lst. Here is an easier way.
Just highlight the entry in Grub and press 'e' then highlight the line to edit and press 'e' again. Edit that and press Enter. Now press 'b' to boot. :D

orangenick
September 18th, 2007, 09:07 PM
[delete this comment]

Chymera
September 21st, 2007, 08:07 PM
I tried doing what you said but i still get the same problem (bootloader does not boot my ubuntu entry, after a sabayon install)

any ideas as to how i can fix it?

murak
September 21st, 2007, 08:12 PM
What kind of error message do you get? maby you just have to edit the .list? If not, ignore my post.

Chymera
September 21st, 2007, 08:15 PM
you may be right, but i have no idea what to edit, message is as follows

rootnoverif (hd0,1)
chainloader +1
Error 13: Invalid or unsupported executable format

sgtbob
September 22nd, 2007, 12:15 AM
I realize this is an old message - but I want to thank the author - it saved my having to do a lot of re-installing to recoup my grub file. I wish I had found it before i had to reformat a second PC and start all over. Many thanks.:)http://ubuntuforums.org/images/smilies/new_popcornsmiley.gif

Chymera
September 22nd, 2007, 07:41 PM
solved, if anyone else runs into similar trouble, look here http://ubuntuforums.org/showthread.php?t=556610

g4ry.l33
September 30th, 2007, 03:28 PM
Thanks for the post! The first part is all I needed. Ubuntu is GREAT &
this place ROCKS! :guitar:

74nK5 !

w0utje
October 24th, 2007, 01:46 PM
thnx this helped for me. i had ubuntu 6.06 LTS and then installed vista..
so my grub was gone from MBR. so then I could't load ubuntu. a little time after i installed vista i deleted it and installed XP. but i couldn't get on ubuntu here either. so i searched and found this article. it was fixed in no time! thanks!:)

tech9
October 24th, 2007, 03:12 PM
This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see "sudo" that will mean to you that the following command should be entered at a root terminal.)

Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.

When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)


sudo grub

This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands


find /boot/grub/stage1

This will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)


root (hd?,?)
Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr


setup (hd0)

Finally exit the grub shell

quit

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.

Now the explanation.
Sudo grub gets you the grub shell.
Find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub's files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.
So root (hd?,?) tells grub it's files are on that partition.
Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive's mbr.
Quit will exit you from the grub shell.



THIS IS AN EDIT. 5-HT MADE A GOOD POINT AND I AM JUST GOING TO COPY/PASTE IT HERE



THIS IS ANOTHER EDIT. TOSK POSTED A WAY TO MOUNT PROC AND UDEV. THIS WAS NEEDED BECAUSE GRUB WASN'T RECOGNISING THE DRIVE. I THOUGHT IT WAS A VALUABLE COMMENT AND DECIDED TO PUT IT IN THE ORIGINAL POST SO PEOPLE WILL SEE IT AT THE TOP. IT MAY BE MISSED AS JUST A REPLY POST DOWN THE PAGE.
ALL KNOWLEDGE IS WELCOME!





**This set of instruction is a combination of 2 guides I saw before. One was a Mepis grub how to but I never found it again. The other is the grub manual. It's section explained the find, root, setup process but never mentioned it could be done from a live session.

This is the grub link http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-natively.html#Installing-GRUB-natively

Post script;
Just to post as much information as possible, this is an older how to for resoring grub to the mbr. The original post is directions for using the install cd and then there are replies that mention the method I posted here, as well as the chroot method mlind mentioned. If this method fails, you may want to try this http://ubuntuforums.org/showthread.php?t=24113

very nice tutorial!

JJL79
October 25th, 2007, 04:21 PM
I was going to remove a hdd from system but removed wrong one. I noticed this when i tried to boot so i installed the hdd again but now i got

Error 15

Have tried the live cd and Sudo Grub thing which seems to work ok and also supergrub but i still get Error 15. I am using install cd to boot from first hdd to get system running.

Any ideas what to do next?

meierfra
October 25th, 2007, 04:51 PM
Probably the boot order of your hard drives has changed and now grub is looking for ubuntu on the wrong hard drive. You might be able change the boot order in the bios to fix the problem.
If that does not work you will have to edit "menu.lst.

JJL79
October 25th, 2007, 07:18 PM
Probably the boot order of your hard drives has changed and now grub is looking for ubuntu on the wrong hard drive. You might be able change the boot order in the bios to fix the problem.
If that does not work you will have to edit "menu.lst.

When i connected the disk again everything was back to how it was when it worked. Is it still possible that boot order changed?

JJL79
October 25th, 2007, 07:59 PM
I have tried to edit menu.lst by changing hd(0,0) to other like 1.0 0.1 and such but then i cannot even use "boot from first disk" in install cd

yourtvlies
October 26th, 2007, 07:44 AM
This thread just saved me hours of work. Thank you, thank you, thank you.

eddie_gordo
October 28th, 2007, 08:19 PM
Guys, I'm about to try this "How to" on how to restore grub in my laptop... But I have a question:


When I'm supposed to write


setup (hd0)

isn't this referring to the partition on my laptop that has all the recovery system from Asus? Should I write:


setup(hd0,1)

instead? Or better, shouldn't I write setup(hd0,X), where X is the partition where Ubuntu is installed? Or in any case it will always be setup(hd0)?

Thanks in advance...

meierfra
October 28th, 2007, 09:44 PM
setup (hd0)
isn't this referring to the partition on my laptop that has all the recovery system from Asus?

No, (hd0) will put grub on the first sector of the hard drive. Your recovery partition is (hd0,0) (not (hd0))

Bernie01
October 29th, 2007, 10:56 AM
I have tried following the steps outlined here and I still cannot get GRUB working.

Here the results of what I have done so far:--

[ Minimal BASH-like line editing is supported. For

the first word, TAB lists possible command

completions. Anywhere else TAB lists the possible

completions of a device/filename. ]



grub> find /boot/grub/stage1

(hd1,1)

(hd1,2) Would this be a reason for my problems?



grub> root (hd1,1)



grub> setup (hd1)

Checking if "/boot/grub/stage1" exists... yes

Checking if "/boot/grub/stage2" exists... yes

Checking if "/boot/grub/e2fs_stage1_5" exists... yes

Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 17 sectors are embedded.

succeeded

Running "install /boot/grub/stage1 (hd1) (hd1)1+17 p (hd1,1)/boot/grub/stage2

/boot/grub/menu.lst"... succeeded

Done.



grub>



ubuntu@ubuntu:~$ sudo mkdir /mnt/root

ubuntu@ubuntu:~$ sudo mount -t ext3 /dev/sdb2 /mnt/root

ubuntu@ubuntu:~$ sudo mount -t proc none /mnt/root/proc

ubuntu@ubuntu:~$ sudo mount -o bind /dev /mnt/root/dev

ubuntu@ubuntu:~$ sudo chroot /mnt/root /bin/bash

root@ubuntu:/#


root@ubuntu:/# sudo fdisk -l



Disk /dev/sda: 40.0 GB, 40060403712 bytes

255 heads, 63 sectors/track, 4870 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x019f019f



Device Boot Start End Blocks Id System

/dev/sda1 * 1 3205 25744131 c W95 FAT32 (LBA)

/dev/sda2 3206 4870 13374112+ c W95 FAT32 (LBA)



Disk /dev/sdb: 250.0 GB, 250059350016 bytes

255 heads, 63 sectors/track, 30401 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x11a611a5



Device Boot Start End Blocks Id System

/dev/sdb1 * 1 7649 61440561 7 HPFS/NTFS

/dev/sdb2 7650 11297 29302560 83 Linux

/dev/sdb3 11298 14944 29294527+ 83 Linux



Disk /dev/sdc: 250.0 GB, 250059350016 bytes

255 heads, 63 sectors/track, 30401 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xc72a52db



Device Boot Start End Blocks Id System

/dev/sdc1 * 1 12748 102398278+ b W95 FAT32

/dev/sdc2 12749 25496 102398310 b W95 FAT32

/dev/sdc3 25497 26006 4096575 82 Linux swap / Solaris

root@ubuntu:/#


root@ubuntu:/# gedit /boot/grub/menu.lst

cannot open display:

Run 'gedit --help' to see a full list of available command line options.

root@ubuntu:/#


I located menu.lst using Nautilus

# menu.lst - See: grub(8), info grub, update-grub(8)

# grub-install(8), grub-floppy(8),

# grub-md5-crypt, /usr/share/doc/grub

# and /usr/share/doc/grub-doc/.



## default num

# Set the default entry to the entry number NUM. Numbering starts from 0, and

# the entry number 0 is the default if the command is not used.

#

# You can specify 'saved' instead of a number. In this case, the default entry

# is the entry saved with the command 'savedefault'.

# WARNING: If you are using dmraid do not use 'savedefault' or your

# array will desync and will not let you boot your system.

default 0



## timeout sec

# Set a timeout, in SEC seconds, before automatically booting the default entry

# (normally the first entry defined).

timeout 10



## hiddenmenu

# Hides the menu by default (press ESC to see the menu)

#hiddenmenu



# Pretty colours

#color cyan/blue white/blue



## password ['--md5'] passwd

# If used in the first section of a menu file, disable all interactive editing

# control (menu entry editor and command-line) and entries protected by the

# command 'lock'

# e.g. password topsecret

# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/

# password topsecret



#

# examples

#

# title Windows 95/98/NT/2000

# root (hd0,0)

# makeactive

# chainloader +1

#

# title Linux

# root (hd0,1)

# kernel /vmlinuz root=/dev/hda2 ro

#



#

# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST



### BEGIN AUTOMAGIC KERNELS LIST

## lines between the AUTOMAGIC KERNELS LIST markers will be modified

## by the debian update-grub script except for the default options below



## DO NOT UNCOMMENT THEM, Just edit them to your needs



## ## Start Default Options ##

## default kernel options

## default kernel options for automagic boot options

## If you want special options for specific kernels use kopt_x_y_z

## where x.y.z is kernel version. Minor versions can be omitted.

## e.g. kopt=root=/dev/hda1 ro

## kopt_2_6_8=root=/dev/hdc1 ro

## kopt_2_6_8_2_686=root=/dev/hdc2 ro

# kopt=root=UUID=bbc09990-36cd-404e-9fb1-cebc214a9873 ro



## Setup crashdump menu entries

## e.g. crashdump=1

# crashdump=0



## default grub root device

## e.g. groot=(hd0,0)

# groot=(hd1,1)



## should update-grub create alternative automagic boot options

## e.g. alternative=true

## alternative=false

# alternative=true



## should update-grub lock alternative automagic boot options

## e.g. lockalternative=true

## lockalternative=false

# lockalternative=false



## additional options to use with the default boot option, but not with the

## alternatives

## e.g. defoptions=vga=791 resume=/dev/hda5

# defoptions=quiet splash



## should update-grub lock old automagic boot options

## e.g. lockold=false

## lockold=true

# lockold=false



## Xen hypervisor options to use with the default Xen boot option

# xenhopt=



## Xen Linux kernel options to use with the default Xen boot option

# xenkopt=console=tty0



## altoption boot targets option

## multiple altoptions lines are allowed

## e.g. altoptions=(extra menu suffix) extra boot options

## altoptions=(recovery) single

# altoptions=(recovery mode) single



## controls how many kernels should be put into the menu.lst

## only counts the first occurence of a kernel, not the

## alternative kernel options

## e.g. howmany=all

## howmany=7

# howmany=all



## should update-grub create memtest86 boot option

## e.g. memtest86=true

## memtest86=false

# memtest86=true



## should update-grub adjust the value of the default booted system

## can be true or false

# updatedefaultentry=false



## should update-grub add savedefault to the default options

## can be true or false

# savedefault=false



## ## End Default Options ##



title Ubuntu 7.10, kernel 2.6.22-14-generic

root (hd1,1)

kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=bbc09990-36cd-404e-9fb1-cebc214a9873 ro quiet splash

initrd /boot/initrd.img-2.6.22-14-generic

quiet



title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)

root (hd1,1)

kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=bbc09990-36cd-404e-9fb1-cebc214a9873 ro single

initrd /boot/initrd.img-2.6.22-14-generic



title Ubuntu 7.10, memtest86+

root (hd1,1)

kernel /boot/memtest86+.bin

quiet



### END DEBIAN AUTOMAGIC KERNELS LIST



# This is a divider, added to separate the menu items below from the Debian

# ones.

title Other operating systems:

root





# This entry automatically added by the Debian installer for a non-linux OS

# on /dev/sdb1

title Microsoft Windows XP Home Edition

root (hd1,0)

savedefault

makeactive

map (hd0) (hd1)

map (hd1) (hd0)

chainloader +1





# This entry automatically added by the Debian installer for an existing

# linux installation on /dev/sdb3.

title Ubuntu 7.10, kernel 2.6.22-14-generic (on /dev/sdb3)

root (hd1,2)

kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=d903c486-d0ca-4d71-837b-b8d535c7d808 ro quiet splash

initrd /boot/initrd.img-2.6.22-14-generic

savedefault

boot





# This entry automatically added by the Debian installer for an existing

# linux installation on /dev/sdb3.

title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode) (on /dev/sdb3)

root (hd1,2)

kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=d903c486-d0ca-4d71-837b-b8d535c7d808 ro single

initrd /boot/initrd.img-2.6.22-14-generic

savedefault

boot





# This entry automatically added by the Debian installer for an existing

# linux installation on /dev/sdb3.

title Ubuntu 7.10, memtest86+ (on /dev/sdb3)

root (hd1,2)

kernel /boot/memtest86+.bin

savedefault

boot

I hope somebody can help me with this mystery

Cheers, Bernie

meierfra
October 29th, 2007, 02:33 PM
grub> find /boot/grub/stage1

(hd1,1)

(hd1,2) Would this be a reason for my problems?

No. That's just because you to have two versions of linux on your computer. Shouldn't cause any problems



grub> root (hd1,1)
grub> setup (hd1)

Replace "setup (hd1)" by "setup (hd0)". So just do



sudo grub

grub> root (hd1,1)

grub> setup (hd0)

grub> quit


in a terminal in the Live CD. Reboot and you should be all set.

Bernie01
October 30th, 2007, 12:57 AM
Thanks for the reply meierfra. I am away for the next couple of days and will try it when I return home.

CeeDub
October 31st, 2007, 02:10 AM
Oh please help me. I went through the walkthrough and everything seems to have gone fine. When I reboot into grub and try to boot into Ubuntu, it says error 17. Windows will boot ok. I've searched through this thread and someone said that they need to edit their menu.lst. I am pretty sure that's what I need to do, but I don't know what to edit. I can't even get any of my partitions mounted correctly. HELP!

meierfra
October 31st, 2007, 05:24 AM
CeeDub: Please post the output of


gksudo gedit /boot/grub/menu.lst

and


sudo fdisk -l
(all l are lower case L)

Bernie01
October 31st, 2007, 10:25 PM
No. That's just because you to have two versions of linux on your computer. Shouldn't cause any problems



Replace "setup (hd1)" by "setup (hd0)". So just do



sudo grub

grub> root (hd1,1)

grub> setup (hd0)

grub> quit


in a terminal in the Live CD. Reboot and you should be all set.

Hi meierfra,

Back home now and tried your suggestion with no luck. I still receive 'Error 15 File does not exist'

Here is the screen from Terminal while I was entering the commands:-

grub> root (hd1,1)



grub> setup (hd0)

Checking if "/boot/grub/stage1" exists... yes

Checking if "/boot/grub/stage2" exists... yes

Checking if "/boot/grub/e2fs_stage1_5" exists... yes

Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded.

succeeded

Running "install /boot/grub/stage1 d (hd0) (hd0)1+17 p (hd1,1)/boot/grub/stage

2 /boot/grub/menu.lst"... succeeded

Done.



grub>

If you can see anything in this or suggest something that will help I would greatly appreciate it.

Cheers, Bernie

meierfra
October 31st, 2007, 11:07 PM
I still receive 'Error 15 File does not exist'

Bernie01: Do you get this error after selecting ubuntu in the grub menu? Or does the grub menu not even appear at boot up?

Bernie01
October 31st, 2007, 11:10 PM
THe error message appears after selecting Ubuntu from the GRUB menu

confused57
November 1st, 2007, 02:26 AM
THe error message appears after selecting Ubuntu from the GRUB menu
Have you tried setting your bios to boot your sda drive as the first hard drive in the boot priority?

Bernie01
November 1st, 2007, 03:39 AM
Have you tried setting your bios to boot your sda drive as the first hard drive in the boot priority?


No, I didn't think of that. I will try it when I get home from work tonight. Thanks

meierfra
November 1st, 2007, 03:53 AM
Changing your booting order might work, But you would also have to change all (hd1,1) in your menu.lst to (hd0,1). ) ( Edit: I'm No longer sure about this. Maybe It would work even editing menu.lst)

You might also try either of these:

1) At the grub menu press "c".
type "find /boot/grub/stage1" and press enter.
This will return (hdx,y). If this isn't (hd1,1), then press "Esc", You should be back to the grub menu. Select ubuntu (but don't press enter)
Press "e" and again "e". Change "root (hd1,1)" to "root (hdx,y)". Press enter and then "b". If this boots you into ubuntu, change (hd1,1) in menu.lst to (hdx,y) and everything should be fine.

You might also try to replace (hd1,1) but some random (or systematic) combinations and see what happens.

2) Get super grub:

Info on Super Grub on Hermanzone. (http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html)

Bernie01
November 1st, 2007, 10:48 AM
Changing your booting order might work, But you would also have to change all (hd1,1) in your menu.lst to (hd0,1).

You might also try either of these:

1) At the grub menu press "c".
type "find /boot/grub/stage1" and press enter.
This will return (hdx,y). If this isn't (hd1,1), then press "Esc", You should be back to the grub menu. Select ubuntu (but don't press enter)
Press "e" and again "e". Change "root (hd1,1)" to "root (hdx,y)". Press enter and then "b". If this boots you into ubuntu, change (hd1,1) in menu.lst to (hdx,y) and everything should be fine.

You might also try to replace (hd1,1) but some random (or systematic) combinations and see what happens.

2) Get super grub:

Info on Super Grub on Hermanzone. (http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html)


meierfra, It is finally fixed. I followed your instructions in 1) and the result was (hd0,1). It was simply a matter of editing menu.lst from there and works perfectly.

Please accept my gratitude for your patience and assistance.

Cheers, Bernie

krige
November 1st, 2007, 01:49 PM
I have recently formatted my laptop and installed Windows XP and Ubuntu 7.10 one after the other. After having finished the installation of the latter and having rebooted I got the error message "Error loading operating system". Rebooting from Ubuntu installation CD and trying with "find /boot/grub/stage1" I get the error "Error 15: File not found".

I can't mount my root partition because I don't know where exactly my Ubuntu is installed. If I run "sudo fdisk -l" I get the error "sudo: unable to execute /sbin/fdisk: Input/output error". From the live CD all the partitions are working fine: Windows is mounted on /media/disk, Ubuntu on /media/disk-1 and there is a data partition mounted on /media/disk-2

Any clues?

krige
November 1st, 2007, 03:29 PM
I have recently formatted my laptop and installed Windows XP and Ubuntu 7.10 one after the other. After having finished the installation of the latter and having rebooted I got the error message "Error loading operating system". Rebooting from Ubuntu installation CD and trying with "find /boot/grub/stage1" I get the error "Error 15: File not found".

I rebooted with the installation CD and this time "fdisk -l" magically worked: I got to know that the partition where my Ubuntu is installed is /dev/sda3 so I ran the following commands:

sudo mkdir /mnt/root
sudo mount -t ext3 /dev/sda3 /mnt/root
sudo mount -t proc none /mnt/root/proc
sudo mount -o bind /dev /mnt/root/dev
sudo chroot /mnt/root /bin/bash
sudo grub
find /boot/grub/stage1

and got again the message "Error 15: File not found".

ferossan
November 1st, 2007, 05:28 PM
Here I'm in trouble too. (Probably because I have a Sata and an IDE drive together)
I just installed ubuntu 7.10 beside XP (XP first and then Ubuntu) and Grub doesn't appear. System boot goes directly to XP without show Grub.
If I boot from the Live CD and choose "Boot from first hard disk" I'm able to boot XP or Ubuntu without problems
I'm wondering if will work something like this (I don't want to mess it up so I want to ask first) :

sudo grub
grub> root (hd1,1)
grub> setup (hd0)
grub> quit

Considering:
sudo fdisk -l
find /boot/grub/stage1
and my grub menu.lst

What I have:

fer@fer-desktop:~$ sudo fdisk -l

Disco /dev/sda: 82.3 GB, 82348277760 bytes
255 cabezas, 63 sectores/pistas, 10011 cilindros
Unidades = cilindros de 16065 * 512 = 8225280 bytes
Disk identifier: 0xa84fa84f

Disposit. Inicio Comienzo Fin Bloques Id Sistema
/dev/sda1 * 1 5543 44524116 7 HPFS/NTFS
/dev/sda2 5544 9823 34379100 83 Linux
/dev/sda3 9824 10011 1510110 5 Extendida
/dev/sda5 9824 10011 1510078+ 82 Linux swap / Solaris

Disco /dev/hdb: 40.0 GB, 40020664320 bytes
255 cabezas, 63 sectores/pistas, 4865 cilindros
Unidades = cilindros de 16065 * 512 = 8225280 bytes
Disk identifier: 0x0008cfb4

Disposit. Inicio Comienzo Fin Bloques Id Sistema
/dev/hdb1 * 1 4865 39078081 7 HPFS/NTFS
fer@fer-desktop:~$


grub> find /boot/grub/stage1
(hd1,1)

And my Grub menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=e96c96f0-faf1-40be-ba44-e8ff47413070 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd1,1)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash locale=es_ES

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd1,1)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=e96c96f0-faf1-40be-ba44-e8ff47413070 ro quiet splash locale=es_ES
initrd /boot/initrd.img-2.6.22-14-generic
quiet

title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
root (hd1,1)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=e96c96f0-faf1-40be-ba44-e8ff47413070 ro single
initrd /boot/initrd.img-2.6.22-14-generic

title Ubuntu 7.10, memtest86+
root (hd1,1)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd1,0)
savedefault
makeactive
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

ferossan
November 1st, 2007, 08:15 PM
OK, I didn't wait for an answer and I proceed with:
sudo grub
grub> root (hd1,1)
grub> setup (hd0)
grub> quit

It did't work, same happens, at booting system goes directly to XP without show Grub options.
Now I have not idea what can I do. :confused:
Anyone could advice me??? please?
Thanks a lot

josephpmh
November 1st, 2007, 08:49 PM
>This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these >commands
>
>Code:
>
>find /boot/grub/stage1
>
>This will return a location. If you have more than one, select the installation that >you want to provide the grub files.
>Next, THIS IS IMPORTANT, whatever was returned for the find command use it in >the next line (you are still at grub>. when you enter the next 3 commands)

when I run in grub "find /boot/grub/stage1" I get Error 15: File not found.

How do I get that?

Grub is not installing from the install (Live)CD; I can't start windows either. The only way I get the PC (Dell Dimension 2450) up and running si w/ the Live CD.

Any advice on how to install the grub to make the PC bootable?

ferossan
November 1st, 2007, 09:37 PM
Did you try this?
sudo find /boot/grub/stage1

meierfra
November 2nd, 2007, 01:02 AM
krige: Let's try to find /boot/grub/stage1 manually:

In the a terminal in the live cd type:



sudo mkdir /mnt/root

sudo mount -t ext3 /dev/sda3 /mnt/root

cd /mnt/root/boot

cd grub

ls

This will lists all files in /boot/grub on your ubuntu partitions.

Lets us know whether you found "stage1" in this way.

meierfra
November 2nd, 2007, 01:10 AM
ferossan:

A couple of things to try:

1) change the boot order in the bios,

If this does not give your the grub menu:

2) with the original boot order
sudo grub
grub> root (hd1,1)
grub> setup (hd1)
grub> quit

ferossan
November 2nd, 2007, 03:35 AM
SOLVED !!!
Thanks a lot meierfra. =D>
Changing the boot order in the bios did it.
Strange anyway forcing the Bios to boot the IDE drive first (which has none OS) and then the SATA one where are XP and Ubuntu.
Now let's start to play with my new OS \\:D/

meierfra
November 2nd, 2007, 04:20 AM
Strange anyway forcing the Bios to boot the IDE drive first (which has none OS) and then the SATA one where are XP and Ubuntu.

Well what happens is that ubuntu gets confused with boot order of IDE and SATA drives. Ubuntu somehow is convinced that the IDE drive is first in the boot order and sets up everything that way. Rather then changing all the wrong settings in ubuntu, it is just easier to change the boot order.

krige
November 2nd, 2007, 11:39 AM
This will lists all files in /boot/grub on your ubuntu partitions.


There is no "grub" directory in /boot/ ... I repeated the installation process and noticed that it actually stops at 94% just when it says "Installing boot loader": the installation disappears just like that, without any notification. I have made the CD check before everything so I am starting to think the problem might be due to a faulty CD drive and/or faulty hard drive.

josephpmh
November 2nd, 2007, 02:40 PM
I keep trying this but end up realizing that I have no stage1 file.

Like krige, there is not grub folder or file in the /boot.

Can someone help me with that? ta.

jw5801
November 3rd, 2007, 12:05 AM
Grub hasn't been installed at all. Can you make it into the system via the LiveCD or any other route? If you can run "sudo apt-get install grub" then try running the commands and see what happens.

Azakus
November 3rd, 2007, 01:36 AM
I had this problem as well. The fix I found was to copy all the stage1, partition stage1.5's, and stage2 from a working copy and paste it into /boot/grub. Then, run sudo grub-install /dev/sdX and sudo update-grub.

sssbbb
November 6th, 2007, 10:55 PM
Thank you sooooo much. An XP install messed up my MBR (ntldr is missing error) on a disk with both ubuntu and xubuntu previously installed... thank god for live cd's and good forums!

pure-drivel
November 7th, 2007, 04:08 PM
Hi there!

This is the first time I've installed Ubuntu at home, and I'm having some trouble.

I'm trying to dual-boot XP and Ubuntu 7.1. I installed XP first and then followed this guide (http://apcmag.com/6101/dualboot_windows_xp_and_ubuntu) to complete the install of Ubuntu.

Install went off without a hitch, but the problem is GRUB didn't take over my MBR. It just continues to boot into Windows without prompting me. When I press F8, it only shows Windows XP as a choice.

I've tried reinstalling GRUB to the MBR via the Ubuntu Live CD as described in this thread, but it still won't load GRUB. It's like Windows knows its about to be relegated to "gaming only," and it won't let that happen. What the heck is going on, and how can I fix it?

I realize from cruising this thread the problem may come from having both an IDE and a SATA drive installed. Do I have to change the boot order on my BIOS to boot the IDE first?

pablo.paez
November 9th, 2007, 03:35 PM
I have to reinstall XP so i lost grub (i was expecting this).
I have in /dev/sda5 my /boot and in my /dev/sda6 my /
So i did
grub> root (hd0,5)
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded. succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,5)/boot/grub/stage2 /boot/grub/menu.lsd"... succeeded
Done

I though this was all right, actually i have grub back but now opens some kind of bash and i don't have any option from the menu.lst

I'm kind of lost here...

Any ideas?:confused:

mahiyar
November 9th, 2007, 05:33 PM
This might be a problem typical of my installation. I have one ide drive and one sata drive, I boot up from sata drive. I have Fiesty and Gutsy in seperate partitions in SATA drive, and windows and edgy in seperate partition in edgy drive. My MBR is dictated by the grub in SATA of fiesty. Now when I installed Gutsy I did not install the grub and used links in the fiesty's grub for gutsy. Now I want the grub to point to the gutsy partition. Can anyone one guide me as to how to about it.

meierfra
November 10th, 2007, 03:37 AM
Do I have to change the boot order on my BIOS to boot the IDE first?

That might indeed solve your problem. If it didn't, check out this post:


http://ubuntuforums.org/showthread.php?t=442945#9

If that didn't help either, post your menu.lst and the output of "sudo fdisk -l"

meierfra
November 10th, 2007, 03:49 AM
I have to reinstall XP so i lost grub (i was expecting this).
I have in /dev/sda5 my /boot and in my /dev/sda6 my /
So i did
grub> root (hd0,5)
grub> setup (hd0)
(hd0,5)/boot/grub/stage2 /boot/grub/menu.lsd"... succeeded
Done



Strange. /dev/sda5 is (hd0,4) . So you need to do "root (hd0,4) setup (hd0).

But since your setup was succesful, I would guess that /boot really is on /dev/sda6.

Could you post your fdisk, menu.lst and fstab?

(Boot from the live cd, mount your ubuntu partion to say /media/ubuntu (let me know if you need help with that) and post the output of

sudo fdisk -l

cat /media/ubuntu/boot/grub/menu.lst

and

cat /media/ubuntu/etc/fstab
)

meierfra
November 10th, 2007, 04:03 AM
Now I want the grub to point to the gutsy partition. Can anyone one guide me as to how to about it.

I assume that you read the howto at the begining of this thread. So I will be brief (feel free to ask if you need more details)

First of all you will need to reinstall grub via

sudo grub
root (hdx,y)
root (hd0)
quit

where (hdx,y) is the gutsy partition.

Next you will need to add the other operating systems to the gutsy menu.lst. There are several ways to do this, I will suggest two:

1) add the following to the end of the gutsy menu.lst:

title Feisty
configfile (hdz,u)\boot\grub\menu.lst

where (hdz,u) is your feisty partition. If you click on this item in the grub menu you will be directed to the feisty grub menu.

2) Copy and paste all relevant items from the feisty menu.lst to the gutsy menu.lst

mahiyar
November 10th, 2007, 10:49 AM
Thanks meierfra. After doing all of the above can I just copy verbatim the feisty's menu.lst file to gutsy?

meierfra
November 10th, 2007, 05:13 PM
Don't copy the whole file, just the various titles:

So things which looks like this:


title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd0,3)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=d019e9bb-9990-4203-89cf-aed5e7802c74 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet


or

title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
root (hd0,3)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=d019e9bb-9990-4203-89cf-aed5e7802c74 ro single
initrd /boot/initrd.img-2.6.22-14-generic


or

title Microsoft Windows XP Professional
root (hd0,1)
makeactive
chainloader +1

No need to copy :

title Ubuntu 7.10, memtest86+
root (hd0,3)
kernel /boot/memtest86+.bin
quiet

since you already have a memtest on the gutsy menu.lst


Put all these titles at the end of the gusty menu.lst.

mahiyar
November 10th, 2007, 05:29 PM
Thanks will keep you posted on my progress.

BLTicklemonster
November 11th, 2007, 05:58 AM
Does this work if I want to hook a different hard drive up and check it out? I'm in the process of installing a new hard drive and remove two, but in order to install, I had to leave one of them out of the loop. I have all I want from one of them, now I need to disconnect it, and hook up the one that is sitting idle. Of course I can't just do that because unlike windows, linux doesn't just outright find stuff (wish it did).

And wouldn't I have to redo fstab, also?

*edit: to make matters worse, it's a hard drive with five partitions.

XP ntfs
storage ntfs
gutsy tribe reiserfs
swap
swap
(for some reason there's two swaps)

So probably I can just get the grub and fstab info from it, edit what I have on this one, turn off the machine, hook up the drive, and go from there? Or not, because it will no longer be in the order it was before... hmmmm. It was hda, perhaps I can just edit its info with hdb because it's going to be my slave on ide1 at this point?

**Edit again:

Heh heh, I worry too much.

find stage1

root to it

setup

quit

bam. Muahahaha.

charles_316
November 12th, 2007, 07:10 AM
thanks... extremely useful tutorial

jase21
November 12th, 2007, 10:30 PM
Thanks buddy

dave37
November 16th, 2007, 03:14 PM
Thanks so much, this howto was a life saver!
:KS