Page 11 of 103 FirstFirst ... 9101112132161 ... LastLast
Results 101 to 110 of 1028

Thread: How to install Grub from a live Ubuntu cd.

  1. #101
    Join Date
    Jan 2007
    Beans
    5
    Distro
    Ubuntu 6.10 Edgy

    Re: How to install Grub from a live Ubuntu cd.

    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...

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

  2. #102
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu 6.06 Dapper

    Re: How to restore Grub from a live Ubuntu cd.

    Quote Originally Posted by catlett View Post
    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)

    Code:
    sudo grub
    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)

    Code:
    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

    Code:
    setup (hd0)
    Finally exit the grub shell
    Code:
    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/man...-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)

    Code:
    sudo mkdir /mnt/root
    Code:
    sudo mount /dev/xxx? /mnt/root
    Code:
    sudo chroot /mnt/root
    Code:
    sudo mount -a   ##this will auto-mount other fstab listed partitions
    
    Code:
    sudo grub
    Code:
    grub> find /boot/grub/stage1
    Code:
    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)

    Code:
    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)

    Code:
    grub> quit
    This worked for me!!!!

  3. #103
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu 6.06 Dapper

    Re: How to restore Grub from a live Ubuntu cd.

    Quote Originally Posted by catlett View Post
    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)

    Code:
    sudo grub
    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)

    Code:
    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

    Code:
    setup (hd0)
    Finally exit the grub shell
    Code:
    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/man...-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)

    Code:
    sudo mkdir /mnt/root
    Code:
    sudo mount /dev/xxx? /mnt/root
    Code:
    sudo chroot /mnt/root
    Code:
    sudo mount -a   ##this will auto-mount other fstab listed partitions
    
    sudo grub

    Code:
    grub> find /boot/grub/stage1
    Code:
    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)

    Code:
    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)

    Code:
    grub> quit
    This worked for me!!!!

  4. #104
    Join Date
    Jan 2007
    Beans
    1

    Re: How to install Grub from a live Ubuntu cd.

    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???

  5. #105
    Join Date
    Dec 2006
    Beans
    8
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: How to install Grub from a live Ubuntu cd.

    Quote Originally Posted by Firedog View Post
    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.

  6. #106
    Join Date
    Jan 2007
    Beans
    2

    Re: How to install Grub from a live Ubuntu cd.

    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?

  7. #107
    Join Date
    Nov 2005
    Beans
    6

    Re: How to install Grub from a live Ubuntu cd.

    great post, saved me hours of digging through old debian netinst cds' thanks

  8. #108
    Join Date
    Nov 2005
    Location
    Taunton, England
    Beans
    931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to install Grub from a live Ubuntu cd.

    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!
    sudo make me a sandwich

  9. #109
    Join Date
    Sep 2006
    Beans
    11

    Re: How to install Grub from a live Ubuntu cd.

    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! so now i cant get into windows or linux!!

    any help would be very much appreciated

    Hanna

  10. #110
    Join Date
    Sep 2006
    Beans
    11

    Re: How to install Grub from a live Ubuntu cd.

    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
    Last edited by hannav85; February 6th, 2007 at 03:48 PM. Reason: found solution

Page 11 of 103 FirstFirst ... 9101112132161 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •