Page 100 of 103 FirstFirst ... 50909899100101102 ... LastLast
Results 991 to 1,000 of 1028

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

  1. #991
    Join Date
    May 2007
    Location
    Pleasant Hill, California
    Beans
    315
    Distro
    Ubuntu 14.04 Trusty Tahr

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

    Quote Originally Posted by 10Ten View Post
    ugh...

    any ideas? will i have to reinstall this damn liveCD AGAIN???
    No, you never need to reinstall the live CD. But, you should understand what's going on, and maybe that will be harder, although it's really not very complicated, at least it wasn't until the latest version, if you did a clean install and ended up with "GRUB 2". Installing GRUB (1) is easy, but if you have GRUB 2, I don't know how. In fact, I simply installed the original GRUB manually.

    For GRUB 1, you need two things - you need the grub files in /boot/grub, along with menu.lst, and you need the boot loader in the MBR that knows where to look for the OS and the grub files.

    If you have an existing /boot/grub/ then using the live CD to fix things is easy - all you have to do is tell GRUB where they are, and reinstall it into the MBR. This takes two commands from the grub prompt.

    You need to know what partition your root linux is on. If you only have one, it would be /dev/sda1 (first drive, first partition). But in GRUB's terminology, this is HD0,0 (no spaces).

    For me, my root drive is an extended partition, which always starts with 5, so it's /dev/sda6, the first logical partition in the extended partition.

    Here's what I do to install GRUB from the live CD (pre-9.1 version):
    Enter "sudo grub" in the terminal. Always use sudo (or an su prompt) or grub will run, but not work worth a damn!

    Code:
    grub> find /boot/grub/menu.lst
     (hd0,5)
    
    grub> root (hd0,5)
    
    grub> setup (hd0)
     Checking if "/boot/grub/stage1" exists... yes
     Checking if "/boot/grub/stage2" exists... yes
     Checking if "/boot/grub/e2fs_stage1_5" exists... yes
     Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded.
    succeeded
     Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,5)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
    Done.
    
    grub> quit
    Explanation. First, I did a find to confirm the location of my grub files, using menu.lst (because I can remember that one easily).

    The GRUB prompt is "grub>", by the way.

    Then, I told GRUB about that location, with the "root" command, installed the boot loader into the MBR with the setup command, saw that everything was OK, and entered "quit" to exit.

    That's what does it for me.

  2. #992
    Join Date
    May 2010
    Beans
    1

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

    To throw in my experience with fixing grub2 after an incident with Windows overwrote the MBR:

    Follow the chroot instructions at the beginning of this thread - mount your install partitions, and so forth.

    from the chrooted environment:

    Code:
    sudo apt-get install grub
    sudo apt-get install grub2
    sudo upgrade-from-grub-legacy
    At this point, whether you have a legacy grub install or not (I didn't), grub seems to simply bring up the upgrade screen - which will prompt you for which drive to install grub2 on if it doesn't find a legacy install. It then automatically regenerates your /boot/grub/grub.cfg file (which contains menu entries similar to those in menu.lst for the original grub). It didn't detect my Windows install, but that can't be considered a reliable indicator as my Windows install currently doesn't boot. Adding Windows to grub.cfg is fairly simple - simply add the lines (for example)
    Code:
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
            set root=(hd0,1)
            chainloader +1
    }
    ### END /etc/grub.d/30_os-prober ###
    For a Windows XP install on /dev/sda1, for example.
    Finally, a sudo grub-install, and a reboot.

    More complicated than the old way, and there are probably some unnecessary/erroneous steps involved since I did this off the top of my head, but it works (at least for me).

  3. #993
    Join Date
    Jul 2009
    Beans
    8

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


  4. #994
    Join Date
    Apr 2010
    Beans
    1

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

    grub> find /boot/grub/grub.cfg
    (hd0,7)

    grub> root (hd0,7)

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

    Error 15: File not found

    please help me how to fix this problem

  5. #995
    Join Date
    Sep 2007
    Location
    Thurgoona, NSW, Australia
    Beans
    287
    Distro
    Ubuntu

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

    Quote Originally Posted by swamy2712 View Post
    grub> find /boot/grub/grub.cfg
    (hd0,7)

    grub> root (hd0,7)

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

    Error 15: File not found

    please help me how to fix this problem
    Some more details please:

    Which version of Ubuntu?
    Is it GRUB 1.97? (looks like it - which one do you want to install?)
    Do you only have one hdd?
    Are you dual booting?

    Stick with it, you're only just beginning to have fun

  6. #996
    Join Date
    Aug 2008
    Beans
    16

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

    Thanks for the edits at the top of this long thread! Much appreciated. Silly me, forgot that the disk might not have been mounted.

    Gods of Linux indeed...............

    Have fun!

    EDIT:::
    I had to edit the syntax at the loader because for some reason it had chosen (hd0,2) instead of (hd0,5) - coincidental that I had the same setup as the OP's edit. Got into 10.04 and from there changed <menu.lst>. That killed XP. So, back into <menu.lst> and see what was wrong. It was still looking for the old drive! Removed the "map" lines and back in action. R.
    :::END
    Last edited by OzRattler; June 7th, 2010 at 01:38 AM.

  7. #997
    Join Date
    Mar 2010
    Beans
    337
    Distro
    Ubuntu

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

    Im gonna print this for future reference thanks!
    This is Linux. It gives you a cute mascot and enough rope to hang yourself!

  8. #998
    Join Date
    Jun 2010
    Beans
    1

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

    This procedure worked for me hope this works to you..

    find the "sda (number)" where you have installed ubuntu (previously installed).

    To find it goto System -> Admin -> gparted (only using live-cd)
    here you find the sda (number) for linux ex: sda7 or sda4 .....

    Assuming you were previousely installed ubuntu in sda5

    in command prompt type ( Application ->accessories->terminal)

    sudo mkdir /media/sda5
    sudo mount /dev/sda5 /media/sda5

    sudo grub-install --root-directory=/media/sda5 /dev/sda


    it shows installation finished. No error reported.

    reboot the system.

  9. #999
    Join Date
    Dec 2008
    Beans
    36

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

    Well my Grub is definitely busted

    I tried all the tips here, no go

    Given the amount of errors I was getting while backing up my files,
    I think my harddrive is on the fritz.

  10. #1000
    Join Date
    May 2007
    Location
    Pleasant Hill, California
    Beans
    315
    Distro
    Ubuntu 14.04 Trusty Tahr

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

    Quote Originally Posted by swiftwood View Post
    Well my Grub is definitely busted

    I tried all the tips here, no go

    Given the amount of errors I was getting while backing up my files,
    I think my harddrive is on the fritz.
    Was there some reason you posted this? I didn't see a request for help, nor did I see any kind of added information, unless I'm unaware that everyone else has been waiting to hear the status of your hard drive.

Page 100 of 103 FirstFirst ... 50909899100101102 ... 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
  •