Customizing GRUB

From MEPIS Documentation Wiki

Jump to: navigation, search

Contents

Introduction

After successfully installing a dual-boot system, most people want to customize it to better suit their preferences. Changes described below can be done via GRUB configuration file.

Changing the boot menu timeout

It is possible to change the length of time for which the boot menu is shown. This is useful if you would like the computer to start up faster (without the delay of showing the menu) or would like more time to choose which operating system to start. The instructions for changing the boot menu timeout are given below:

  • Press KMenu --> System --> Terminal Program (Konsole)
  • Type the following:
cd /boot/grub
su -c "cp menu.lst menu_backup.lst"
kdesu kwrite menu.lst

KWrite, a text editor, will start, and will open the file menu.lst.

  • The first line contains text similar to the following:
timeout         30

This line determines the time, in seconds, during which the boot menu will be shown. Change the number on this line to the number of seconds which you would like the menu to be shown for. Use 0 if you would not like the menu to be shown at all.

  • Press File --> Save to save your changes and then Exit. Your changes should take effect the next time you restart your computer.

Changing the default operating system to boot

You can decide which operating system will be started automatically if you have not chosen one from the boot menu within a certain time.

Cut and paste

  • Press KMenu --> System --> Terminal Program (Konsole)

Type the following:

cd /boot/grub
su -c "cp menu.lst menu_backup.lst"
kdesu kwrite menu.lst
  • KWrite, a text editor, will start, and will open the file menu.lst. The entry for each available operating system is arranged in blocks similar to the following:
title           Mepis, kernel 2.6.15-26-686
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.15-26-686 root=/dev/hda1 ro quiet splash
boot
  • Find the operating system you would like to set as the default by looking at the lines marked title in each block.
  • Highlight the entire block of the operating system you want as default, click Edit --> Cut, place your cursor above the first MEPIS entry, and click Edit --> Paste.
  • For instance, your original menu.lst might look something like this:
timeout 30
color cyan/blue white/blue
foreground ffffff
background 0639a1

gfxmenu /boot/grub/message

title MEPIS at hda2, latest kernel
root (hd0,1)
kernel /boot/vmlinuz root=/dev/hda2 nomce quiet vga=791 
boot

title MEPIS at hda2, previous kernel (if any)
root (hd0,1)
kernel /boot/vmlinuz.old root=/dev/hda2 nomce quiet vga=791 
boot

title MEPIS at hda2, kernel 2.6.27-1-mepis-smp
root (hd0,1)
kernel /boot/vmlinuz-2.6.27-1-mepis-smp root=/dev/hda2 nomce quiet vga=791 
boot

title WINDOWS at hda1
rootnoverify (hd0,0)
chainloader +1

title MEMTEST
kernel /boot/memtest86+.bin

If you want Windows to be the default system to boot, after cutting and pasting your new menu.lst would look like this:

timeout 30
color cyan/blue white/blue
foreground ffffff
background 0639a1

gfxmenu /boot/grub/message

title WINDOWS at hda1
rootnoverify (hd0,0)
chainloader +1

title MEPIS at hda2, latest kernel
root (hd0,1)
kernel /boot/vmlinuz root=/dev/hda2 nomce quiet vga=791 
boot

title MEPIS at hda2, previous kernel (if any)
root (hd0,1)
kernel /boot/vmlinuz.old root=/dev/hda2 nomce quiet vga=791 
boot

title MEPIS at hda2, kernel 2.6.27-1-mepis-smp
root (hd0,1)
kernel /boot/vmlinuz-2.6.27-1-mepis-smp root=/dev/hda2 nomce quiet vga=791 
boot

title MEMTEST
kernel /boot/memtest86+.bin
  • Click File --> Save to save your changes and exit KWrite. The new default should take effect the next time you restart your computer.

Have GRUB boot the last booted

There is yet another alternative: you can configure GRUB to default to whichever OS you booted previously.

Open the boot/grub/menu.lst file as root, using the method indicated above, and add the following option just above the first “title” entry:

default saved

Now add the following line just above the “boot” line in each stanza.

savedefault n

The variable n would be 0,1,2, etc., just as indicated above.

The menu.lst file shown above would now appear as follows. (Notice that the “chainloader” entry differs slightly).

timeout 10
color cyan/blue white/blue
foreground ffffff
background 0639a1

gfxmenu /boot/grub/message
default saved

title MEPIS at sda2, newest kernel
root (hd0,1)
kernel /boot/vmlinuz root=/dev/sda2 nomce quiet splash vga=791 
savedefault	0
boot

title MEPIS at sda2, previous kernel (if any)
root (hd0,1)
kernel /boot/vmlinuz.old root=/dev/sda2 nomce quiet splash vga=791 
savedefault	1
boot

title MEPIS at sda2, kernel 2.6.32-1-mepis-smp
root (hd0,1)
kernel /boot/vmlinuz-2.6.32-1-mepis-smp root=/dev/sda2
savedefault	2
boot

title Microsoft Windows XP Professional at sda1
rootnoverify (hd0,0)
chainloader +1
savedefault	3

title MEMTEST
kernel /boot/memtest86+.bin

Now, if you should boot to Windows XP for instance, it will become the default choice the next time you boot, and will remain so until you choose something else.

Installing Windows on a Second Drive

If you have a pure Linux system and need a Windows install on a second or third drive for example sdc, then insert this stanza (here for Windows XP) into your menu.lst

title Windows XP
rootnoverify (hd2,0)
map (hd2) (hd0)
map (hd0) (hd2)
chainloader +1

this will tell Windows it is booting from hd0,0 when it is actually hd2,0

Changing background

MEPIS 11

  • Download "plymouth" and "plymouth-themes-all" with Synaptic.
  • As root in a terminal, type plymoth-set-default-theme xxxx (where xxxx is the theme desired; I used solar).
  • Still as root in a terminal, type "update-initramfs -u -t"
  • The file to be edited to get rid of the Debian and replace it with whatever you desire is /usr/share/plymouth/debian-logo.png

MEPIS 8.5

You must have cpio installed to follow this guide.

Scale your background picture to 800x600 px. Use inkscape to make box and boot options line or whatever you want, (800x600). Merge them with gimp. Use "posterize" in the color menu to reduce the number of colors to 255 and save to the desktop.

After creating a folder h on desktop: open Konsole (if you have any problems you can use su, some files inside the message are write protected.)

cd /home/username/Desktop/h
cp /boot/grub/message /home/Henry/Desktop/h/message
cpio -idv < message

Now you have extracted the files from the cpio archive.

Open the picture you want to replace (in this case back.jpg) with gimp. Go to your own picture and open it with gimp (not as a layer) and select the whole picture. Now press Ctrl+c to copy the image. Click the window with the original image and press Ctrl+v to paste your own image over the old one This way you can be sure the resulting file will have correct color depth. Name the image back.jpg and save to the desktop. Don't make the file too large, the upper limit is 170 Kb.

Now inside the folder h again using Konsole:

rm back.jpg
rm message
cp /home/username/Desktop/back.jpg /home/username/Desktop/h/back.jpg
ls | cpio -ov > ../message

This will create the message on desktop, outside the h folder.

cd /home/username/Desktop

su password

cp /home/Henry/Desktop/message /boot/grub/message

Run this command as root after replacing the message image: update-initramfs -u -t

Personal tools
In other languages