Ubuntu:Feisty/BootMenu

From

Contents

Boot Menu

How to gain root user access without login

  • Read #General Notes
  • Easiest method (will not work if GRUB menu password is set)
    • Boot-up computer
    • If GRUB menu is hidden, press 'Esc' to enter the GRUB menu
    • Select
Ubuntu, kernel 2.6.10-5-386 (recovery mode)

How to modify kernel boot-up arguments, to gain root user access

  • Read #General Notes
  • Boot-up computer
  • If GRUB menu is hidden, press 'Esc' to enter the GRUB menu
  • If GRUB password is set, press 'p' to unlock the GRUB menu
  • Select
Ubuntu, kernel 2.6.10-5-386
  • Press 'e' to edit the commands before booting
  • Select
kernel /boot/vmlinuz-2.6.10-5-386 root=/dev/hda2 ro quiet splash
  • Press 'e' to edit the selected command in the boot sequence
  • Add "rw init=/bin/bash" to the end of the arguments
grub edit> kernel /boot/vmlinuz-2.6.10-5-386 root=/dev/hda2 ro quiet splash rw init=/bin/bash
  • Press 'b' to boot

How to use Ubuntu Installation CD, to gain root user access

  • Read #General Notes
  • Boot-up computer into Ubuntu Installation CD
  • At "boot:" prompt, add "rescue" to the argument
boot: rescue
  • Follow the instructions on screen

How to change root user/main user password if forgotten

# passwd root
  • To change main user password
# passwd system_main_username

How to change GRUB menu password if forgotten

grub
grub> md5crypt
Password: ****** (ubuntu)
Encrypted: $1$ZWnke0$1fzDBVjUcT1Mpdd4u/T961 (encrypted password)
grub> quit
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
gksudo gedit /boot/grub/menu.lst
  • Find this line
...
password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
...
  • Replace with the following line
password --md5 $1$ZWnke0$1fzDBVjUcT1Mpdd4u/T961 (encrypted password above)
  • Save the edited file

How to restore GRUB menu after Windows installation

Super Grub Disk
Grub

If you have booted your linux distro with Super Grub Disk, or a live CD and want to restore your grub, follow the below instructions:

  • As root (or with sudo), type grub
  • When at the grub prompt, type find /boot/grub/stage2
  • This will return something like (hd0,2)
  • To setup the boot partition boot type root (hd0,2). This is the harddrive and the partition your linux is installed on...
  • And then to configure grub type setup (hd0)
  • Now you're done, so exit with quit

How to identify the name of the boot drive (hd0, hd1, hd2, etc)

Press "c" on boot menu. If you don't see a boot menu, press ESC key first when booting to show the boot menu.

Type:

root (hd0,0)

Most likely you will get "(hd0,0) ext2fs", which should be your current Linux drive. Now change hd0 to hd1 to see what is there.

root (hd1,0)

If you get "(hd1,0) filesystem type unknown, partition type 0x7", then hd1 is a Windows drive.

Now change hd1 to hd2, keep going until you reach hd7.

OR

In a terminal you can type:

cat /boot/grub/device.map

You will get something like this:


(hd0)  /dev/hda
(hd1)  /dev/sda

This represents that grub recognizes your IDE drive and assigned it the value hd0; and also your SATA drive and assigned it the value hd1.

  • Note that grub assigns ALL hard disks, be they IDE or SATA, by hd* where * is a number.

This is useful if you are editing your /boot/grub/menu.lst from a terminal in Ubuntu and need to know what grub is seeing.

Use

sudo fdisk -l

to find which drives are bootable

How to add Windows entry into GRUB menu

e.g. Assumed that /dev/hda1 is the location of Windows partition
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
gksudo gedit /boot/grub/menu.lst
  • Append the following lines at the end of file
title		Microsoft Windows
rootnoverify	(hd0,0)
savedefault
makeactive
chainloader	+1
  • Save the edited file

How to boot into Windows installed on a seperate SATA drive

This configuration applies to people who have Linux installed on a IDE drive, and Windows installed on a seperate SATA. The IDE drive boots first, so we need to add an entry to the boot menu on the Linux disk. Here we assume the name of your Windows drive is hd1. If you are not sure, click the link above to find out.

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
gksudo gedit /boot/grub/menu.lst
  • Append the following lines at the end of file.
title           Windows XP on SATA drive
map (hd0) (hd1)
map (hd1) (hd0)
chainloader (hd1,0)+1
  • Save the edited file
  • Finally, do
sudo update-grub

This will update the grub bootloader and finalize any changes you made

How to hide GRUB menu on boot-up

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
sudo gedit /boot/grub/menu.lst

  • Find this line
...
#hiddenmenu
...
  • Replace with the following line
hiddenmenu
  • Save the edited file

How to change the timeout seconds for GRUB menu on boot-up

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
gksudo gedit /boot/grub/menu.lst
  • Find this line
...
timeout     10
...
  • Replace it with the following line, where X_seconds is a number representing the number of seconds before the menu should timeout.
timeout     X_seconds
  • Save the edited file

How to change default Operating System boot-up for GRUB menu

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
gksudo gedit /boot/grub/menu.lst
  • Find this line
...
default     0
...
  • Replace with the following line, where X_sequence is a number representing the number of the Grub menu item you want to be the default operating system.
default     X_sequence

To figure out which number corresponds to the desired operating system, scroll to the bottom of the menu.lst file in gedit and look for lines that begin with the word title. The first "title" is 0, the second is 1, etc. Count "title" entries to find the number of the desired operating system and enter that number in place of X_sequence in the line above.

  • Save the edited file

How to display Splash Image for GRUB menu on boot-up

wget -c http://easylinux.info/uploads/ubuntu.xpm.gz
chmod 644 ubuntu.xpm.gz
sudo cp ubuntu.xpm.gz /boot/grub/splash.xpm.gz
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
sudo update-grub

How to convert Wallpaper to Splash Image for GRUB menu

e.g. Assumed that wallpaper.png is the Wallpaper to be converted to Splash Image
splash.xpm.gz is the Splash Image for GRUB menu
ImageMagick is installed
convert -resize 640x480 -colors 14 wallpaper.png splash.xpm && gzip splash.xpm
chmod 644 splash.xpm.gz
sudo cp splash.xpm.gz /boot/grub
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
sudo update-grub

How to display only one kernel on GRUB menu

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup-`date +%F`
gksudo gedit /boot/grub/menu.lst
  • Find this line
...
# howmany=all
...
  • Replace with the following line
# howmany=1

Where 1 means to keep the last kernel, 2 to keep the last 2 kernels, etc. Do not delete the # symbol. The menu will be updated once a new kernel will be updated by the system, not before.

  • Save the edited file
  • Update /boot/grub/menu.lst
sudo update-grub

How to read Linux partitions (ext2, ext3) in Windows machine

OR


How to Boot Ubuntu from the Windows Bootloader

You may choose to have the Windows bootloader set as the default, and use that to boot into your Windows install or to load GRUB so you can boot into Ubuntu from there.

While in Ubuntu setup, at the very last prompt before the actual installation/copying process begins there will be a button labeled "Advanced" that presents you with an option to change the location of GRUB. The default is the MBR of the boot drive. You should change this to point to your Ubuntu partition instead. For instance, the second partition of the first hard-drive would be hd(0,1).

If you've already installed Ubuntu, you'll have to use grub-install to install GRUB to the bootsector of the Ubuntu partition.

There are two methods of adding Ubuntu to the Windows bootloader. The easiest method is if you are using Windows Vista, by using EasyBCD and simply pointing EasyBCD to the Ubuntu partition and asking it to create an entry there. Full instructions available at NeoSmart Technologies.

If you're using Windows XP, the process is slightly more involved and requires that you use the `dd` command to copy the first 512 bytes of the Ubuntu partition:

dd if=/dev/sda2 of=~/Desktop/Ubuntu.mbr bs=512 count=1

Then copy the resulting Ubuntu.mbr file to C:\ of your Windows drive, and add an entry

C:\Ubunutu.mbr Ubuntu

in the Windows' Boot.ini file.

How to temporarily skip boot-up services

Press 'Ctrl + C'

How to permanently disable/enable boot-up services