Just booting tips
To make the subject less boring I tell you my nightmare instead.
It concerns a JL moderator walking angrily towards me, holding the two most lethal booting weapons pointing 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.
Note : Many moderators taught me a lot of Linux here. That is why they are mentioned first. In real life they are always kind and patient with me. To tackle booting problems one needs tools and the above two lethal weapons are all I use in Linux.
-----edited 30/4/10 Task K3 added more explanation and recommended "--force" parameter to be adopted
-----edited 14/9/09 Task (K1 to K5) added for booting tips with Grub2
-----edited 15/2/06 Task J3 added------------------------
-----edited 24/2/07 Task B3, B4 & B5 edited, B6 added some tips transferred to Post #3 to ease space-----
-----edited 15/4/07 Task B7 added for restoring Vista MBR --------------
-----edited 16/9/07 A warning added on the change of device names----------
-----edited 21/10/07 Task J4 added showing a Grub prompt otainable from certain Linux/Solaris CD/DVD----------
-----edited 3/11/07 Task E5 added showing how to use Vista to boot Linux----------------
-----edited 26/3/09 Task B7 & E5 added references to restore the MBR and multi-boot for Windows 7
-----edited 26/8/09 Task B7 edited to add manual commands to restore MBR and boot code for Vista/Win7
-----edited 12/8/12 Task K3 edited to restoring Grub2 in root partition as well as in MBR
Please note working with boot loaders in Linux requires root privileges. This can be obtained by
(1) log in as root (for Slax, Fedora, Mandriva etc),
(2) log in as default user, then issue "su" at terminal followed by root password (for Suse, Knoppix etc) or
(3) log in as default user and preceed every system-related command with "sudo" (for Deibian, Ubuntu etc).
(4) Kernel 2.6.20 and newer cease to support Pata disk device names like hda, hdb, hdc and hdd. All SCSI/Pata/Sata/USB disks are all called sda, sdb, sdc, sdd, sde, sdf, etc. Please be aware and make suitable adjustment to suit your circumstance.
Task A : Tasks one can perform with a bootable Grub floppy, Grub CD or Grub prompt
Note : A Grub floppy or a Grub CD can be created unattached to an operating system. A Grub prompt is running Grub before a Linux is loaded. At this stage Grub is capable of booting any PC system.
To make obtain a Grub floppy -- Following Chapter 3.1 of the Grub Manual or Chapter 4 of "Linux in a Nutshell" Siever, Figgins and Webbers".
For making a Grub CD -- Follow Chapter 3.4 of the Grub Manual. See also Task J3 for additional details.
If you do not have an installed Linux to obtain the required stage1 and stage2 files for making Grub floppy or Grub CD you can "source" these files from any Linux Live CD that has Grub inside. Suitable Live CDs are Mepis, Ubuntu, Puppy, Damn Small Linux, Kanotix, Knoppix.......
For obtaining a Grub prompt see Task J for alternatives
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
A3: Ask Grub to report a partition that has Lilo inside
Note : /etc/lilo.conf is the designated Lilo’s configuration file
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)
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
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
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 the same "setup (hd0)".
Task B : To restore the MBR of Dos, Windows (Win9x, Win2k, XP, Vista or Windows 7), 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. Just boot up the installation CD, choose recovery console and type the command below.
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.
B4: To restore Grub from Linux partition hda4 into MBR by Grub floppy
mount /dev/hda4 /mnt/temp
lilo –b /dev/hda
Note : The Grub floppy boots to a Grub prompt. Can be done equally with a Live CD with a Grub inside, by invoking a Grub shell (just type "grub" at root terminal).
Your Linux will boot now if you issue commands
B5: To restore Grub from Linux partition hda4 into MBR by Live CD
Note : This method requires a Live CD. The method works for some but not all CD. Generally the CD should be from the same family. For example Ubuntu CD can chroot Debian, some Gentoo, Red Hat, Mandriva. 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.
B6: To restore Grub into MBR for Linux that has a rescue function in the installation CD (e.g. Fedora Core)
mount /dev/hda4 /mnt/temp
Note : This method requires the distro installation CD. Just boot up the installation CD and activate the rescue mode. For example in Fedora the command is "linux rescue". The installer will search your hard disk to find a copy it recognises and may require you to specify the root partition of the Linux you want to rescue. You should choose one that has "(/)" indicated if you are not sure. Basically the installer mounts it automatically for you using a standard name like "/mnt/sysimage" as in Fedora. Assuming that is the case you are restoring Grub same as Task B5 except with a different mounting point as follow:
B7: To restore the MBR of Windows Vista (same for Windows 7) by the installation DVD
Note : This method requires Vista installation DVD. When you carry out the instructions listed below a copy of Vista's MBR will be restore into your hard disk
Further information to use Vista/Win7 installation CD rescuing its MBR. If the booting instructions, listed by command "bcdedit /enum", are still available Vista's (or Win7's) MBR and boot code can be manually restored by booting up "any" Vista (or Win7) DVD and execute these two commands at Commond Prompt
Boot up the installation DVD
Choose a language
Click "Reapir your computer"
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.
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.
C3: To boot multiple installations of Dos and Windows by Grub floppy
map (hd1) (hd0)
map (hd0) (hd1)
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.
C4: OpenBSD, NetBSD, FreeBSD, Dragonfly BSD, Desktop BSD and PcBSD
map (hd3) (hd0)
map (hd0) (hd3)
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
C5: Solaris 10 and Express
Same as Dos/Windows system, see Task C1
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
Task D : Make a Linux chainloadable by Ntldr, Lilo or Grub
Same as Dos/Windows system, see Task C1
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 or Live CD
Note : Can be done either in a Grub prompt from a bootable Grub floppy or in a Grub shell from a Live CD if it has Grub inside.
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.
D3: To make a Linux "chainloadable in partition hda8 with Lilo by a Live CD
mount /dev/hda8 /mnt/temp
Note : If Lilo fails you may have to boot the system up manually by Grub. See Tasks F & G
D4: To make Linux chainloadable that has a rescue section in the installation CD
mount /dev/hda8 /mnt/temp
lilo –b /dev/hda8
Note : Only works if the Linux installation CD has such a facility. The principle steps used are similar to Tasks D2 & D3.
Boot up the Linux installation CD
follow the instructions to re-install the boot loader
and choose the root partition as the destination
To be continue in Post #3 (due to size limitation on post size)
Last edited by saikee; 08-12-2012 at 06:51 PM.