The original of this thread is being maintained at this location. Sorry for any inconvenience. Please click the maintained version for the lastest development
To make the subject less boring I tell you my nightmare instead.
It concerns a JL moderator walking angrily towards me, point the two most lethal booting weapons to my head, on his right hand a Linux Live CD and on the left a Grub floppy, shouting
“You have been with JustLinux Forum for 1.5 year, What have you learned?”
I murmured "Just booting tips"
Below is the confession he made me to sign.
------------------------------------------------------------------
Task A : Tasks one can perform with a bootable Grub floppy
Note : A Grub floppy can be used to boot up any operating system in a PC. It all depends how it is used. The above Grub floppy is unattached to an operating system and can be created by following Chapter 3.1 of the Grub Manual or Chapter 4 of "Linux in a Nutshell" Siever, Figgins and Webbers". For users having no access to an installed Linux the required stage1 and stage2 files can be obtained from a Linux Live CD that has Grub inside. Suitable Live CDs are Mepis, Ubuntu, Puppy, Damn Small Linux, Linux Rescue CD, Kanotix, Knoppix.......
A1: To find out partitioning scheme of 1st bootable disk
Note : For 2nd, 3rd and 4 disk use disk designations (hd1), (hd2) and (hd3) respectively (Grub counts from 0)
A2: Ask Grub to report any partition that has Grub inside
Note : /boot/grub is the designated location for storing Grub’s menu.lst
Code:
find /boot/grub/menu.lst
A3: Ask Grub to report a partition that has Lilo inside
Note : /etc/lilo.conf is the designated Lilo’s configuration file
Code:
find /etc/lilo.conf
A4: To display Grub's configuration in partition hda8
Note : One can follow the displayed instructions on the screen, line by line, to boot up the Linux manually (partition hda8 is just an example)
Code:
cat (hd0,7)/boot/grub/menu.lst
A5: To display Lilo’s configuration in partition hda8
Note : One can follow the Lilo instructions and pick out the relevant information for Grub to boot up the Linux manually
Code:
cat (hd0,7)/etc/lilo.conf
A6: To boot a Linux in hda8 with a workable Grub menu.lst
Note : The Linux will boot if its /boot/grub/menu.lst is in working order
Code:
configfile (hd0,7)/boot/grub/menu.lst
A7: Use Grub data in partition (hda,6) to setup Grub boot loader in MBR
Note : For the last line "setup (fd0)" will make Grub go to a bootable floppy (fd0) and "setup (hd0,5)" will make Grub go inside the root partition (hd0,5). For Grub going to MBR of 1st boot Sata disk use "setup (sda)".
Code:
root (hd0,5)
setup (hd0)
Task B : To restore the MBR of Dos, Windows, Lilo or Grub
Note : The MBR is the first 512 bytes of the first bootable disk. It is read by the BIOS when the machine is powered up. A boot loader installed there controls which system is to be booted next. A boot loader is rarely deleted. It is often overwritten by another boot loader with special commands which are described below. (A boot loader is not part of the filing system and so cannot be get rid of by the format command)
B1: To restore Dos/Windows MBR with a bootable floppy
Note : MS systems have a common MBR and XP/Win2k MBR can also be restored by a Dos floppy. A bootable Dos floppy needs "fdisk.exe" inside.
B2: To restore Dos/Windows MBR with an installation CD
Note : MS systems have a common MBR. A Dos-based system's MBR can also be restored by a NT version Windows installation CD. Any Win2k or XP installation CD will do the job
B3: To restore Lilo from Linux partition hda4 into MBR by Live CD
Note : As an example hda4 being the Linux’s root partition. This method requires a Live CD. Normally any Live CD will do.
Code:
mkdir /mnt/temp
mount /dev/hda4 /mnt/temp
chroot /mnt/temp
lilo –b /dev/hda4
B4: To restore Grub from Linux partition hda4 into MBR by Grub floppy
Note : The Grub floppy boots to a Grub prompt. Can be done equally with a Live CD with a Grub inside, by ivoking a Grub shell (just type "grub" at root terminal).
Code:
root (hd0,3)
setup (hd0)
B5: To restore Grub from Linux partition hda4 into MBR by Live CD
Note : This method requires a Live CD. If this method fails just type "grub" to invoke a Grub shell and use Task B4 method which is more robust. Grub can boot operating systems in a Grub prompt.
Code:
mkdir /mnt/temp
mount /dev/hda4 /mnt/temp
chroot /mnt/temp
grub-install /dev/hda4
Task C: To boot Dos, Windows, BSD or Solaris using a Grub floppy
Note : This is using a Grub floppy to boot a non-Linux system. See later Tasks D to H for booting Linux
C1: To boot any Dos or Windows from 1st bootable disk by Grub floppy
Note : For system in 2nd, 3rd or 4th primary partition use (hd0,1), (hd0,2) and (hd0,3) in the root statement. Makeactive statement is only needed if there is another system using the bootable flag in the same drive. MS System is in the first partition of the bootable drive.
Code:
root (hd0,0)
chainloader +1
makeactive
boot
C2: To boot any Dos or Windows from 2nd bootable disk by Grub floppy
Note : System installed in 1st bootable drive but later moved to 2nd drive. The two map statements let the MS system reclaim the 1st bootable disk status.
Code:
root (hd1,0)
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1
makeactive
boot
C3: To boot multiple installations of Dos and Windows by Grub floppy
Note : System was originally installed in 1st bootable drive 2nd partition and has another MS system in front. Later the disk was moved to 4th disk position.
Code:
root (hd3,1)
hide (hd3,0)
unhide (hd3,1)
map (hd3) (hd0)
map (hd0) (hd3)
chainloader +1
boot
C4: OpenBSD, NetBSD, FreeBSD, Dragonfly BSD, Desktop BSD and PcBSD
Note : Need to deny the BSD installer access to the MBR during installation to force it to place its boot loader in the root partition
Code:
Same as Dos/Windows system, see Task C1
C5: Solaris 10 and Express
Note : Need to deny the Solaris installer access to the MBR during installation to force it to place its boot loader in the root partition
Code:
Same as Dos/Windows system, see Task C1
Task D : Make a Linux chainloadable by Ntldr, Lilo or Grub
Note : A Linux is chainloadable if it has a boot loader inside its root partition. This allows another system's boot loader, for example Ntldr from XP or Win2k, Lilo or Grub from another Linux, to boot it. In chainloading a boot loader A boots a second boot loader B. It is up to the second boot loader B to boots its own master.
D1: To make a Linux "chainloadable in partition hda8 with Grub by a Grub floppy
Note : Can be done with a Live CD if it has Grub inside.
Code:
root (hd0,7)
setup (hd0,7)
D2: To make a Linux "chainloadable in partition hda8 with Grub by a Live CD
Note : If grub-install fails then invoke a Grub shell and try Task D1 as it is more robust.
Code:
mkdir /mnt/temp
mount /dev/hda8 /mnt/temp
chroot /mnt/temp
grub-install /dev/hda8
D3: To make a Linux "chainloadable in partition hda8 with Lilo by a Live CD
Note : If Lilo fails you may have to boot the system up manually by Grub. See Tasks F & G
Code:
mkdir /mnt/temp
mount /dev/hda8 /mnt/temp
chroot /mnt/temp
lilo –b /dev/hda8
D4: To make Linux chainloadable that has a rescue section in the installation CD
Note : Only works if the Linux installation CD has such a facility. The principle steps used are similar to Tasks D2 & D3.
Code:
Boot up the Linux installation CD
follow the instructions to re-install the boot loader
and choose the root partition as the destination
Task E : To boot a Linux with a boot loader inside its root partition
Note : A Linux is very easy to boot if it has a boot loader inside its root partition. Both Grub and Lilo can boot such a Linux with 2 generic lines.
E1: Using a Grub floppy to boot a chainlaodable Linux with Grub or Lilo in partition hda8.
Note : See Task D on how to make a Linux chainloadable. This method works for both Lilo and Grub. The tool used is the Grub floppy
Code:
root (hd0,7)
chainloader +1
boot
E2: To add another Linux in hda8 to a working Grub configuration file
Note : The working Grub is the one the PC boot to and its configuration file is /boot/grub/menu.lst. Grub has no difficulty in accepting over 100 systems in /boot/grub/menu.lst
Code:
root (hd0,7)
chainloader +1
boot
E3: To add another Linux in hda8 to a working Lilo configuration file
Note : The working Lilo is the one the PC boot to and its configuration file is /etc/lilo.conf. Depending on the version of the Lilo a maximum of 27 images can be booted by a /etc/lilo.conf
Code:
other=/dev/hda8
label=Linux_in_hda8
E4: To use Windows Ntldr to boot a chainlaodable Linux in partition hda8.
Note : The file boot_hda8.lnx is the first 512 bytes of Linux boot loader in partition hda8. It has to be copied into the partition where XP/Win2k is booted. (commands are showed in red)
Code:
In Linux :- Copy the first 512 bytes into a file
dd if=/dev/hda8 of=boot_hda8.lnx bs=512 count=1
then copy the file boot_hda8.lnx into "C" drive of Windows
In Windows
cd \
attrib -r -s -h boot.ini
edit boot.ini
then add "C:\boot_hda8.lnx "My New Linux in hda8" to boot.ini
save the file boot.ini
attrib +r +s +h boot.ini
Task F : To boot a Linux with no boot loader inside its root partition
Note : The easy way is to install the boot loader of the Linux in its root partition. Many Linux users put a Linux boot loader into the MBR but do not realise it can be put inside the root partition also. If Task F fails to work try Task G.
F1: Any Linux say with root partition hda8.
Note : To make the Linux chainloadable is easier for booting purpose. Method works on any Linux with either Grub or Lilo as the boot loader.
Code:
(1) Follow Task D to install boot loader inside Linux root partition
(2) Follow Task E to boot the Linix
Task G : To boot a Linux that cannot be chainloaded, initally by a Grub floppy
Note : When a Linux cannot be chainloaded then its boot loader cannot boot itself at the installed position. Likely cause is beyond 137Gb barrier in the hard disk or in a high-partition number the Linux doesn't support. The Linux in this case has to be booted directly by naming its kernel and initrd filenames. Initially the Linux is booted by a Grub floppy manually. Once in working order just put the manual instructions into a /boot/grub.menu.lst.
G1: Linux uses Grub still has a menu.lst but cannot be chainloaded, root partition being hda8.
Note : If root partition is unknown use Task A2 to find it out. The initrd statement is optional and may not be used by a Linux like those from the Slax or Slackware families.
Code:
(1) To display Grub’s menu.lst on the screen by
cat (hd0,7)/boot/grub/menu.lst
(2) Type its content at the terminalline by line
starting with the “root” statement
and finish with “initrd” statement if used
(3) Boot the system up with this additional line
boot
G2: Any Linux that uses Grub or Lilo as the boot loader, assuming root partition being hda8.
Note : The Linux is assumed to have no configuration file of /boot/grub/menu.lst or /etc/lilo.conf. To use the Live CD to find out the full name of vmlinuz and initrd in /boot directory of the Linux for Stage (1), say they are vmlinuz-2.6.15-8-i386 and initrd-2.6.15-8-i386 then use them in Stage (2). If the Linux refuses to boot then review the error message to introduce addition parameters to pass on during boot time. From experience most Linux will answer the call. If the Linux is stubborn and refuses to boot altering “ro” to “rw” in Task G2 may be able to kick start it.
Code:
Stage (1) to obtain kernel and initrd filenames
mkdir /mnt/tmp
mount /dev/hda8 /mnt/tmp
ls /boot
Stage (2) to boot the Linux directly
root (hd0,7)
kernel /boot/vmlinuz-2.6.15-8-i386 ro root=/dev/hda8
initrd /boot/initrd-2.6.15-8-i386
boot
Task H : Possible tasks with a Linux Live CD on an unbootable Linux
Note : Using a Live CD to rescue an unbootable Linux is a new and reliable method. Together with a Grub floppy there should be no Linux unbootable.
H1: To acess the files of the unbootable Linux, say in partition hda9
Note : Need to log in as root user, use "su" or add "sudo" in front of the privileged commands
Code:
mkdir /mnt/hda9
mount /dev/hda9 /mnt/hda9
H2: To get inside the unbootable Linux in hda9
Note : It is possible some Live CDs may disallow “chroot” unless log in as root. After the "chroot" statement the user will ne inside the unbootable Linux
Code:
mkdir /mnt/hda9
mount /dev/hda9 /mnt/hda9
chroot /mnt/hda9
Task J : Possible alternatives to obtain a Grub prompt to help booting
Note : The Grub floppy produces a Grub prompt with which a user can boot any PC system. The Grub prompt is always available from the following alternatives
J1: From a Linux with a plain Grub menu with option to edit the menu at the bottom
Note : Majority of distros has a plain menu with a splash screen at the background. The bottom of the menu border shows a few lines of instructions The last few words of the last line is "c" for a command-line.
Code:
press "c" to trigger a Grub prompt
J2: From a Linux with a Grub menu with option to edit the menu "hidden"
Note : Putting a "#" in front of the "fgxmenu" statement will disable that statement, allowing the plain menu to be shown again. Distros uses the gfxmenu statement include Suse and Kanotix.
Code:
(1) Edit the Linux's /boot/grub/menu.ls
(2) Put a "#" in front of the "fgxmenu" statement
(3) Follow instruction of Task J1