Windows XP in Grub 2


When I installed Debian 6.0 (Squeeze) on my laptop, I found that Debian Installer had not added Windows XP entry in the GRUB 2. You might also face same issue, then you can add following lines in /boot/grub/grub.cfg

## (1) Windows XP in /dev/sda1
menuentry "Windows XP" {
    set root=(hd0,1)
    chainloader +1
}

Here are few tips how to set root in the grub.cfg

# DEVICE NAME CONVERSIONS
#
#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/sda        (hd0)
#  /dev/sdb2       (hd1,2)
#  /dev/sda3       (hd0,3)
#

How to change boot order in GRUB2?


With Ubuntu 9.10 (Karmic Koala), GRUB2 is the default boot loader.
How to change boot order in GRUB2?

1.


$ cat /etc/grub/grub.cfg 

see the order of the wanted kernel. Starts from 0.

2.


$ vi /etc/default/grub 

change GRUB_DEFAULT=0 value to wanted kernel

3. run


$ update-grub
 

to update

4. reboot and check with


$ uname -r 

to see if correct kernel selected.

Securing Your Root Using GRUB


Generally, we forget to provide password security for GRUB boot loader.

If we do not provide password, any one can get access to root login without giving

root password, just by editing “kernel” parameters to “single” or “1”.

Therefore, you can prevent this editing by providing password.

$ grub-md5-crypt
Password:
Retype password:
$1$BRvj2/$A0Xj.CeywUG/iL6j/15HC.

(you can provide any password, you want. But please remember this by heart)
and paste this output in /boot/grub/menu.lst below timeout
or default as


$vi /boot/grub/menu.lst
...
timeout 10
...
password --md5 $1$BRvj2/$A0Xj.CeywUG/iL6j/15HC
...

Now, reboot and try to modify the kernel parameters. You will not be
able to until you press p and provide the password.

Create your own personalized boot splash backgrounds for GRUB


The default GRUB bootloader screen is rather bland, but you can spice it up a little by creating your own custom graphical background screen for the bootloader.
GRUB imposes a number of limitations on the image size and number of colors. It also doesn’t let you move the menu. The menu appears in a rectangle near the top of the screen, with some text instructions below the menu. This makes it relatively easy to create a graphical background screen for the GRUB bootloader, because you can focus primarily on making the bottom one-third of the screen interesting. That is not to say you cannot use other areas of the screen, but you should be careful. For example, don’t make it difficult to read the GRUB instructions by placing complex graphics behind the text.

Here are the rather strict requirements for the image:

  • It must be sized at 640×480.
  • It must be a .xpm format image file (gzip compression is optional).
  • It must contain no more than 14 colors.Most people will cringe at the 14-color limit, but it is rather amazing what you can do with just 14 colors. Cartoon images are quite suitable for this narrow range of colors, and the narrow range of colors to represent the official Linux penguin (Tux) works fine.Find or create any image you want to try as a background for GRUB.

If you create an image yourself, it’s best to create a 640×480 image and use as few colors as possible so that you don’t lose the fidelity of the image when you later reduce it to 14 colors. Don’t worry about using your graphics editor to limit yourself to 14 colors, however. It is possible to use the Gimp to reduce your image to use 14 colors, which can be a good way of fine-tuning the results you want.
Here is what you need:
A graphics editor, such as the Gimp, if you want to create or modify an image.
You must install ImageMagick if it is not already installed. Nearly all Linux distributions provide this on the install CD, and you can use your preferred package manager to install it.Suppose you have found or created the image myimage.png.
If you have ImageMagick installed, all you need to do to prepare the image is log in as root and issue these commands:

# convert myimage.png -colors 14 -resize 640×480 myimage.xpm

The convert command recognizes the extension png and knows what format it must convert the image from. It also recognizes the extension xpm and knows what format to convert the image to. The -colors 14 switch reduces the number of colors in the image to 14. If the image isn’t already sized at 640×480, the switch -resize 640×480 will do that for you.

This is sample myimage.xpm

Booting in Single User Mode in Linux


At the boot time, you usually see GRUB (GRand Unified Boot) Loader.

You select any one option of available OSs from the menu.

For example, if you have Windows and Linux.
You will get 2(or more) options to boot.

In order to boot into single user mode, you select desired
linux and press ‘e‘ in grub menu, you will see new window
with something given below

root (hd0,0)
kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda1 ro resume=/dev/sda3
initrd /boot/initrd.img-2.6.22.6
savedefault

Now, you append ‘1’ or ‘single’ in the second line (kernel) as kernel
parameter. For example

kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda1 ro resume=/dev/sda3 1

or

kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda1 ro resume=/dev/sda3 single

Now, press ‘b‘, to boot into single user mode. 🙂