LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   lost grub (https://www.linuxquestions.org/questions/linux-general-1/lost-grub-792706/)

greenknight 03-02-2010 03:28 PM

lost grub
 
Today I was forced to reformat windoze and of course lost grub so I can't boot ubuntu 9.10. I found two suggestions in previous posts which didn't work. One suggested using the install disk as a rescue disk and as root run grub. I entered sudo grub and the cmd was accepted but the cmnd grub was not found.
The second was to sudo grub -install and again grub was not found. Both these suggestions were for a win 98/mandrake installation.
Do I have to reinstall ubuntu? If so there is a problem in partitioning. Setup sees there is already an ubuntu os on the disk. In fact two of them. I forget why, but I reinstalled ubuntu and ended up with two in the grub menu. I was advised not to try to repair grub and didn't. Now I have two and it thinks I want to put the third one side by side, or erase and use the entire disk. There was a third choice but I forgot already exactly what it was and didn't like it anyway. If I erase and use the entire disk, won't I lose windoze? If I put them side by side I will then have three which which will waste disc space. The discs aren't that big being only about 10gb. I don't think I want to waste the space with a third ubuntu.


ps The prompt in terminal was ubuntu @ ubuntu.

smoker 03-02-2010 03:40 PM

Use the rescue disk, you don't need sudo if you are already root.

raju.mopidevi 03-02-2010 03:47 PM

* You can try re-installing the grub using the Ubuntu Live CD, in two different ways.

GUI

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

Command line

1. Boot your computer up with Ubuntu CD
2. Open a terminal window or switch to a tty.
3. Go SuperUser (that is, type "sudo -s"). Enter root passwords as necessary.
4. Type "grub"
5. Type "find /boot/grub/stage1". You'll get a response like "(hd0,1)". Use whatever your computer spits out for the following lines.
6. Type "root (hd0,1)", or whatever your hard disk + boot partition numbers are for Ubuntu.
7. Type "setup (hd0)", to install GRUB to MBR, or "setup (hd0,1)" or whatever your hard disk + partition nr is, to install GRUB to a partition.
8. Quit grub by typing "quit".
9. Reboot and remove the bootable CD.

IconsPage/IconNote.png If you can't boot into any of your Linux OSs:
First, you need to get a grub prompt (grub>) somehow. So what you can do is:

* Use a rescue disk, like Super Grub Disk, from which you can boot into your OS, or press the “c” key to get a GRUB prompt.
* Use your Live *ubuntu CD. Boot into the LiveCD. Now get a terminal and proceed exactly as in Case 1, starting with sudo grub to get a GRUB prompt. Note: grub is not included with 9.10 Ubuntu LiveCD

greenknight 03-02-2010 07:02 PM

Quote:

Originally Posted by smoker (Post 3883107)
Use the rescue disk, you don't need sudo if you are already root.

Will try in morning. I questioned wether I was root because the prompt didn't mention it. Maybe it is a thing with the rescue disk.
There is so much to learn with this linux, but I am enjoying it more each day. Glad qa is here.

cmdln 03-02-2010 07:22 PM

When You use sudo it was using your PATH. Without looking I suspect grub is in /use/sbin or /sbin. You could use sudo and specify the full path to grub.

smoker 03-02-2010 08:29 PM

AFAIK the rescue mode when booting off the disk gives you a single user environment - i.e. root.
You don't need sudo.

jallan6977 03-03-2010 10:58 AM

I was following the first procedure to go to the partition manager and found this after selecting the manual partitioning. It looks a hell of a lot like my current setup. Is there a way select to use it and not check any formatting options. Even if I need to copy it it would be easier than me trying to mount partitions because I am definitely not at all familiar with Linux partitioning. I barely know how to do it in windows.

type format
/dev/sda
/dev/sda1 ntfs y/n
/dev/sda5 ext4 "
/dev/sda6 ext4 "
/dev/sda7 swap "
/dev/sda8 swap "
/dev/sdb
/dev/sdb1 ext4 "
/dev/sdb5 swap "


Quote:

Originally Posted by raju.mopidevi (Post 3883119)
* You can try re-installing the grub using the Ubuntu Live CD, in two different ways.

GUI

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

Command line

1. Boot your computer up with Ubuntu CD
2. Open a terminal window or switch to a tty.
3. Go SuperUser (that is, type "sudo -s"). Enter root passwords as necessary.
4. Type "grub"
5. Type "find /boot/grub/stage1". You'll get a response like "(hd0,1)". Use whatever your computer spits out for the following lines.
6. Type "root (hd0,1)", or whatever your hard disk + boot partition numbers are for Ubuntu.
7. Type "setup (hd0)", to install GRUB to MBR, or "setup (hd0,1)" or whatever your hard disk + partition nr is, to install GRUB to a partition.
8. Quit grub by typing "quit".
9. Reboot and remove the bootable CD.

IconsPage/IconNote.png If you can't boot into any of your Linux OSs:
First, you need to get a grub prompt (grub>) somehow. So what you can do is:

* Use a rescue disk, like Super Grub Disk, from which you can boot into your OS, or press the “c” key to get a GRUB prompt.
* Use your Live *ubuntu CD. Boot into the LiveCD. Now get a terminal and proceed exactly as in Case 1, starting with sudo grub to get a GRUB prompt. Note: grub is not included with 9.10 Ubuntu LiveCD



All times are GMT -5. The time now is 11:46 PM.