User Guides GRUB 2 installation

Hi all,
GRUB2 or more precisely 1.95+20070604-1ubuntu1 is awesome atleast to the number of things it tries to cover. Of course its very much a work in progress but would have loved to play it on the newer BIOSes & see how they react. This is on gutsy gibbon while same thing works on fiesty dunno however if feisty has the newer version (20070604) or are there still with 1.95.

Anyway here is the breakdown of it.

The first thing you do is
Code:
sudo aptitude install GRUB2

Now after the installation is done.

Now you make changes to the the file /boot/grub/menu.lst

Content of /boot/grub/menu.lst

Code:
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default		0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout		1000

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title		Windows 95/98/NT/2000
# root		(hd0,0)
# makeactive
# chainloader	+1
#
# title		Linux
# root		(hd0,1)
# kernel	/vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=7eedd8c9-0471-4a63-af65-939402ec5b4e ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(single-user) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title		Chainload into GRUB 2
root		(hd0,0)
kernel		/boot/grub/core.img
savedefault

title		Debian GNU/Linux, kernel 2.6.22-6-generic
root		(hd0,0)
kernel		/boot/vmlinuz-2.6.22-6-generic root=UUID=7eedd8c9-0471-4a63-af65-939402ec5b4e ro quiet splash
initrd		/boot/initrd.img-2.6.22-6-generic
savedefault

title		Debian GNU/Linux, kernel 2.6.22-6-generic (recovery mode)
root		(hd0,0)
kernel		/boot/vmlinuz-2.6.22-6-generic root=UUID=7eedd8c9-0471-4a63-af65-939402ec5b4e ro single
initrd		/boot/initrd.img-2.6.22-6-generic
savedefault

title		Debian GNU/Linux, kernel memtest86+
root		(hd0,0)
kernel		/boot/memtest86+.bin

### END DEBIAN AUTOMAGIC KERNELS LIST

Make any changes you want. For e.g. I have done the unhide menu, color the menu as well as change the time for booting from 5 secs. to 1000 secs.

Now run the update-grub command

Code:
sudo update-grub

This will result into the following action :-

Code:
Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.22-6-generic
Found initrd image: /boot/initrd.img-2.6.22-6-generic
Found memtest86+ image: /boot/memtest86+.bin
done

Now if you are a curious bee like me, you would like to see the new /boot/grub/grub.cfg file . So here are the contents :-

Code:
#
# DO NOT EDIT THIS FILE
#
# It is automaticaly generated by /usr/sbin/update-grub using templates from /etc/grub.d
# and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd1,1)

font (hd1,1)/usr/share/grub/unifont.pff
set gfxmode=640x480
insmod gfxterm
insmod vbe
terminal gfxterm
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.22-6-generic" {
	linux	(hd1,1)/boot/vmlinuz-2.6.22-6-generic root=/dev/sdb1 ro 
	initrd	(hd1,1)/boot/initrd.img-2.6.22-6-generic
}
menuentry "Debian GNU/Linux, linux 2.6.22-6-generic (single-user mode)" {
	linux	(hd1,1)/boot/vmlinuz-2.6.22-6-generic root=/dev/sdb1 ro single 
	initrd	(hd1,1)/boot/initrd.img-2.6.22-6-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	linux	(hd1,1)/boot/memtest86+.bin
}
### END /etc/grub.d/20_memtest86+ ###

Now it does look a lot like /boot/grub/menu.lst with the difference that this is generated on the fly.

The changes to new GRUB 2 when it hits stable is being able to use flash (some newer hard drives have flash memory embedded to have faster startup times) as well as compatible with linux bios, compatible with 2 BIOSes or more (workstation /server stuff) and numerous bug-fixes as compared to GRUB legacy was done. Also it would be more richer graphical.

Once that is done, & you reboot there is also a newer item called chainload to GRUB 2. This doesn't have any effect to my system as my system is around 3 yrs. old & cannot take the advantage of GRUB 2 as much as the newer systems so lot of things haven't been able to test.

The file list count has also gone up tremendously & hence the complexity but to end-user doesn't need to bother about this, but as we are techies here's the low-down.

Code:
Content of /boot/grub
ls -la
total 656
drwxr-xr-x 2 root root   4096 2007-06-10 22:30 .
drwxr-xr-x 3 root root   4096 2007-06-09 04:55 ..
-rw-r--r-- 1 root root   2256 2007-06-09 14:19 acorn.mod
-rw-r--r-- 1 root root   4840 2007-06-09 14:19 affs.mod
-rw-r--r-- 1 root root   2600 2007-06-09 14:19 amiga.mod
-rw-r--r-- 1 root root   2704 2007-06-09 14:19 apple.mod
-rw-r--r-- 1 root root   2600 2007-06-09 14:19 bitmap.mod
-rw-r--r-- 1 root root   2132 2007-06-09 14:19 blocklist.mod
-rw-r--r-- 1 root root    512 2007-06-09 14:19 boot.img
-rw-r--r-- 1 root root   1360 2007-06-09 14:19 boot.mod
-rw-r--r-- 1 root root   1880 2007-06-09 14:19 cat.mod
-rw-r--r-- 1 root root   2320 2007-06-09 14:19 _chain.mod
-rw-r--r-- 1 root root   1724 2007-06-09 14:19 chain.mod
-rw-r--r-- 1 root root   2212 2007-06-09 14:19 cmp.mod
-rw-r--r-- 1 root root    528 2007-06-09 14:19 command.lst
-rw-r--r-- 1 root root   1908 2007-06-09 14:19 configfile.mod
-rw-r--r-- 1 root root  27297 2007-06-09 14:19 core.img
-rw-r--r-- 1 root root   1592 2007-06-09 14:19 cpuid.mod
-rw-r--r-- 1 root root    197 2007-06-09 08:03 default
-rw-r--r-- 1 root root     45 2007-06-09 14:19 device.map
-rw-r--r-- 1 root root    512 2007-06-09 14:19 diskboot.img
-rw-r--r-- 1 root root   8660 2007-06-09 08:03 e2fs_stage1_5
-rw-r--r-- 1 root root   4492 2007-06-09 14:19 elf.mod
-rw-r--r-- 1 root root   4268 2007-06-09 14:19 ext2.mod
-rw-r--r-- 1 root root   4900 2007-06-09 14:19 fat.mod
-rw-r--r-- 1 root root   8452 2007-06-09 08:03 fat_stage1_5
-rw-r--r-- 1 root root   2576 2007-06-09 14:19 font.mod
-rw-r--r-- 1 root root   2592 2007-06-09 14:19 fshelp.mod
-rw-r--r-- 1 root root     56 2007-06-09 14:19 fs.lst
-rw-r--r-- 1 root root   6716 2007-06-09 14:19 gfxterm.mod
-rw-r--r-- 1 root root   2796 2007-06-09 14:19 gpt.mod
-r--r--r-- 1 root root   1034 2007-06-10 22:30 grub.cfg
-rw-r--r-- 1 root root   8232 2007-06-09 14:19 gzio.mod
-rw-r--r-- 1 root root   1536 2007-06-09 14:19 halt.mod
-rw-r--r-- 1 root root   1288 2007-06-09 14:19 hello.mod
-rw-r--r-- 1 root root   1988 2007-06-09 14:19 help.mod
-rw-r--r-- 1 root root   6500 2007-06-09 14:19 hfs.mod
-rw-r--r-- 1 root root   6400 2007-06-09 14:19 hfsplus.mod
-rw-r--r-- 1 root root     15 2007-06-09 08:04 installed-version
-rw-r--r-- 1 root root   5196 2007-06-09 14:19 iso9660.mod
-rw-r--r-- 1 root root   5140 2007-06-09 14:19 jfs.mod
-rw-r--r-- 1 root root   9152 2007-06-09 08:03 jfs_stage1_5
-rw-r--r-- 1 root root  31128 2007-06-09 14:19 kernel.img
-rw-r--r-- 1 root root   4876 2007-06-09 14:19 _linux.mod
-rw-r--r-- 1 root root   1576 2007-06-09 14:19 linux.mod
-rw-r--r-- 1 root root   3212 2007-06-09 14:19 loopback.mod
-rw-r--r-- 1 root root   3864 2007-06-09 14:19 ls.mod
-rw-r--r-- 1 root root   5128 2007-06-09 14:19 lvm.mod
-rw-r--r-- 1 root root   4221 2007-06-10 22:30 menu.lst
-rw-r--r-- 1 root root   4220 2007-06-09 14:20 menu.lst~
-rw-r--r-- 1 root root   4328 2007-06-09 14:19 minix.mod
-rw-r--r-- 1 root root   7860 2007-06-09 08:03 minix_stage1_5
-rw-r--r-- 1 root root    687 2007-06-09 14:19 moddep.lst
-rw-r--r-- 1 root root   5180 2007-06-09 14:19 _multiboot.mod
-rw-r--r-- 1 root root   1632 2007-06-09 14:19 multiboot.mod
-rw-r--r-- 1 root root  39400 2007-06-09 14:19 normal.mod
-rw-r--r-- 1 root root   3340 2007-06-09 14:19 pc.mod
-rw-r--r-- 1 root root   2204 2007-06-09 14:19 play.mod
-rw-r--r-- 1 root root   1024 2007-06-09 14:19 pxeboot.img
-rw-r--r-- 1 root root   4296 2007-06-09 14:19 raid.mod
-rw-r--r-- 1 root root   1272 2007-06-09 14:19 reboot.mod
-rw-r--r-- 1 root root  10132 2007-06-09 08:03 reiserfs_stage1_5
-rw-r--r-- 1 root root   3168 2007-06-09 14:19 search.mod
-rw-r--r-- 1 root root   4360 2007-06-09 14:19 sfs.mod
-rw-r--r-- 1 root root    512 2007-06-09 08:03 stage1
-rw-r--r-- 1 root root 110260 2007-06-09 08:04 stage2
-rw-r--r-- 1 root root   2552 2007-06-09 14:19 sun.mod
-rw-r--r-- 1 root root   1880 2007-06-09 14:19 terminal.mod
-rw-r--r-- 1 root root   7040 2007-06-09 14:19 terminfo.mod
-rw-r--r-- 1 root root   1664 2007-06-09 14:19 test.mod
-rw-r--r-- 1 root root   2952 2007-06-09 14:19 tga.mod
-rw-r--r-- 1 root root   4724 2007-06-09 14:19 ufs.mod
-rw-r--r-- 1 root root   2200 2007-06-09 14:19 vbeinfo.mod
-rw-r--r-- 1 root root  13944 2007-06-09 14:19 vbe.mod
-rw-r--r-- 1 root root   3076 2007-06-09 14:19 vbetest.mod
-rw-r--r-- 1 root root   3824 2007-06-09 14:19 video.mod
-rw-r--r-- 1 root root   2788 2007-06-09 14:19 videotest.mod
-rw-r--r-- 1 root root   6912 2007-06-09 14:19 xfs.mod
-rw-r--r-- 1 root root   9980 2007-06-09 08:03 xfs_stage1_5

The file count seems to be atleast double if not more for the graphical stuff. Would be testing that sometime soon.

Finally the info. about grub2

Code:
aptitude show grub2
Package: grub2
State: installed
Automatically installed: no
Version: 1.95+20070604-1ubuntu1
Priority: extra
Section: universe/admin
Maintainer: Ubuntu MOTU Developers <address@hidden>
Uncompressed Size: 156k
Depends: debconf, grub-pc
Description: GRand Unified Bootloader, version 2 (dummy package)
This is a dummy transitional package to handle GRUB 2 upgrades.  It
can be safely removed.
aptitude show grub-pc
Package: grub-pc
State: installed
Automatically installed: yes
Version: 1.95+20070604-1ubuntu1
Priority: extra
Section: universe/admin
Maintainer: Ubuntu MOTU Developers <address@hidden>
Uncompressed Size: 2400k
Depends: libc6 (>= 2.5-5), liblzo2-2
Conflicts: pupa, grub
Replaces: pupa, grub, grub2 (< 1.95+20070604-1ubuntu1)
Provides: grub
Description: GRand Unified Bootloader, version 2 (PC/BIOS version)
GRUB 2 (also known as PUPA) is the Preliminary Universal Programming
Architecture for GRUB. It is a research project for the next
generation of GNU GRUB. The most important goal is to make GNU GRUB
cleaner, safer, more robust, more powerful, and more portable.
GRUB 2 targets at the following goals:
* Scripting support, such as conditionals, loops, variables and functions.
* Graphical interface.
* Dynamic loading of modules in order to extend itself at the run
time rather than at the build time.
* Portability for various architectures.
* Internationalization. This includes support for non-ASCII character
code, message catalogs like gettext, fonts, graphics console, and so
  on.
* Real memory management, to make GNU GRUB more extensible.
* Modular, hierarchical, object-oriented framework for file systems,
files, devices, drives, terminals, commands, partition tables and OS
  loaders.
* Cross-platform installation which allows for installing GRUB from a
different architecture.
* Rescue mode saves unbootable cases. Stage 1.5 was eliminated.
* Fix design mistakes in GRUB Legacy, which could not be solved for
backward-compatibility, such as the way of numbering partitions.
This package contains a version of GRUB that has been built for use
with traditional PC/BIOS architecture.

This should work with Artful Dodger's tute to do graphical boot screens

http://www.techenclave.com/forums/linux-ubuntu-fedora-create-custom-boot-90162.html

Enjoy , cheers !
 
Gr8 guide . A que grub boot loader will only appear if more than 2 OS is installed ? If yes then useless for me cause I am on Single boot Feisty :)
 
Dark Star said:
Gr8 guide . A que grub boot loader will only appear if more than 2 OS is installed ? If yes then useless for me cause I am on Single boot Feisty :)

what do u mean by que boot loader?
The bootloader would appear also if single boot OS like feisty is there. Although somethings which I said in the guide is pertinent only with gutsy unless the new things are backported to feisty.
 
Very nice, will try it as per your guide, thank you very much :) I am currently using grub to boot Ubuntu Vista and Xp.

I should also get around to putting up a guide to triple boot using grub with method that bypasses Vista bootloader for Xp, using grub as a single bootloader for all OS's.... it's just a lot of info to organize :p
 
shirish said:
what do u mean by que boot loader?
The bootloader would appear also if single boot OS like feisty is there. Although somethings which I said in the guide is pertinent only with gutsy unless the new things are backported to feisty.

See I did not get boot loader after leaving BIOS secreen it directly boot into Ubuntu:eek:hyeah: and Ubuntu loading screen appears :S .. Thats what I was saying cause the delay time is so less that I can't see Boot loader :p :rofl:
 
Dark Star said:
See I did not get boot loader after leaving BIOS secreen it directly boot into Ubuntu:eek:hyeah: and Ubuntu loading screen appears :S .. Thats what I was saying cause the delay time is so less that I can't see Boot loader :p :rofl:

See this part in the menu.lst

Code:
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout		1000

That normally has 5 seconds, I changed it to 1000 seconds & ran the update-grub command, that should do the needful.
 
Another thing, there has been another update to grub2

Code:
aptitude show grub-pc
Package: grub-pc
State: installed
Automatically installed: yes
Version: 1.95+20070604-1ubuntu1
Priority: extra
Section: universe/admin
Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
Uncompressed Size: 2400k
Depends: libc6 (>= 2.5-5), liblzo2-2
Conflicts: pupa, grub
Replaces: pupa, grub, grub2 (< 1.95+20070604-1ubuntu1)
Provides: grub
Description: GRand Unified Bootloader, version 2 (PC/BIOS version)
 GRUB 2 (also known as PUPA) is the Preliminary Universal Programming
 Architecture for GRUB. It is a research project for the next generation of GNU
 GRUB. The most important goal is to make GNU GRUB cleaner, safer, more robust,
 more powerful, and more portable. 
 GRUB 2 targets at the following goals: 
 * Scripting support, such as conditionals, loops, variables and functions. 
 * Graphical interface. 
 * Dynamic loading of modules in order to extend itself at the run time rather
   than at the build time. 
 * Portability for various architectures. 
 * Internationalization. This includes support for non-ASCII character code,
   message catalogs like gettext, fonts, graphics console, and so on. 
 * Real memory management, to make GNU GRUB more extensible. 
 * Modular, hierarchical, object-oriented framework for file systems, files,
   devices, drives, terminals, commands, partition tables and OS loaders. 
 * Cross-platform installation which allows for installing GRUB from a different
   architecture. 
 * Rescue mode saves unbootable cases. Stage 1.5 was eliminated. 
 * Fix design mistakes in GRUB Legacy, which could not be solved for
   backward-compatibility, such as the way of numbering partitions. 
   
 This package contains a version of GRUB that has been built for use with
 traditional PC/BIOS architecture.

and things have changed drastically, things are in a flux so finding the changes & what to do about that.
 
Back
Top