Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 115

Thread: GRUB 2 Introduction

  1. #1
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    GRUB 2 Introduction

    DON'T PANIC

    There is a lot of great information on grub2 on this forum.

    I wrote this up to give folks a flying start. This will not make you an expert but it will, hopefully, get you headed in the right direction.

    A lot of people have trouble, right after installation, with other OS' being missing from the menu. The first thing to do for this is go to your terminal and;
    Code:
    sudo update-grub
    This is all it takes a majority of the time.
    EDIT (10-28-09)
    There is another way to update grub;
    Code:
    sudo grub-mkconfig
    This is supposed to be the default and will, I believe, soon replace update-grub altogether.
    END EDIT

    Grub2 is completely different from grub-legacy. If you are using grub2 be prepared to learn something new.


    The menu that you see on the screen when you boot up comes from the /boot/grub/grub.cfg file.


    The /boot/grub/grub.cfg file is generated everytime “update-grub” is run. This is run everytime you get a kernal update and many times when you get a grub update. It does not make sence to edit this file.


    Grub.cfg is generated by scripts in /etc/grub.d.


    00_header gets the ball rolling and gets your timeout and hidden menu information for the menu.


    05_debian-theme sets up how your menu looks on the screen.


    10_linux is the one that gives you the menu entry for the OS that you are on.


    20_memtest86+ is what sets the memtest on your menu.


    30_os-prober is what is responcible for finding the rest of your OS'.


    40_custom is designed so that you can make custom entries.


    Grub2 gets its time out information and sets up a hidden menu for you in /etc/default/grub.


    If you need to edit a menu entry that does not work do not mess with grub.cfg. It is silly to do so. It will be over written.


    Go to /etc/grub.d and add to the 40_custom file. For instance;
    30_os-prober does not generate a functional menu entry for my Mandriva installs. So I have a custom entry that works every time and comes right up on the menu every time. It is not over written because it is regenerated every time that “update-grub” is run.
    Code:
     menuentry "linux-nonfb (on /dev/sda12)" {
        insmod ext2
        set root=(hd0,12)
        search --no-floppy --fs-uuid --set c23ad2ca-67a5-4a42-8fcc-3baa6d8e454e
        linux /boot/vmlinuz BOOT_IMAGE=linux-nonfb root=UUID=c23ad2ca-67a5-4a42-8fcc-3baa6d8e454e resume=UUID=59fe476e-6d4f-e390-ced9-f29328538dfc
        initrd (hd0,11)/boot/initrd.img
    }
    As you can see the partition is defined as being in two different places in this entry. It will not boot. The entry below will boot very well indeed.



    Code:
            menuentry "Mandriva-Gnome" {
            linux (hd0,12)/boot/vmlinuz
            initrd (hd0,12)/boot/initrd.img
    }
    This also works very well for your non-grub2 Ubuntu OS'.


    I use a slightly different entry for grub2 Ubuntu installs;
    Code:
     menuentry "Kinky-Grub2-A2 on sda10 2.6.31-11-generic" {
            set root=(hd0,10)
            linux /vmlinuz root=/dev/sda10 so quiet splash
            initrd /initrd.img
    }
    This entry works even if you change the OS on the partition.


    Your custom entries must be in the proper form. The first thing to do is start your favorite text editor (I use gedit). Go to preferences and set it so that there is NO test wrapping.


    Then, in your 40_custom file put in an entry such as;
    Code:
     echo "Adding Kinky-Grub2-A2 on sda10 (2.6.31-11-generic)" >&2 
    cat << EOF
    menuentry "Kinky-Grub2-A2 on sda10 2.6.31-11-generic" {
            set root=(hd0,10)
            linux /vmlinuz root=/dev/sda10 so quiet splash
            initrd /initrd.img
    }
    EOF
    That is the entire entry for that OS. It is the one that I use for experimenting on grub2. The part that does the work is between the { }s. Make sure that they are where they belong.


    If you save this file as 06_custom it will appear at the top of menu you see on the screen. If you save it as 40_custom it will appear at the bottom of menu you see on the screen.


    Now, what is the advantage of this rigamarole compared to grub-leagacy.


    Well, if you have three OS' on your drive and you set up a custom menu you do not need any other menu entries at all. So you change the permissions on 10_linux, 20_memtest86+, 30_custom so that they are not executable. They will not run when “update-grub” is run and so the onoy thing on your menu is your custom entries. There is nothing that can mess with these entries except you.


    You must remember to run;
    Code:
     sudo update-grub
    Everytime you do anything that is to change your menu. This will overwrite your /boot/grub/grub.cfg file and thus the menu that shows up on your screen.


    Here are some links, some more useful than others, that I have collected.

    Some grub2 links;


    http://members.iinet.net/~herman546/p20.html

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

    http://grub.enbug.org/

    http://grub.enbug.org/Manual

    http://grub.enbug.org/CommandList

    https://wiki.ubuntu.com/Grub2#Adding...0to%20Grub%202

    https://wiki.ubuntu.com/Grub2#Recove...20via%20LiveCD

    http://members.iinet.net/~herman546/p20/GRUB2%20CLI%20Mode%20Commands.html#cli_loopback

    http://members.iinet.net/~herman546/p20/GRUB2%20Splashimages.html

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

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

    In case grub2 is just too much, you may want to take a look at this;

    http://ubuntuforums.org/showthread.p...ght=kansasnoob

    Some other links that are just interesting and may help or inspire some one;

    http://ubuntuforums.org/showpost.php...9&postcount=16

    http://ubuntuforums.org/showthread.p...98#post8100252

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


    HAVE FUN
    Last edited by ranch hand; November 13th, 2009 at 04:13 PM.
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

  2. #2
    Join Date
    Jul 2007
    Location
    Unknown
    Beans
    16,641
    Distro
    Ubuntu Development Release

    Re: Grub2 introduction

    Good post.

    I can just see the absolute beginners forum after karmic being flooded with grub2 queries. Especially dual and multibooters.

  3. #3
    Join Date
    Mar 2006
    Beans
    4,373
    Distro
    Ubuntu Development Release

    Re: Grub2 introduction

    make that a sticky both here and on the beginners forum , nice work ranchhand
    if it ain't broke you haven't tweaked it enough

  4. #4
    Join Date
    May 2009
    Location
    Land of Lincoln
    Beans
    1,367
    Distro
    Ubuntu Development Release

    Re: Grub2 introduction

    hi!

    i'm testing 9.10 on a dell mini 9 running only 9.10

    is there any reason for me to enter sudo update-grub?

    please advise and thanks for your help!

    KegHead

  5. #5
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    Re: Grub2 introduction

    Quote Originally Posted by KegHead View Post
    hi!

    i'm testing 9.10 on a dell mini 9 running only 9.10

    is there any reason for me to enter sudo update-grub?

    please advise and thanks for your help!

    KegHead
    As long as everything is working, leave it alone.

    When you update, watch the details when the updates are installed. You can do this in any update method that you use.

    Update grub gets run a lot. Most grub2 updates and all kernal updates have update-grub run.
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

  6. #6
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    Re: Grub2 introduction

    Quote Originally Posted by philinux View Post
    Good post.

    I can just see the absolute beginners forum after karmic being flooded with grub2 queries. Especially dual and multibooters.
    Yes, I think this could be a nightmare.

    I really like this grub but it is going to be rough.
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

  7. #7
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    Re: Grub2 introduction

    Quote Originally Posted by ronacc View Post
    make that a sticky both here and on the beginners forum , nice work ranchhand
    A sticky of some kind is needed for sure. I have no idea how to get that done.

    Thank you for your kind words. I have fooled with it for a while.

    I hope we can avoid having 8 million treads all on the theme of "where is my menu.lst" and "just edit your grub.cfg file".
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

  8. #8
    Join Date
    Nov 2008
    Location
    Brazil
    Beans
    309
    Distro
    Ubuntu 9.10 Karmic Koala

    Stick it!

    Thanks, ranch.
    The other post about grub2 is good too and I followed it to create extra entries in my menu (Puppy frugal install, which wont be automatically detected). 50_.., 51_.., like that.
    I couldn't get the 40_custom to work (it says it can hold several menu entries in it) but since it's working ok the way it is, that's ok. Yes, grub2's system is much more flexible.

    It's nice that you posted a lot of links too.

  9. #9
    Join Date
    Jul 2008
    Location
    U.S.A
    Beans
    1,331
    Distro
    Ubuntu Development Release

    Re: Grub2 introduction

    Nice one ranch hand!

  10. #10
    Join Date
    May 2009
    Location
    Land of Lincoln
    Beans
    1,367
    Distro
    Ubuntu Development Release

    Re: Grub2 introduction

    hi!

    thanks for the info ranch hand!

    i'll follow this tread for more info1

    KegHead

Page 1 of 12 12311 ... LastLast

Tags for this Thread

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
  •