Re: HOWTO: Restore GRUB (if your MBR is messed up)
Um, could someone kindly delete the misinformation in the first post? Following the instructions results in your ubuntu installation on disk being partially wiped and replaced with garbage when the installer crashes. 6.06 LTS.
I was able to correctly restore my GRUB using the command line, but it is too late thanks to this HOWTO which has been posted all over the internet.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Hi all.
I have reinstalled Winzozz and now grub isn't enabled.
I'm trying to restore GRUB but nothing to do...
This is my configuration:
Code:
/dev/hda1 WINDOWS
/dev/hda2 /
/dev/hda3 /swap
This is the log
Code:
root@ubuntu:/# grub-install --root-directory=/boot /dev/hda
Could not find device for /boot/boot: Not found or not a block device.
root@ubuntu:/# /sbin/grub
Probing devices to guess BIOS drives. This may take a long time.
root@ubuntu:/# /sbin/update-grub
Searching for GRUB installation directory ... found: /boot/grub
Testing for an existing GRUB menu.list file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.15-26-k7
Found kernel: /boot/vmlinuz-2.6.15-26-386
Found kernel: /boot/vmlinuz-2.6.15-23-386
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done
Now no one MBR start :(
Suggestions?
Re: HOWTO: Restore GRUB (if your MBR is messed up)
My situation is a little different:
I have two hard drives - 1 Windows, 1 Ubuntu
I want to format both of them, so I first formatted my Ubuntu one. Apparently, there must have been some GRUB files on my Windows hard drive as well, as it still attempts to load GRUB (and now I get error 17). I can't really restore GRUB from either of my hard drives because both of them are NTFS, and so I can't mount them (at least, I assume that's why).
What can I do to boot back into Windows?
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Ok so I reinstalled windows and it messed grub so i'm trying to reinstall it with a live cd. I've been trying all the methods on the master list.
http://ubuntuforums.org/showthread.php?t=24113
The thing is when I type "root (hdX,X) or whatever I can never find one that works I don't know what to choose
This is the picture of my hdd setup can someone tell me what to type because find /boot/grub/stage1" does not work.
http://img.photobucket.com/albums/v4...2/a279e0b3.png
The 51GB partition is Windows the 40GB partition is Ubuntu, the others are just NTFS Data Storage
BTW, I'm using the Edgy Eft AMD64 live CD also I can boot my ubuntu with the Super Grub Disk
-wolf
Re: HOWTO: Restore GRUB (if your MBR is messed up)
OK guys I think the thread basically lost the point after a while
therefore I am listing the problem again and letting ppl know what solved it for me.
PROBLEM: RE INSTALLING WINDOWS IN A DUAL BOOT SYSTM WIPES THE MBR and HENCE U DONT HAVE GRUB NOW TO MULTIBOOT.
SOLUTION : BOOT WITH LIVE CD
OPEN TERMINAL WINDOW
$ sudo fdisk -l
this should list all ur Hard disk
my root was /dev/hda4
then
$ SUDO GRUB
grub> root (hd0,3)
I dont know why it was hd0,3 and not hd0,4 but it worked
then
grub> setup (hd0)
grub> quit
problem fixed
always using SUDO works
hope it helps
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Hey guys,
I have a dual-boot setup of Win XP (hda1 / (hd0,0)) and Ubuntu Edgy ext3 (hda2 / (hd0,1)). extended is hda3 and linux-swap is hda5.
GRUB hung on "GRUB Loading stage1.5" a few weeks ago, with the menu never appearing, and I solved it by booting into Edgy Desktop CD and entering the following:
Quote:
ubuntu@ubuntu:~$ sudo su
root@ubuntu:/home/ubuntu# cd /mnt
root@ubuntu:/mnt# ls
root@ubuntu:/mnt# cd
root@ubuntu:~# mkdir /mnt/ubuntu
root@ubuntu:~# mount -t ext3 /dev/hda2 /mnt/ubuntu
root@ubuntu:~# chroot /mnt/ubuntu
root@ubuntu:/# grub-install /dev/hda
This originally solved the problem.
However, I experienced the same problem today and, when I entered "grub-install /dev/hda", I was confronted with the following message:
Quote:
/dev/hda: Not found or not a block device.
So I tried replacing the last line with a suggestion I found elsewhere:
Quote:
grub-install /dev/hda --root-directory=/mnt/ubuntu/boot/grub
however, this was the response:
Quote:
mkdir: cannot create directory `/mnt/ubuntu/boot/grub/boot': No such file or directory
Why has it added an extra 'boot' at the end? There are no further subdirectories within /mnt/ubuntu/boot/grub .
I then tried the following:
but I got this back:
Quote:
Error 27: Unrecognized command
and when I typed:
I got the same response. When I tried it in an attempt before this one, I think it said "Unrecognized drive" or something similar.
Incidentally, given my dual boot setup, should I have instead written, "setup(hd0,1)"? I have attached my menu.lst below.
I then tried the final suugestion I found on here.
The Edgy Alternate CD "Partition disks" sections indicates that:
Quote:
#1 primary ntfs /media/hda1
Bootable flag: on
#2 primary ext3 /media/hda2
Mount point: /media/hda2
Bootable flag: off
#5 logical swap swap
The suggestion on here seemed to say that I should change the mount point of /media/hda2 to /, and also set the bootable flag to on; but should I also leave the /media/hda1 bootable flag on as well?
Thanks,
Nick
Here is my /mnt/ubuntu/boot/grub/menu.lst:
Quote:
# 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=UUID=bfe5aabb-1181-4c09-8c06-25e4d70074c0 ro
# kopt_2_6=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
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## 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.17-10-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/hda2 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/hda2 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/hda1
title Microsoft Windows XP Home Edition
root (hd0,0)
savedefault
makeactive
chainloader +1
Is this bit:
Quote:
# 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
makeactive
chainloader +1
significant?
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Re: HOWTO: Restore GRUB (if your MBR is messed up)
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 :)
Best instructions ever. I have now saved 2 systems with this method.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Actually, scratch that...
When I use "Boot from first hard disk" from the liveCD, it works...
if I dont use a CD and try to boot from the first hard disk... it gives me Error 22: No Such Partition or something like that...
WHat gives??
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Ok looks like on this system:
Code:
Disk /dev/hda: 13.6 GB, 13676544000 bytes
255 heads, 63 sectors/track, 1662 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1662 13349983+ 7 HPFS/NTFS
Disk /dev/hdb: 122.9 GB, 122942324736 bytes
255 heads, 63 sectors/track, 14946 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 14946 120053713+ 7 HPFS/NTFS
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 2550 20482843+ 7 HPFS/NTFS
/dev/sda2 2551 38913 292085797+ f W95 Ext'd (LBA)
/dev/sda5 2551 15298 102398278+ 7 HPFS/NTFS
/dev/sda6 28047 38913 87289146 7 HPFS/NTFS
/dev/sda7 15299 16573 10241406 83 Linux
/dev/sda8 16574 27839 90494113+ 83 Linux
/dev/sda9 27840 28046 1662696 82 Linux swap / Solaris
grub was trying to boot from (2,6)
I had to edit that at boot time to be (0,6)
Not sure why it set itself up that way.