Grub2


Notes here should apply to all distributions using grub2.

Remember that any time a change is made to grub you need to run the command sudo update-grub. If you fail to take this step the changes will not be incorporated into the boot configuration.

Some notes taken from this web page


BigDelay
Default
Files
GFXMode
Memtest86+
MenuHighlight
Random
RecoveryMode
SplashImages
StartupManager
TimeOut
Version
FedoraGrub2

Default Timeout

To change the default timeout for the boot menu, edit the file /etc/default/grub. There is a line that reads

GRUB_TIMEOUT=xx

Change it to whatever you wish. Save and exit. Remember to run sudo update-grub. Next time you boot the system the new value will be incorporated.


What version of grub?

Check the installed version of grub with grub-install -v.

glenn@leonardo:~$ grub-install -v
grub-install (GNU GRUB 1.97~beta4)


GRUB2 Files


Default OS

The default OS is determined in the file /etc/default/grub. There is a line that reads

GRUB_DEFAULT=x

Change that number to reflect the operating system you want to be the default. I've changed mine to GRUB_DEFAULT=5. I have 6 entries in the menu. The last one is Fedora. Since I'm a Fedora user and that's my main OS I want it to be the default. Remember to run sudo update-grub. Next time you boot the system the new value will be incorporated.


glenn@leonardo:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda2
Found Fedora release 11.92 (Rawhide) on /dev/sda6
done


Splash Images with grub2

Install the grub2-splashimages package. On my Ubuntu 9.10 install this is done with apt-get.

sudo apt-get install grub2-splashimages

When Fedora adopts grub2 I'm sure that the installation will be something like this.

sudo yum install grub2-splashimages

Once this package is installed the files, on the Ubuntu system, reside in /usr/share/images/grub.

[glenn@leonardo ~]$ ls /usr/share/images/grub/
050817-N-3488C-028.tga                  Flower_jtca001.tga         Plasma-lamp.tga
2006-02-15_Piping.tga                   Fly-Angel.tga              Sparkler.tga
Aesculus_hippocastanum_fruit.tga        Glasses_800_edit.tga       TulipStair_QueensHouse_Greenwich.tga
Apollo_17_The_Last_Moon_Shot_Edit1.tga  Hortensia-1.tga            Windbuchencom.tga
B-1B_over_the_pacific_ocean.tga         Lake_mapourika_NZ.tga
BonsaiTridentMaple.tga                  Moraine_Lake_17092005.tga

To use one of these images for your boot splash background, open the file /etc/grub.d/05_debian_theme as root for editing. Find the line that reads

for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do

This is the line that needs to be modified. On my system I simply commented the original line out and added a new one using the path to the desired image file. I've chosen the file Lake_mapourika_NZ.tga as my background. Here's the newly added line, below the commented out original line.

#for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do
   for i in {/boot/grub,/usr/share/images/grub}/Lake_mapourika_NZ.{png,tga} ; do

Save your changes and run sudo update-grub. If all goes well you will see output stating that the image was found.

[glenn@leonardo ~]$ sudo update-grub
Password: 
Generating grub.cfg ...
Found Debian background: Lake_mapourika_NZ.tga
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda2
Found Fedora release 11.92 (Rawhide) on /dev/sda6
done

Notice the line reading Found Debian background: Lake_mapourika_NZ.tga. This is good. The next reboot will show that image as the bootsplash background.


Menu Colors / Highlighting

This feature is set in the file /etc/grub.d/05_debian_theme. There is a section near the bottom of the file that reads, by default

 set color_normal=black/black
 set color_highlight=magenta/black

I changed the second line to read

 set color_normal=black/black
 set color_highlight=white/blue

This will give me a blue bar with white text. Remember to run sudo update-grub after you make this change so that it is incorporated into the menu.


Random thoughts / notes

sudo chmod -x /etc/grub.d/20_memtest86+
sudo update-grub


Long boot delay

When I boot my desktop box there is a long delay, probably 40 seconds or so, where GRUB2 seems to be doing a lot of disk reading. Then once a decision is reached there is another delay of 3-5 seconds before the boot loader actually presents a boot menu. Doesn't seem like this is the correct behaviour.

Info here

The information contained in that forum thread helped me solve my problem. I have three hard disks in the computer, two are EIDE and one is SATA. They are set up this way:

Primary Master: 80GB EIDE
Secondary Master: 160GB EIDE
SATA: 500GB

Ubuntu sees these disks as /dev/sda, /dev/sdb and /dev/sdc respectively. I fiddled with the commands mentioned in the forum thread until I got it right realizing that Ubuntu is actually installed on /dev/sdb. Some shots of my experiment. This first screen I just pressed enter.
/mywiki/Grub2?action=AttachFile&do=get&target=Screenshot-Terminal.png
On this screen I also just pressed enter.
/mywiki/Grub2?action=AttachFile&do=get&target=Screenshot-Terminal-1.png
On this screen I again pressed enter. No changes yet.
/mywiki/Grub2?action=AttachFile&do=get&target=Screenshot-Terminal-2.png
On this screen I selected sdb since this is where Ubuntu is installed.
/mywiki/Grub2?action=AttachFile&do=get&target=Screenshot-Terminal-3.png
Back to the terminal where dpkg-reconfigure grub-pc finishes up.
/mywiki/Grub2?action=AttachFile&do=get&target=Screenshot-Terminal-4.png
Once complete I rebooted, changed the BIOS so that the 160GB drive was the "first" drive and rebooted again. Success! Now grub loads as it should, not 40 seconds after it should have.


Startup Manager

A graphical application that allows the user to change some of the basic functions / settings of the boot loader. Installed on an Ubuntu system with the command

sudo apt-get install startupmanager

The application can be found under System > Administration > Startup Manager.


Do not display recovery mode menu option

I don't want to see "recovery mode" offered in the boot menu. To accomplish this, edit the file /etc/default/grub. Find the line that reads

#GRUB_DISABLE_LINUX_RECOVERY=true 

Remove the # from in front of that line. Run sudo update-grub. When you reboot you will not see a Recovery Mode option.


GFXMode

Replacing vga=791 in the boot menu. In the file /etc/default/grub find the line that reads

#GRUB_GFXMODE=640x480

Uncomment and change to 800x600, 1024x768, etc.

Hmmmm... That only changes the resolution of the screen for the boot menu, not the vga mode of the other OS's.


Return home

Grub2 (last edited 2009-11-20 12:15:18 by GlennJohnson)