FedoraForum.org - Fedora Support Forums and Community
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 37
  1. #1
    Join Date
    Feb 2012
    Location
    virginia
    Posts
    42

    installing grub2 to MBR, looking to do this correctly.

    Ok so I've checked guides online but I want to be ABSOLUTELY sure that nothing goes wrong (I backed up important data too, but I don't have the time to restart partitions, etc)

    I have:

    sda1 - MBR (i think?) it's like 22/100 mb used.
    sda2 - windows 7
    sda3 - fedora 16 64 bit
    sda4/5 swap, etc.

    My current set up goes like this:

    Turning on the laptop, I get the windows boot manager that boots into either fedora 16 or windows 7.
    upon selecting fedora 16, grub starts.
    on grub, i am able to boot into windows or linux.

    I had installed grub2 onto the partition when installing fedora 16, and I had used EasyBCD on my windows partition to be able to boot into linux for the first time.

    What I would like:

    To move grub to the MBR, remove windows boot manager, copy all of my previous grub settings.

    Please let me know how to do this!

    Thanks.

  2. #2
    Join Date
    Jun 2006
    Posts
    7,548

    Re: installing grub2 to MBR, looking to do this correctly.

    Of course, do what you think is best. And in the past, such a thing has been common and routine. But now, considering the recent issues with GRUB 2 and core.img and so on, I would spend some time reconsidering. After all, your current boot loader arrangement is working.

    Anyway, theoretically, and IMO, you should be able to accomplish what you described by booting Fedora, opening a terminal, and running grub2-install /dev/sda. I can't think of a reason why you would need to regenerate grub.cfg since it already successfully boots Fedora and Windows, but that should be a harmless thing to do, too.

    No promises for anything above this sentence. And don't do anything until you know that you have a way to emergency boot the systems or to repair the Windows boot loader.

  3. #3
    Join Date
    Nov 2010
    Posts
    51

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by g2nightmare
    Ok so I've checked guides online but I want to be ABSOLUTELY sure that nothing goes wrong (I backed up important data too, but I don't have the time to restart partitions, etc)

    I have:

    sda1 - MBR (i think?) it's like 22/100 mb used.
    sda2 - windows 7
    sda3 - fedora 16 64 bit
    sda4/5 swap, etc.

    My current set up goes like this:

    Turning on the laptop, I get the windows boot manager that boots into either fedora 16 or windows 7.
    upon selecting fedora 16, grub starts.
    on grub, i am able to boot into windows or linux.

    I had installed grub2 onto the partition when installing fedora 16, and I had used EasyBCD on my windows partition to be able to boot into linux for the first time.

    What I would like:

    To move grub to the MBR, remove windows boot manager, copy all of my previous grub settings.

    Please let me know how to do this!

    Thanks.
    The MBR would be /dev/sda, not /dev/sda1. The MBR is not really a partition, it's a reserved area of the disk for the, well, the Main Boot Record.Whatever you have in /dev/sda1, it ain't the MBR. Probably some Windows System Partition or suchlike.

    You should be able to simply (as root) do this:

    grub install /dev/sda
    update-grub

    It should pick up all your installed OS'es and you'll see them in the grub boot menu.

    You don't need to remove the Windows boot manager - once you put grub2 in the MBR you won't see it. Unless you select Windows from the grub menu, and then you'll see it.

  4. #4
    Join Date
    Jun 2006
    Posts
    7,548

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by sgage

    You should be able to simply (as root) do this:

    grub install /dev/sda
    update-grub
    The correct name of the script for re-installing GRUB in Fedora's version of GRUB 2 is grub2-install. And to my knowledge, there is no update-grub command in Fedora. In the early Fedora grub2 package versions, there was an update-grub2 script. But that disappeared way back with Fedora 13's version, and we have to use grub2-mkconfig to regenerate grub.cfg in Fedora.

  5. #5
    Join Date
    Aug 2009
    Posts
    329

    Re: installing grub2 to MBR, looking to do this correctly.

    I use this command without fail:

    Code:
    sudo grub2-install --recheck --root-directory=/ /dev/sda
    or

    su
    Code:
    grub2-install --recheck --root-directory=/ /dev/sda
    I have in the past use dd to backup my MBR just in case:

    Code:
    dd if=/dev/hda of=boot.mbr bs=512 count=1
    edit:Make sure Fedora is the booted linux you want to use, or modify
    --root-directory=/ to point to the mounted partition.
    Last edited by VernDog; 14th February 2012 at 04:30 AM.

  6. #6
    Join Date
    Jun 2006
    Posts
    7,548

    Re: installing grub2 to MBR, looking to do this correctly.

    Okay. Very well. I thought we were talking about GRUB 2. Maybe not. Or, maybe Fedora 16 has new GRUB 2 script names or symlinks (I haven't even downloaded Fedora 16 yet).

    Anyway, you have enough advisors now. Good luck with it.

  7. #7
    Join Date
    Nov 2010
    Posts
    51

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by stoat
    The correct name of the script for re-installing GRUB in Fedora's version of GRUB 2 is grub2-install. And to my knowledge, there is no update-grub command in Fedora. In the early Fedora grub2 package versions, there was an update-grub2 script. But that disappeared way back with Fedora 13's version, and we have to use grub2-mkconfig to regenerate grub.cfg in Fedora.
    Well, it's been a while since I've fiddled with it. Every other distro calls it "grub-install" and "update-grub". Good ol' Fedora.

  8. #8
    Join Date
    Feb 2012
    Location
    virginia
    Posts
    42

    Re: installing grub2 to MBR, looking to do this correctly.

    Well I attempted to install grub after carefully reading everything.

    sudo grub2-install /dev/sda

    seemed to work.

    followed by:

    sudo grub2-mkconfig

    grub now loads upon booting the computer. It lists 2 linux kernel and 2 windows partitions.

    The first one is my typical windows partition. The second one brings me to the windows boot manager, which allows me to still choose between windows and linux.

    I don't get it.. I'm really starting to think sda1 is an empty partition that contains the windows boot manager.

    Any ideas?

  9. #9
    Join Date
    Jun 2006
    Posts
    7,548

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by g2nightmare

    I'm really starting to think sda1 is an empty partition that contains the windows boot manager.
    Well, I don't use any newer Windows systems with the BOOTMGR boot loader, but I often see partition layouts of them with a small boot partition.

    Quote Originally Posted by g2nightmare

    followed by:

    sudo grub2-mkconfig
    That grub2-mkconfig command needs you to specify an output file (see its man page). Example...
    Code:
    su
    grub2-mkconfig -o /boot/grub/grub.cfg
    Figure out the syntax and path for your situation and run it again. Maybe it will help the situation. Maybe not.

  10. #10
    Join Date
    Feb 2012
    Location
    virginia
    Posts
    42

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by stoat
    Well, I don't use any newer Window systems with the BOOTMGR boot loader, but I often see partition layouts of them with a small boot partition.

    Next, the grub2-mkconfig command needs you to specify an output file (see the man page). Example...
    Code:
    su
    grub2-mkconfig -o /boot/grub/grub.cfg
    Figure out the syntax and path for your situation and run it again. Maybe it will help the situation. Maybe not.
    Why is this necessary?

    I think I've specified it before. I've changed my /etc/default/grub in the past on this partition and updated it sucessfully. I did it yesterday to make my grub echo "black people" when loading linux, it works just fine.

    Maybe I should edit grub.cfg and remove the option from the list?

    I plan on using gparted to delete my sda1 and sda2, my goal is to not be totally screwed when I delete it. I'm in the clear right now, right?

  11. #11
    Join Date
    Jun 2006
    Posts
    7,548

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by g2nightmare

    Why is this necessary?
    As I said in my first post above, I couldn't think of a reason why you needed to regenerate grub.cfg since it was already creating working menu entries for Fedora and Windows and you only wanted to re-install the boot loader. But now you don't like the current menu. GRUB 2 reads the grub.cfg file to create the boot menu. The grub.cfg file is generated by that grub2-mkconfig command. You entered it incorrectly when you decided to run it. Therefore, I suggested you do it again as something to try. It's usually a harmless thing to do, as I also said above.

    Quote Originally Posted by g2nightmare

    I've changed my /etc/default/grub in the past
    Right. That file is for setting some global properties for the boot loader. After changes to it, the grub.cfg file should be regenerated.

    Quote Originally Posted by g2nightmare

    Maybe I should edit grub.cfg and remove the option from the list?
    Nothing at all wrong with that. Many people do that. You may need to repeat your changes every now and then after the file is regenerated by something.

  12. #12
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,566

    Re: installing grub2 to MBR, looking to do this correctly.

    You can edit the /boot/grub2/grub.cfg directly to remove whatever menu entries you desire, and that will work. However, when ever you run grub2-mkconfig -o /boot/grub2/grub.cfg afterwards, your edit will be gone. I highly suspect that using grub2-mkconfig alone defaults to using /boot/grub2/grub.cfg as the output file.

    The reason a direct edit will be gone is because when you regenerate a new grub.cfg file, all the scripts in /etc/grub.d/ are run, and the 30_os-prober script, will find all bootable items and include them in the new grub2 menu. It'll be back.

    You can make edits to the 30_os-prober script itself to exclude selected menu items. I have done so with success so that a long unused install of Windows 2000 on /dev/sdb1 doesn't show up in my grub2 menu. The following works for Windows partitions.
    Code:
      if [ -z "${LONGNAME}" ] ; then
        LONGNAME="${LABEL}"
      fi
      if [ "${DEVICE}" = "/dev/sdb1" ]; then
      continue
      fi
    The blue text is my edit (added text). It causes the W2K entry to be skipped. The only caveat to this method is that when grub2, the rpm package, gets updated, your edited 30_os-prober file gets replaced with a new file, but the saving grace to that is that your edited file gets saved as 30_os-prober.rpmsave.
    Last edited by PabloTwo; 14th February 2012 at 04:02 AM.

  13. #13
    Join Date
    Jun 2006
    Posts
    7,548

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by PabloTwo

    I highly suspect that using grub2-mkconfig alone defaults to using /boot/grub2/grub.cfg as the output file.
    Maybe so. I don't have a Fedora system with GRUB 2 to check the man page of grub2-mkconfig. But the common man page for the generic grub-mkconfig page specifies the default for the -o option this way...
    Quote Originally Posted by man page for grub-mkconfig
    Code:
     -o, --output=FILE
            output generated config to FILE [default=stdout]

  14. #14
    Join Date
    Aug 2009
    Posts
    329

    Re: installing grub2 to MBR, looking to do this correctly.

    -o, --output=FILE output generated config to FILE [default=stdout]
    Using grub2-mkconfig from a terminal just outputs the results to the screen.

    It's a good way to test how grub picks up partition information
    Last edited by VernDog; 14th February 2012 at 04:33 AM.

  15. #15
    Join Date
    Feb 2012
    Location
    virginia
    Posts
    42

    Re: installing grub2 to MBR, looking to do this correctly.

    Quote Originally Posted by stoat
    Well, I don't use any newer Windows systems with the BOOTMGR boot loader, but I often see partition layouts of them with a small boot partition.

    That grub2-mkconfig command needs you to specify an output file (see its man page). Example...
    Code:
    su
    grub2-mkconfig -o /boot/grub/grub.cfg
    Figure out the syntax and path for your situation and run it again. Maybe it will help the situation. Maybe not.
    I ran your suggested change. There was no difference. It still generated my same config file with my same fonts.

    That brings me back to my original question.

    Is it safe to remove sda1/sda2? I should still be able to boot into grub and fedora right?

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Installing grub2 on /dev/sdb after /dev/sda died
    By jdc18 in forum Using Fedora
    Replies: 3
    Last Post: 11th December 2011, 06:31 PM
  2. upgarade 15 to 16 was good before installing grub2
    By gnulinux in forum Installation, Upgrades and Live Media
    Replies: 1
    Last Post: 5th December 2011, 11:31 PM
  3. [x86_64] Installing Grub2 on EFI
    By Elv13 in forum Mac Chat
    Replies: 1
    Last Post: 24th March 2010, 02:44 AM
  4. Yum not installing/removing dependencies correctly
    By srdempster in forum Using Fedora
    Replies: 22
    Last Post: 12th April 2008, 03:32 PM
  5. not installing correctly?
    By mcmischief in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 3rd September 2007, 08:07 AM

Tags for this Thread

Posting Permissions

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