Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old October 20th, 2009   #1
johns996
5 Cups of Ubuntu
 
johns996's Avatar
 
Join Date: Apr 2006
Location: Marquette, MI
Beans: 16
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:

Quote:
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.
johns996 is offline   Reply With Quote
Old November 5th, 2009   #2
bodhi.zazen
Ubuntu Guru
 
bodhi.zazen's Avatar
 
Join Date: Apr 2006
Location: Montana
My beans are hidden!
Xubuntu Development Release
Send a message via Yahoo to bodhi.zazen
Re: Customizing Grub2 boot menu

A fair amount has changed with grub2

Please see : Grub2 - Community Ubuntu Documentation
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999

bodhi.zazen is offline   Reply With Quote
Old November 6th, 2009   #3
KroniKlepto
First Cup of Ubuntu
 
Join Date: Mar 2007
Beans: 5
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.
KroniKlepto is offline   Reply With Quote
Old November 6th, 2009   #4
daemian57
First Cup of Ubuntu
 
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

Quote:
use bg=true
back to:
Quote:
use bg=false
update-grub works, but the image is not shown in grub

Last edited by daemian57; November 6th, 2009 at 02:36 PM..
daemian57 is offline   Reply With Quote
Old November 6th, 2009   #5
zreed20
First Cup of Ubuntu
 
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 02:39 PM..
zreed20 is offline   Reply With Quote
Old November 6th, 2009   #6
daemian57
First Cup of Ubuntu
 
Join Date: Nov 2008
Beans: 5
Re: Customizing Grub2 boot menu

ahhh dangnabbit I had

Quote:
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
daemian57 is offline   Reply With Quote
Old November 6th, 2009   #7
Cryptog
First Cup of Ubuntu
 
Join Date: Sep 2007
Beans: 10
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.
Cryptog is offline   Reply With Quote
Old November 6th, 2009   #8
KroniKlepto
First Cup of Ubuntu
 
Join Date: Mar 2007
Beans: 5
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
KroniKlepto is offline   Reply With Quote
Old November 6th, 2009   #9
robo_rat
First Cup of Ubuntu
 
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?
robo_rat is offline   Reply With Quote
Old November 6th, 2009   #10
gonzorg
First Cup of Ubuntu
 
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
gonzorg is offline   Reply With Quote

Bookmarks

Tags
boot, grub2

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:17 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry