Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old October 15th, 2005   #1
arnieboy
Guest
 
Beans: n/a
HOWTO: Restore GRUB (if your MBR is messed up)

Written by vnbuddy2002

Restoring GRUB is quite simple in Ubuntu. Instead of going through all the "gain root access" and playing with shell commands, you can use the Ubuntu installation CD to restore it without going through all kinds of hassles.

Here are the steps:

1. Boot your computer up with Ubuntu CD
2. Go through all the process until you reach "[!!!] Disk Partition"
3. Select Manual Partition
4. Mount your appropriate linux partions

/
/boot
swap
.....

5. DO NOT FORMAT THEM.
6. Finish the manual partition
7. Say "Yes" when it asks you to save the changes
8. It will give you errors saying that "the system couldn't install ....." after that
9. Ignore them, keep select "continue" until you get back to the Ubuntu installation menu
10. Jump to "Install Grub ...."
11. Once it is finished, just restart your computer

Good luck!.

Last edited by arnieboy; June 5th, 2006 at 06:18 PM..
  Reply With Quote
Old October 16th, 2005   #2
yesplease
Gee! These Aren't Roasted!
 
Join Date: Aug 2005
Beans: 205
Re: HOWTO: Restore GRUB (if your MBR is messed up)

Just an alternative: you can put Grub on floppy.

I used the method above when something went wrong during my first install (hoary hedgehog). This made me very careful, so at point 10 I choose to put Grub on floppy.

Edit: I tried this in Breezy and it didnt work for me (dont know why, it could be me, the hardware, or even breezy). This method did work in Breezy:

Boot from install CD, at the boot promt type: rescue
Follow some simple instructions (such as type the host name of your computer) and you wil get a menu where you can choose to a partition to mount.

The root partition of ubuntu is the first partition on my second hard disk, so I choose /dev/discs/disc1/part1.

At the prompt (sh-3.00#) I typed: ls
This produced a list of directories, such as boot, that convinced me that I mounted the right partition.

Mount the floppy disk: mount /dev/fd0
Install Grub on the floppy disk: sudo grub-install "(fd0)"
including the qoute signs.

Note: you can also chose the appropiate partition of your hard disk in case you want to restore your mbr.

The response was:
contents device map /bot/grub/device.map
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
asking if this was correct.
I typed exit at the prompt because this was correct: ubuntu is on the 2nd sata disk (/dev/sdb).

In the BIOS I put floppy as first boot device and could boot from foppy again.

Note: if you need to edit device.map you need a different tutorial. My floppy was already formatted.

This tutorial looks solid:
http://www.yolinux.com/TUTORIALS/Lin...sk.html#RESCUE

I still am booting from floppy because, if necessary, I can reinstall windows and it wont overwrite grub.

This setup survived a dist-upgrade from hoary to Breezy; the entries for Breezy were added to the floppy automatically.

I have two hard disks, one for windows and one for Ubuntu, but this should work with one hard disk as well. I suppose you can also use a bootable memory stick.

Windows wants to be one the first partition on the first hard disk. I did not have to edit grub with the map option to make the windows think it is on the first disk. Windows is on the first hard disk because that is the sequence set in the BIOS. (When you boot from floppy it must be first in the BIOS boot sequence.)

Note that this setup is not necessary for security, I just find it convienient.

Last edited by yesplease; October 20th, 2005 at 12:37 PM..
yesplease is offline   Reply With Quote
Old October 16th, 2005   #3
cbudden
Has an Ubuntu Drip
 
Join Date: Aug 2005
Beans: 430
Hardy Heron (Ubuntu Development)
Send a message via AIM to cbudden Send a message via MSN to cbudden Send a message via Yahoo to cbudden Send a message via Skype™ to cbudden
Re: HOWTO: Restore GRUB (if your MBR is messed up)

Would you explain how to put grub on a floppy?
cbudden is offline   Reply With Quote
Old October 16th, 2005   #4
yesplease
Gee! These Aren't Roasted!
 
Join Date: Aug 2005
Beans: 205
Re: HOWTO: Restore GRUB (if your MBR is messed up)

Quote:
Originally Posted by cbudden
Would you explain how to put grub on a floppy?
I edited the 2nd post in this tread to include this.

Last edited by yesplease; October 19th, 2005 at 05:25 PM..
yesplease is offline   Reply With Quote
Old October 27th, 2005   #5
Curlydave
Dipped in Ubuntu
 
Join Date: May 2005
Location: Va, USA
Beans: 475
Re: HOWTO: Restore GRUB (if your MBR is messed up)

After reinstallign Windows, GRUB is gone. I tried following your instructions, but I cannot get past step 4. How do you mount the partitions? If I go to the Install Grub part of the menu, it just puts me back to the partition manager, and if I hit enter, save changes after selecting my ubuntu partition, it says that it can't find root file system and won't let me continue. How do I put GRUB back?
Curlydave is offline   Reply With Quote
Old October 27th, 2005   #6
arnieboy
Guest
 
Beans: n/a
Re: HOWTO: Restore GRUB (if your MBR is messed up)

Quote:
Originally Posted by Curlydave
After reinstallign Windows, GRUB is gone. I tried following your instructions, but I cannot get past step 4. How do you mount the partitions? If I go to the Install Grub part of the menu, it just puts me back to the partition manager, and if I hit enter, save changes after selecting my ubuntu partition, it says that it can't find root file system and won't let me continue. How do I put GRUB back?
u have to set your ubuntu partition as "/" (or the root partition ---> please dont confuse this with /root which is the directory for the root user)
  Reply With Quote
Old October 28th, 2005   #7
Biffy
Way Too Much Ubuntu
 
Join Date: Feb 2005
Beans: 209
Re: HOWTO: Restore GRUB (if your MBR is messed up)

Yes, but how do you mount your partition like that? Tell us how you do that from the partitioning menu.
Biffy is offline   Reply With Quote
Old October 28th, 2005   #8
yesplease
Gee! These Aren't Roasted!
 
Join Date: Aug 2005
Beans: 205
Re: HOWTO: Restore GRUB (if your MBR is messed up)

When you step through the instructions, you will arrive at the partition manager. There you will see that all partitions got general names like /media/hda1, or something like that. Now you have to mount those partitions.

Select a partition and go to the partition description table (by pressing enter, I think). Select each line in this table and select the correct entry. For example: my root partition is used as ext3, mount point is / and bootable flag must be on. Be sure that you leave the data on the partition (there is an entry for that). Do this for all partitions. (I have / , swap and /home, and you may also have a NTFS partition for WinXP.)

During this proces nothing is changed, so you can always abort if you are not sure.
yesplease is offline   Reply With Quote
Old October 29th, 2005   #9
Curlydave
Dipped in Ubuntu
 
Join Date: May 2005
Location: Va, USA
Beans: 475
Re: HOWTO: Restore GRUB (if your MBR is messed up)

Hmm, still can't get it mounted or figureu out how to set it up as "/". If I hit enter on a partition, I get some basic settings, like the option for a boot flag, to wipe it or not etc, but there is no mount or place to put "/". If i hit save after that I get the no root file system error and I can't put on GRUB. Let's say I'm a computer nub who needs basic step-by-step instructions. How do I get from the partition manager to the install-grub section without erasing my partition. (I know how to do it that way, but I can't get it working this way while saving the partition.)
Curlydave is offline   Reply With Quote
Old October 30th, 2005   #10
yesplease
Gee! These Aren't Roasted!
 
Join Date: Aug 2005
Beans: 205
Re: HOWTO: Restore GRUB (if your MBR is messed up)

@ Curlydave: Select the partition where / should be, and go to the 'basic settings'. Select the entry 'mount point' and select '/'. Perhaps you should scroll up or down to see it?

From my notes: root partition; use as Ext3, format no, mount point /, mount options default, bootable flag on, size x GB.

Swap partition; use as swap, bootable flag off, size (less than 2 GB). It doesnt matter when swap gets formatted.


home partition; no notes, there is only one way to do it.

Remark: /usr is not a user partition.
yesplease is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:19 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry