User:Moksha/Basic GRUB editing

From MEPIS Documentation Wiki

Jump to: navigation, search

The possibilities with GRUB are enormous and this article will introduce you to some of the possible changes that can be made with GRUB configuration file /boot/grub/menu.lst. This name is a shortening of menu.list, the i in list is removed, all edits to menu.lst are done as root, no changes will be permitted otherwise.

Contents

Backup

Before making any changes backup menu.lst, this is one way to do it

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

Editing

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:

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.

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

Type the following:

cd /boot/grub
su
cp menu.lst menu_backup.lst
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. It is possible that changes may not take place when this happens, check that your menu.lst is as you wrote it, if not rewrite it or replace it with a backup copy if you made one. Open the System menu and MEPIS settings > MEPIS system assistant > Repair System Boot, then check mbr or root if this is a secondary boot choice in a chainloading menu and then uncheck update boot menu as this is an automated menu.lst writting option, the other settings should be correct never the less check them, then select apply

Edit Menu at Boot

The "/boot/grub/menu.lst" file should contain something like this:

title MEPIS kernel 2.6.15-586tsc
kernel (hd#,#)/boot/vmlinuz-2.6.15-586tsc root=/dev/hd## 

The numbers represented here by # sign should point to the appropriate drive and partition. One way to find these numbers:

  1. At boot, when you get the Grub menu, press "Esc" to get out of the graphical interface and then press "c" to get the Grub command prompt.
  2. Type: "find /vmlinuz" and you'll get the (hd#,#) of the boot partition. Alternatively if that doesn't work you can search for a specific kernel location with "find /boot/vmlinuz-2.6.7"
  3. Edit /boot/grub/menu.lst to reflect these findings.

Note: The information in the (hd#,#) field is for GRUB and must conform to GRUB's (0-up) numbering system, but the info in the /dev/hd## field is passed to the kernel and therefore must conform to the Linux numbering system.
For example:
If the /boot and the /root directories are both in the first primary partition of the first hard drive, the kernel command will read:

   kernel (hd0,0)/boot/vmlinuz-2.6.15-586tsc root=/dev/hda1 

If both directories are in the first extended partition of the second drive the commands will read:

   kernel (hd1,4)/boot/vmlinuz-2.6.15-586tsc root=/dev/hdb5
Personal tools
In other languages