Results 1 to 9 of 9

Thread: [SOLVED] changing grub from another os back to ubuntu

  1. #1
    Join Date
    Nov 2007
    Beans
    460

    [SOLVED] changing grub from another os back to ubuntu

    So I tried to install Debian again and cant boot it. It now owns grub.

    How can I get the Ubuntu grub as the default?

    Note this is not the same as editing /boot/grub/menu.lst to pick which one loads first, but is an issue with getting the grub from ubuntu to be the default from which to choose os's

    In other words,, the grub from ubuntu was overwritten when I installed debian. I cannot edit this because I cant get debian to boot. So I want ubuntu's grub to be the loader vs debians

  2. #2
    Join Date
    Jan 2008
    Beans
    333

    Re: changing grub from another os back to ubuntu

    You'll have to boot from a liveCD
    mount your ubuntu file system and
    reinstall grub

    something like this:
    Code:
    sudo mount -t ext3 /dev/sda2 /mnt
    sudo grub-install --recheck --root-directory=/mnt /dev/sda
    Last edited by anystupidname; October 6th, 2008 at 05:33 PM.

  3. #3
    Join Date
    Nov 2007
    Beans
    460

    Re: changing grub from another os back to ubuntu

    thanks,,I will give it a go when I get home tonight.

  4. #4
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: changing grub from another os back to ubuntu

    If you are able to boot into ubuntu from the current grub, do that, and run
    Code:
    sudo grub-install
    If not, use anystupidname's suggestion, though you'll need sudo in front of those commands.

  5. #5
    Join Date
    Nov 2007
    Beans
    460

    Re: changing grub from another os back to ubuntu

    I still can boot into ubuntu,geirha after sudo grub-install do I do what anystupidname says?

  6. #6
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: changing grub from another os back to ubuntu

    sudo grub-install run from ubuntu should reinstall ubuntu's grub, so that should be enough.

    However I see that command was incomplete, you need to specify the harddrive to install on too, so
    Code:
    sudo grub-install /dev/sda

  7. #7
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: changing grub from another os back to ubuntu

    Using "grub-install" is not necessary unless you don't have Grub's files in place in the /boot/grub directory, which is not your case; it could work for you, but it is an overkill. Instead you can use the "root" and "setup" commands in the Grub CLI:
    Code:
    sudo grub
    grub> find /boot/grub/stage1
    grub> find /grub/stage1
    The above commands should return your Ubuntu/Debian partitions in the form of (hdX,Y) where X and Y are numbers, for example (hd0,4). Choose which one is Ubuntu, and use it as follows:
    Code:
    grub> root (hdX,Y)
    grub> setup (hdX)
    grub> quit
    That will reinstall Grub to the MBR (Master Boot Record) and point Grub to whichever partition you specified with "root" for Grub's files (menu.lst, etc). Let me know how it goes or if you run into problems.

  8. #8
    Join Date
    Nov 2007
    Beans
    460

    Re: changing grub from another os back to ubuntu

    caljohnsmith this worked perfectly. Thank you all very much for the help!

  9. #9
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: [SOLVED] changing grub from another os back to ubuntu

    That's great news, glad it worked Steve. Cheers and have fun with Ubuntu.

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
  •