Re: HOWTO: Restore GRUB (if your MBR is messed up)
Here is my setup
hda0: windows
hda1: linux
hda2: swap
I had to reinstall windows because of obivious windows issues. After the install I could not boot ubuntu. I tried a few from this posts but none of them worked for me. Finaly It worked when I used the following method.
1. Boot live cd of ubuntu (I used xubuntu)
2. Ran Gnome Partition editor
3. Changed the boot flag from windows partition to the linux partition
(I ran those grub root and setup commands to my linux partition before I changed the boot flag so I don't know if those commands had anything to do with it or not)
Hope it helps to some like me.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Super Grub Disk worked easily and well to reinstall (restored) GRUB which allowed my abiltiy to have either Ubuntu or Kubuntu session or the boot windows XP.
I googled for Super Grub Disk, D/L ISO, burned CD, booted from CD and followed the simple guided directions. It worked easily.
I tried using the live CD and the Grub command but it did not work for me (find /boot/grub/stage1 generated error message).
I tried the mkdir ubuntu method, mount /dev/hdb, chroot ubuntu method and it did not work (got stuck on grub-install /dev/hda step).
Super Grub Disk was elegantly simple and effective.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Thanks for this, I'm gonna try it immediately ^_^
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Hi, I get the Error 22 from grub so as far as I understand it is my MBR that is incorrect. I tried the instructions below but they didn't solve my problem.
When I start with the live CD and check my devices I get the following:
sda (my SATA disk where the linux I want to boot is stored).
hdh (a PATA disk - primary on my 4th controller)
hdg (another PATA disk - secondary on my 4th controller)
Now I would assume that sda1 (containing the /boot) would translate to hd0,0. Is this correct? How do I check this?
If I try in grub:
"grub> find /boot/grub/stage1"
I get
hd0,0 (sda1?)
hd2,0 (hdg1 - an old linux installation)
So, according to the instructions this would mean:
1. Pop in the Live CD, boot from it until you reach the desktop.
2. Open a terminal window or switch to a tty.
3. Type "grub"
4. Type "root (hd0,0)"
5. Type "setup (hd0)"
6. Quit grub by typing "quit".
7. Reboot.
Won't work :confused: PLEASE - HELP NEEDED.
Quote:
Originally Posted by
remmelt
Isn't it easier to do this:
1. Pop in the Live CD, boot from it until you reach the desktop.
2. Open a terminal window or switch to a tty.
3. Type "grub"
4. Type "root (hd0,6)", or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda7, which translates to hd0,6 for grub).
5. Type "setup (hd0)", ot whatever your harddisk nr is.
6. Quit grub by typing "quit".
7. Reboot.
I may be missing your point though, if so, please forgive me :)
Re: HOWTO: Restore GRUB (if your MBR is messed up)
OK - I´ve read through this whole thread, tried everything, and I´m still stuck. I probably have the same situation as several people here. I´m now sitting my with case open, with a cd rom hang out, just to boot up - quite a mess.
Here´s where I am :
1. Using (and hard-powering off in the middle of) the GParted CD seemed to mess something up. When booting after that I got the standard ¨DISK BOOT FAILURE. INSERT....¨.
2. If I continue to use the GParted CD, and scroll down the main menu and choose ¨Boot MBR on first hard drive¨, Ubuntu boots up fine. This makes me think that there´s a boot record somewhere, it´s just been redirected somwhere.
3. When I run Partition Editor from Ubuntu, the first partition (/dev/hda1 - mountpoint /, etx3) from my first drive (hda) is set as bootable.
4. I´ve tried using the sudo grub-install /dev/hda
I´ve tried using the sudo grub-install /dev/hda1
5. I´ve tried going into sudo grub, running :
find /boot/grub/stage1
run (hd0,0)
setup (hd0,0)
and also :
find /boot/grub/stage1
run (hd0,0)
setup (hd0)
With no effect - I keep coming up with DISK BOOT FAILURE. So I´m not too sure what else I can do?
Any ideas would be great. If you need me to run any diags on my system please let me know.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
The command is "root (hd0,0)" not "run (hd0,0)". So try
Code:
sudo grub
root (hd0,0)
setup (hd0)
quit
If this did not work, post the output of
and
Code:
cat /boot/grub/menu.lst
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Hi
Sorry, typo there, I was using root, not run.
But I tried it again, and still no luck. I have since downloaded SuperGrub, and tried using that, without any success.
I booted into SuberGrub, went through the SuperGrub (With Help).
I went to the first menu option - Gnu\Linux (Grub)
I choose the Fix MBR
It scrolled down, showing the response, and said :
¨SGD has succeeded!¨
I then went through to the next screen, where I choose to reboot the PC.
Phrases above might not be exact, I´m typing from memory, but I did what the Help suggested, and was receiving the successful responses.
Below is what I get from sudo fdisk -lu :
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xe7ad9ffa
Device Boot Start End Blocks Id System
/dev/hda1 * 63 150657569 75328753+ 83 Linux
/dev/hda2 150657570 156296384 2819407+ 5 Extended
/dev/hda5 150657633 156296384 2819376 82 Linux swap / Solaris
Disk /dev/hdd: 400.0 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders, total 781422768 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x3efdc6f6
Device Boot Start End Blocks Id System
/dev/hdd1 63 781417664 390708801 7 HPFS/NTFS
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x114cd256
Device Boot Start End Blocks Id System
/dev/sda1 63 976768064 488384001 7 HPFS/NTFS
Disk /dev/sdb: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders, total 586072368 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x9b786cc0
Device Boot Start End Blocks Id System
/dev/sdb1 63 586067264 293033601 7 HPFS/NTFS
And the response to cat /boot/grub/menu.lst is :
# 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=e2ff3aca-6216-4599-8c82-9c05941ae402 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,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
## 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 (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=e2ff3aca-6216-4599-8c82-9c05941ae402 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 (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=e2ff3aca-6216-4599-8c82-9c05941ae402 ro single
initrd /boot/initrd.img-2.6.22-14-generic
title Ubuntu 7.10, kernel 2.6.20-16-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=e2ff3aca-6216-4599-8c82-9c05941ae402 ro quiet splash
initrd /boot/initrd.img-2.6.20-16-generic
quiet
title Ubuntu 7.10, kernel 2.6.20-16-generic (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=e2ff3aca-6216-4599-8c82-9c05941ae402 ro single
initrd /boot/initrd.img-2.6.20-16-generic
title Ubuntu 7.10, memtest86+
root (hd0,0)
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
(Not sure how much of this you need - sorry if it´s overkill??)
Thanks very much for your help - let me know if there´s anything else you need.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
I don't see anything wrong. Maybe you are trying to boot from the wrong hard drive. Make sure that the Bios are set to boot from the "ubuntu" drive.
If that did not help: Did you get any error messages after
" sudo grub; root (hd0,0); setup (hd0)" ? Try again and after "setup (hd0)" copy the whole terminal and post it here.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
No, it´s all successful.
:~$ sudo 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> root (hd0,0)
root (hd0,0)
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,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
grub> quit
quit
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Did you check the boot order in the bios?