Page 1 of 5 123 ... LastLast
Results 1 to 10 of 55

Thread: Customizing Grub2 boot menu

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Marquette, MI
    Beans
    17
    Distro
    Ubuntu Karmic Koala (testing)

    Customizing Grub2 boot menu

    The grub boot menu Ubuntu uses has bothered me since I first saw the SUSE implementation of grub. So, after installing the latest 9.10 beta, I decided it was time to figure out how to get rid of that awful black grub menu. Two days later, here is what I have figured out.

    Find an image

    I used the cool heron image from a previous release of ubuntu. Find it here. My desktop resolution is 1280X1024 so that's what I trimmed down this image to match.

    You'll have to save this image in PNG/TGA format. You'll see why later so just make sure this is the format you use.

    Set the default grub resolution

    Grub2 uses a collection of files to set the various settings it uses. You can specify your desired resolution in the /etc/default/grub file. Edit it with this command:

    Code:
    gksudo gedit /etc/default/grub
    Look for the line #GRUB_GFXMODE=640X480. Remove the # and set your desired resolution. Here's what I did:

    Code:
    GRUB_GFXMODE=1280x1024
    For whatever reason, one that I don't totally understand, this is not all you have to do to change the resolution grub uses. As I discovered in this blog, there is one more change you need to make.

    Edit this file: /etc/grub.d/00_header with the command:

    Code:
    gksudo gedit /etc/grub.d/00_header
    You are looking for the line that consists of:

    Code:
    set gfxmode=${GRUB_GFXMODE}
    After that line, add:

    Code:
    set gfxpayload=keep
    your block of code will look like:

    Code:
    if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
      set gfxmode=${GRUB_GFXMODE}
      set gfxpayload=keep
      insmod gfxterm
    With this new line, your resolution will now be displayed by grub. If you ran the sudo update-grub command you could reboot and witness the glorious resolution. Since I want to add a background, I won't run this command yet.

    Set a background image and change the highlighting colors


    To set a background in grub you have to edit the debian theme file stored at /etc/grub.d/05_debian_theme. Edit this file with the command:

    Code:
    gksudo gedit /etc/grub.d/05_debian_theme
    First, look for the line:

    Code:
    use bg=false
    change it to:

    use bg=true
    Next you are looking for the "for" statement just below the use bg piece of code we just changed. This for statement will show you the directories that grub will look for your background image in. I added another directory, emphasized in bold, to this list so my entry looks like this:

    Code:
    for i in {/boot/grub,/usr/share/images/desktop-base,/usr/share/images/grub}/xxxxxxxxxx.{png,tga} ;
    Make sure your image is in either png or tga format and then copy it into one of the directories listed above. I just used /usr/share/images/grub. I named my image ubuntu for ease of use, so I replaced the previous image name (the x's in the example above) with my image name.

    Code:
    for i in {/boot/grub,/usr/share/images/desktop-base,/usr/share/images/grub}/ubuntu.{png,tga} ;
    Finally, depending on your preferences, you might want to adjust the colors grub uses for text and highlighting. With background images enabled, grub defaults to black text with magenta highlighting. To change this scroll down to the bottom of the file and look for the code:

    Code:
    if background_image `make_system_path_relative_to_its_root ${bg}` ; then
      set color_normal=black/black
      set color_highlight=magenta/black
    else
    You'll want to keep the color after the slash, for both instances, set to black. It seems this makes the foreground transparent allowing your to see your handsome new background. You can see a list of available colors in the grub manual. This is what I used for my brown-heavy image.

    Code:
    if background_image `make_system_path_relative_to_its_root ${bg}` ; then
      set color_normal=white/black
      set color_highlight=brown/black
    else
    One last thing
    In order for all of this stuff to work, you'll have to recompile the grub configuration file. Do this by running:

    Code:
    sudo update-grub
    All that's left is to restart and behold the wonder. Enjoy.

  2. #2
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Customizing Grub2 boot menu

    A fair amount has changed with grub2

    Please see : Grub2 - Community Ubuntu Documentation
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  3. #3
    Join Date
    Mar 2007
    Beans
    9

    Re: Customizing Grub2 boot menu

    Well, everything went well until updating grub...

    Code:
    Generating grub.cfg ...
    No path or device is specified.
    Try ``grub-probe --help'' for more information.
    No path or device is specified.
    Try ``grub-probe --help'' for more information.
    I'm running 9.10 64.

    Any ideas? Is any more information required? Thanks.

  4. #4
    Join Date
    Nov 2008
    Beans
    5

    Re: Customizing Grub2 boot menu

    im getting the exact same error on 32 bit

    i noticed that if i change the line

    use bg=true
    back to:
    use bg=false
    update-grub works, but the image is not shown in grub
    Last edited by daemian57; November 6th, 2009 at 07:36 PM.

  5. #5
    Join Date
    Jan 2007
    Beans
    1

    Re: Customizing Grub2 boot menu

    That means that you have an invalid file path in your configuration file. I'm going to guess that when you edited this line...

    Code:
    for i in {/boot/grub,/usr/share/images/desktop-base,/usr/share/images/grub}/ubuntu.{png,tga} ;
    You forgot to put a comma after /usr/share/images/desktop-base. So, instead, you have an invalid file path. If you do have the comma, the other thing I can think of is that you forgot to create the /usr/share/images/grub directory.

    Hope that helps.
    Last edited by zreed20; November 6th, 2009 at 07:39 PM.

  6. #6
    Join Date
    Nov 2008
    Beans
    5

    Re: Customizing Grub2 boot menu

    ahhh dangnabbit I had

    for i in {/boot/grub,/usr/share/images/grub}/ubunutu.{png,tga} ; do
    this is why spelling is important in school...

    thanks for helping me find the problem

  7. #7
    Join Date
    Nov 2008
    Location
    Baildon, West Yorkshire
    Beans
    6
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Customizing Grub2 boot menu

    I think the following may have something to do with the issue you are having:

    Code:
        if is_path_readable_by_grub $i ; then 
          bg=$i
          case ${bg} in
            *.png)		reader=png ;;
            *.tga)		reader=tga ;;
            *.jpg|*.jpeg)	reader=jpeg ;;
    This would suggest grub is unable to read the directory you placed your background in, or that it's not in a format it will accept (png, tga or jpeg). I don't profess to be an expert in these matters so I'd be grateful to anyone who can corroborate this!

  8. #8
    Join Date
    May 2007
    Location
    On board my boat
    Beans
    483
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Customizing Grub2 boot menu

    Quote Originally Posted by The2DQuartet View Post
    I think the following may have something to do with the issue you are having:

    Code:
        if is_path_readable_by_grub $i ; then 
          bg=$i
          case ${bg} in
            *.png)		reader=png ;;
            *.tga)		reader=tga ;;
            *.jpg|*.jpeg)	reader=jpeg ;;
    This would suggest grub is unable to read the directory you placed your background in, or that it's not in a format it will accept (png, tga or jpeg). I don't profess to be an expert in these matters so I'd be grateful to anyone who can corroborate this!
    If you want to get your Grub Splash screen from a directory that you do not need to "sudo" all the time just edit this:

    Code:
    for i in {/boot/grub,/usr/share/images/desktop-base,/usr/share/images/grub}/xxxxxxxxxx.{png,tga} ;
    to whatever directory you wish.
    Don
    Looks fine to me but then I don't know/care what you run

  9. #9
    Join Date
    Jun 2008
    Beans
    65

    Re: Customizing Grub2 boot menu

    Updated successfully but the image doesn't show up in the grub menu, I don't think the colors changed either. And yes I did make sure I set the value to true instead of false. The resolution change worked fine. So I'm guessing it has something to do with the debian theme file.
    Last edited by ghostier; November 24th, 2009 at 06:45 AM.

  10. #10
    Join Date
    Jul 2010
    Beans
    7
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Customizing Grub2 boot menu

    Quote Originally Posted by bodhi.zazen View Post
    A fair amount has changed with grub2

    Please see : Grub2 - Community Ubuntu Documentation
    Thanks!

    This link has everything I need!

Page 1 of 5 123 ... 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
  •