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

Thread: Customizing Grub2 boot menu

  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
    Sep 2007
    Beans
    12

    Re: Customizing Grub2 boot menu

    It is not necessary nor recommended to change use bg=true in the script. This is used as a flag for the loop logic.

    One thing I haven't tested and people should be aware of if they have problems:

    Suppose you put your image under the /usr directory tree. Does this need to be available at boot time? Some people create a large single partition that holds everything, including /boot. In that case there is no issue. But what if you put boot in its own partition like many people do? Will grub still find the image if it is in /usr and not mounted? Does the image get copied during "update-grub" or is it read at boot time? The safe thing would be to put the image in /boot/grub where grub can get to it no matter what.

  8. #8
    Join Date
    Mar 2007
    Beans
    9

    Re: Customizing Grub2 boot menu

    Still a no-go. Here's the offending line:

    Code:
    use_bg=true
    if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then
      for i in {/boot/grub,/usr/share/images/desktop-base,/boot/grub}/tux.{png,tga} ; do

  9. #9
    Join Date
    Nov 2009
    Beans
    1

    Re: Customizing Grub2 boot menu

    Is there any way to increase the font size after setting a high resolution?

  10. #10
    Join Date
    Nov 2009
    Beans
    1

    Re: Customizing Grub2 boot menu

    I tried the directions listed to change the resolution. When I restart the screen re-sizes as it should, but I no longer can see the login prompt.

    If I leave the gfxpayload=keep out, the machine boots ok, but back at the old resolution.

    I am running Ubuntu Server 9.10 in Virtual Box 3.0.10.

    Any help would be appreciated. Thank you

Page 1 of 6 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
  •