Page 5 of 103 FirstFirst ... 345671555 ... LastLast
Results 41 to 50 of 1028

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

  1. #41
    Join Date
    Mar 2006
    Location
    Boston, MA
    Beans
    1,861
    Distro
    Ubuntu 6.10 Edgy

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

    Raid has become a big problem. Grub just has a problem identifying the correct mbr (or so it appears). You can try one more thing. Don't bother with find /boot/grub/stage1. Just run the root and setup commands. The only thing is you have to know which partition your ubuntu installation is on. If you know the partition then try it with just root and setup.
    There are other methods to try as well.
    You could also try the grub super disk. This is the download site.
    http://adrian15.raulete.net/grub/tiki-index.php
    This is a tutorial on it.
    http://users.bigpond.net.au/hermanzo...bDiskPage.html

    There is also GAG. It is another bootloader. Here is it's site. http://gag.sourceforge.net/
    This is another one of Hermans guides. It is about gag.
    http://users.bigpond.net.au/hermanzone/p12.htm

    If you feel like a little research, here is grub's manual http://www.gnu.org/software/grub/manual/grub.html

  2. #42
    Join Date
    Aug 2006
    Location
    Asheville NC
    Beans
    32
    Distro
    Ubuntu 6.06

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

    Dear Catlett,

    I sure appreciate your expertise in this area and your willingness to share it. I've been fighting this problem for 3 days now. I've been posting to my lug, googling, reading some of the ubuntu forum posts, and your post is definitely the closest to my problem. I'm working from the Dapper Live CD.

    A little historical background: This computer originally came with Windows XP Home Edition about 3 years ago. As soon as I got it home I immediately removed Windows and installed Linux. A couple years ago I had to recover the HD and the recovery cd's reinstalled Windows. However, I never used Windows on it until the other day. I had what seemed like a hardware problem with my ethernet card not letting me connect to the Internet. Remembering that I had Windows on the computer, I decided to see if Windows had the same problem with the network card. Sure enough, it did. So I installed another ethernet card. Unfortunately, one time while fiddling with the cables behind the computer I bumped the power cord while the computer was booted into Windows. When I put the cord all the way back in, it seems that Windows automatically "fixed" the MBR and now the computer only boots to Windows.

    Here are my partitions:

    hda1 - MBR FAT32
    hda2 - Windows NTFS
    hda3 - Linux swap (This placement because suggested Windows will sometimes write a little beyond its partition limits. Placing swap here prevents Windows from overwriting the beginnings of a Linux install or data partition.)
    hda4 - extended partition pointers
    hda5 - /boot ext2
    hda6 - previous install (no longer used) ext3
    hda7 - current Ubuntu Dapper install ext3
    hda8 - /home ext3

    /boot on hda6 and hda7 point to hda5
    /home on hda6 and hda7 point to hda8

    What I've done so far:

    sudo grub-install /dev/hda
    sudo grub-install /dev/hda1
    sudo grub-install /dev/hda5
    sudo grub-install hd0

    All returned: "Could not find device for /boot: Not found or not a block device."

    "sudo fdisk -l" listed hda2 as the boot partition.

    So I did:

    "sudo fdisk /dev/hda"

    followed by "a" Enter, "1" Enter, "w" Enter, then turned off the computer and restarted. (Just rebooting did not work.) It put an * in the boot column for both hda1 and hda2. I retried the "sudo grub-install hd*" commands, and still got "Could not find device for /boot: Not found or not a block device."

    So, I tried "sudo grub" followed by "find /boot/grub/stage1" which returned, "Error 15: File not found."

    I mounted the ubuntu partition using "sudo mount -t ext3 /dev/hda7 /mnt/ubuntu". I mounted proc and udev like tosk described and chrooted:

    sudo mount -t proc none /mnt/ubuntu/proc
    sudo mount -o bind /dev /mnt/ubuntu/dev
    sudo chroot /mnt/ubuntu bin/bash

    They all seemed to work fine. Then, when I tried "sudo grub" I got:

    sudo: unable to lookup ubuntu via gethostbyname()

    I tried chrooting to /mnt/boot, where hda5 is mounted but got:

    chroot: cannot run command `/bin/bash': No such file or directory

    grub> root (hd0,4)
    Filesystem type is ext2fs, partition type 0x83

    grub> setup (hd0)
    Checking if "/boot/grub/stage1" exists... no
    Checking if "/grub/stage1" exists... no

    Error 15: File not found

    Also, fwiw, I cannot read the files in the mounted hda5 with nautilus or gedit, but gparted shows they are still there. It is possible that hda5 is corrupted.

    So, I'm still running from the Live CD. If I try to boot from the hard drive, it goes directly to Windows.

    My first preference would be to be able to boot from grub, even if it means not being able to boot Windows. My second preference would be for the Windows boot loader to give me the option to boot Ubuntu.

    In the meantime, if I could even use the Live CD to boot the Ubuntu distro that's on my hard drive, that would be a big step forward. My floppy drive does not work, nor does the CD writer, so making a boot floppy or a boot CD is not an option.

    Is it possible to install grub to the hd using apt-get or some other command from the Live CD? Maybe only stage1 is needed. The CD seems to contain grub. Can stage1 just be made with gedit or pasted in from a post?

    If you notice what seems to be a range of some rather sophisticated pieces mixed in with some noob sounding questions or thinking, it is because I had some help in some of the setup. I am only part geek, myself.

    Any help would sure be appreciated. I sure miss my usual Ubuntu setup and all my files.

    Thanks.

    P.S. I notice you're in Boston. I was bon and raised in Woosta.

  3. #43
    Join Date
    Mar 2006
    Location
    Boston, MA
    Beans
    1,861
    Distro
    Ubuntu 6.10 Edgy

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

    I would recomend the super grub disk but making any kind of boot disk is out of the question. There are a couple of things to do though. One you could try booting from the windows bootloader. I never did this but there are a couple of how tos, crap I forgot they need a floppy.

    You could try to chroot into your root partition. NEVERMIND.. You tried that and got an error.

    Before you go any farther, I would install the ext2 driver for windows, if you haven't already. http://www.fs-driver.org/ Copy anything important to a flash drive or upload it to a file hosting site http://s7.quicksharing.com/ (just in case you loose the ability to boot altogether) and then you can try 2 things.

    You could try apt-get. I never apt-get installed grub from a live cd. I do not know what it does. Hopefully it will put grub's file's somewhere so you can use them for the setup (hd0).
    If that doesn't work, you can try apt-get install lilo. Lilo, as you know, was the first linux bootloader. Again I never installed it from a live cd. They are both in synaptic but I do not know the effect of using a live cd. Maybe you can get lucky and it will let you select where you want to install grub and you can choose your mounted partition.

    If you have important data, then the safest way is to use windows with the ext2 driver. Upload/copy off all important data and reinstall ubuntu from an installation cd. Now that I think of it, if you are going to reinstall, you only have to copy data to your windows parttitionm with the ext2 driver because the installer will leave that partition alone.

    I know this is a bit rambling, I've been thinking and writing at the same time. To sum it up, your only options appear to be using spt-get from the liove cd to install grub or lilo.
    The safe way would be to get your data off the computer and re-install ubuntu.
    Do you have an installation disk? If you don't, pm me with your address and I'll mail one out to you. Ship-It sent me 5 so I have a few extra to spare. I only mention it because you don't have the ability to download abd burn an iso and ship-it takes a month.
    Let me know.

    P.S. This is the old grub restore How To for ubuntu. I never liked it and it is the reason I posted this one but it may help you. If you have an installation disk, you can try this. I do not know if this matters but this how to was originally made during Breezy and using the 5.10m install disk, I think you can get the results from any install disk but I just wanted to mention it. http://doc.gwos.org/index.php/Restore_Grub


    ONE MORE THING. I was just looking at your chroot error. try chrooting without the !bin/bash. I was just searhing for gub restore and I found the old how to and it had a reply about chroot. It did not mentiuon ! bin/bash. Maybe it will work without adding it.
    Last edited by catlett; August 27th, 2006 at 10:38 PM.

  4. #44
    Join Date
    Aug 2006
    Location
    Asheville NC
    Beans
    32
    Distro
    Ubuntu 6.06

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

    Thanks for your quick reply. The Live CD I'm using does have an install option. I'm hesitant to reinstall, though, because I have added a LOT of extra packages and I don't want to have to reinstall them. I tried doing apt-get from the CD. I used post # 3 from this thread as a guideline:

    http://ubuntuforums.org/showthread.php?t=223975

    It said:

    Or... use a Ubuntu live CD on your computer with a faster connection. Let's say you wanted to install alien, kword, and epiphany.

    Boot up the live CD on the faster connection computer. Then go to the terminal and type in

    Code:

    sudo apt-get clean sudo aptitude update sudo aptitude install kword epiphany-browser alien

    Then go to /var/cache/apt/archives and copy all the .deb files to a USB key or iPod or some external drive.

    Then copy those .deb files to the other computer's desktop and then

    Code:

    cd ~/Desktop sudo dpkg -i *.deb

    I tried this for grub, but when I went to /var/cache/apt/archives there were no .deb files there to copy. If they were there, I would have just copied them to the mounted partition of my ubuntu distro on my hd.

    So, the suggestion you posted at http://doc.gwos.org/index.php/Restore_Grub seemed like a good idea. I tried it, but when I got to step 4, it wanted a mount point for everything, not just / /boot and swap. I gave mount points for them all and finished step 5. Then, instead of going to step 6 and asking me to save, it said it was now going to install. I'm hesitant to go that far without more assurance that it won't really install.

    Any pointers?

    How about a way to boot to my ubuntu distro on my HD from the install CD?
    Yours in peace,

    Jerryc
    http://innerpeace.org

  5. #45
    Join Date
    Mar 2006
    Location
    Boston, MA
    Beans
    1,861
    Distro
    Ubuntu 6.10 Edgy

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

    I didn't look at the link but if you want a deb for grub, go to the Dapper packages site and download the deb http://packages.ubuntu.com/dapper/admin/grub

    I do not knmow about the dependencies or if that is it.
    You can get any ubuntu package here http://packages.ubuntu.com/

  6. #46
    Join Date
    Aug 2006
    Location
    Asheville NC
    Beans
    32
    Distro
    Ubuntu 6.06

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

    It got me the deb, thanks. I downloaded it and copied it into where I have my ubunto distro mounted on my hard drive, but running
    sudo dpkg -i --root=/mnt/ubuntu grub_0.97-1ubuntu9_i386.deb
    still didn't seem to make a stage1 file anywhere.

    I know you never liked the old grub restore, and it does seem a little like an overkill, but might there be some script that would restore grub without risking installing a whole new distro?

    Also, is there a way to use the install CD to boot a distro that's already installed on the HD?
    Yours in peace,

    Jerryc
    http://innerpeace.org

  7. #47
    Join Date
    Mar 2006
    Location
    Boston, MA
    Beans
    1,861
    Distro
    Ubuntu 6.10 Edgy

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

    Do you know what partition holds ubuntu's root? For sake of arguement let's say it is on (hd0,2). Try running it without the find command and go right to root and setup. Can't hurt to try.
    Code:
    sudo grub
    at grub<
    Code:
    root (hd0,2)
    Code:
    setup (hd0)
    Code:
    quit
    What does that do? Also did you chroot without bin/bash?

  8. #48
    Join Date
    Aug 2006
    Location
    Asheville NC
    Beans
    32
    Distro
    Ubuntu 6.06

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

    Good try, catlett, but when I do setup (hd0), I get the same error message as I did when I tried to do setup after making hda5 the root
    Checking if "/boot/grub/stage1" exists... no
    Checking if "/grub/stage1" exists... no

    Error 15: File not found
    Even without putting /bin/bash on the end of chroot, I get that error message. It is the default of chroot.

    I have figured out that hda5 was either corrupted or reformatted somehow. So, I mounted /dev/hda5 on /mnt/ubuntu/boot, and did
    dpkg -i --root=/mnt/ubuntu --force-overwrite
    for both grub and the latest kernel. That did put something meaningful into my /boot partition. However, there is still no file called stage1.
    Yours in peace,

    Jerryc
    http://innerpeace.org

  9. #49
    Join Date
    Mar 2006
    Location
    Boston, MA
    Beans
    1,861
    Distro
    Ubuntu 6.10 Edgy

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

    since it is a partition issue, Azz's gparted recovery method may help. The live cd should have gparted but if not just apt-get install gparted.

    Here is the link, hope it somehow helps http://www.ubuntuforums.org/showthread.php?t=226836

  10. #50
    Join Date
    Aug 2006
    Location
    Asheville NC
    Beans
    32
    Distro
    Ubuntu 6.06

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

    Dear catlett,

    I got it working.

    To recap from some earlier posts and update, I have a separate /boot partition that seems to have gotten corrupted by a Windows recovery boot. A more detailed description of my system and what I tried that did not work is here: http://ubuntuforums.org/showpost.php...9&postcount=42

    Here's what worked to restore grub using only the Live/Install CD to access the problem hard drive. No other drives, floppies, pen drives, or other CD's were used.

    1. Made a new directory under /mnt as a mountpoint for mounting the ubuntu root partition
    Code:
    sudo mkdir /mnt/ubuntu
    Explanation: The live cd does not automatically mount your hard drive. You have to do this manually, partition by partition.

    2. Mounted the ubuntu root partiton
    Code:
    sudo mount -t ext3 /dev/hda7 /mnt/ubuntu
    3. Mounted the boot partition to the boot directory of the mounted ubuntu root
    Code:
    sudo mount -t ext2 /dev/hda5 /mnt/ubuntu/boot
    Explanation: This mounts the boot partiton in the same place it would be mounted if the hard drive were booted to the ubuntu distro installed on hda7.

    4. Changed to the package archives directory.
    Code:
    cd /var/cache/apt/archives
    Explanation: This is where the latest kernel package would be.

    5. Found the latest kernel image.
    Code:
    ls -l linux*
    6. Forced a kernel install into the /boot partition.
    Code:
    sudo dpkg -i --root=/mnt/ubuntu --force-overwrite linux[XXX].deb
    Explanation: Running dpkg on a kernel package places the kernel image into the /boot directory. In this case, since the /boot directory of the mounted ubuntu root is really the /boot partition mounted on the mounted ubuntu root, the kernel ends up in the /boot partition.

    7. Since the previous item gave some notification of grub errors, downloaded the latest grub .deb file, then did a force install of the grub package.
    Code:
    sudo dpkg -i --root=/mnt/ubuntu --force-overwrite grub[XXX].deb
    8. Said yes when asked to have a menu.lst file created.

    9. Repeated step 6. This time there were no grub errors reported. It is possible that reversing steps 6 and 7 would have avoided this step.

    10. Ran grub-install to the device, not the partition, using the mounted ubuntu partition as the root directory.
    Code:
    sudo grub-install --root-directory=/mnt/ubuntu /dev/hda
    This also created the previously missing stage1 file, the lack of which was preventing earlier attempts to fix grub from working.

    Note. This did not work an earlier time when the boot partition was not mounted on /boot of the mounted root partition.

    I also believe that using the
    Code:
    --root-directory=[path to your mounted root directory]
    option is critical with using this command from the live CD. Others have reported that this command does not work from the live CD. It should work fine if you use this option.

    11. Used
    Code:
    sudo gedit
    to edit the root line of /mnt/ubuntu/boot/grub/menu.lst from (hd0,0) to (hd0,4).

    NOTE_0,0 (note_a1): If a boot partition exists (as in this case), use its location instead of the location of the root partition. This can be confusing because it is asking for the root location and you are answering with the boot location. On many systems they are the same, but not if you have a /boot partition.

    NOTE_0,1 (note_a2): There are two counting systems. The alphabetized system, e.g.: hda, hdb, etc, begins counting partitions at 1, whereas the numerical system, e.g.: hd0, hd1, etc, begins counting partitions at 0. So, for example, in this case, the boot partition, hda5, is hd0,4.

    NOTE_0,2 (note_a3): I realize now that, at this point, I could have used sudo grub and followed the instructions in catlett's opening post to this thread http://ubuntuforums.org/showpost.php...95&postcount=1 to set the root partition, since I now had a stage1 file. I had tried it before I had a stage1 file and that solution wasn't working because it couldn't find the stage1 file. Because step 10 created the missing stage1 file, catlett's solution would probably have worked at this point, but I didn't think of it at the time.

    NOTE_0,3 (note_a4):At some time in the future, I can edit the meun.lst for more choices, such as to my alternate distro on hda6, booting to a command prompt, or even booting to Windows (if I ever wanted to do that again).

    12. Shut the computer completely down. When doing major changes, particularly when dealing with booting issues, I have found that changes stick more often than when just rebooting. YMMV.

    13. Restarted.

    14. Logged onto this site to share what worked and express my gratitude.

    While this might not be the most elegant way to restore grub, the bottom line is that it did work. I'm so glad to be back up on my usual system with all my programs, settings and files. Thanks for all your help. Thanks to the folks in my local LUG who helped, too.
    Last edited by jerry_c; August 30th, 2006 at 06:32 AM. Reason: clarification
    Yours in peace,

    Jerryc
    http://innerpeace.org

Page 5 of 103 FirstFirst ... 345671555 ... 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
  •