Just booting tips


Page 1 of 4 1234 LastLast
Results 1 to 15 of 46

Thread: Just booting tips

  1. #1
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978

    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)
    Code:
    geometry (hd0)
    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 the same "setup (hd0)".
    Code:
    root (hd0,5)
    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.
    Code:
    fdisk /mbr
    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.
    Code:
    fixmbr
    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/hda
    exit
    reboot
    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 invoking a Grub shell (just type "grub" at root terminal).
    Code:
    root (hd0,3)
    setup (hd0)

    Your Linux will boot now if you issue commands
    Code:
    chainloader +1
    boot


    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.
    Code:
    mkdir /mnt/temp
    mount /dev/hda4 /mnt/temp
    chroot /mnt/temp
    grub-install /dev/hda
    exit
    reboot
    B6: To restore Grub into MBR for Linux that has a rescue function in the installation CD (e.g. Fedora Core)
    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:
    Code:
    chroot /mnt/sysimage
    grub-install /dev/hda
    exit
    reboot
    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
    Code:
    Boot up the installation DVD
    Choose a language
    Click "next"
    Click "Reapir your computer"
    
    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
    Code:
    bootrec /fixmbr
    bootrec /fixboot

    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 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.
    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

    To be continue in Post #3 (due to size limitation on post size)
    Last edited by saikee; 08-12-2012 at 05:51 PM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  2. #2
    Join Date
    Oct 2002
    Location
    Republic of Texas
    Posts
    5,898
    great job!
    this qualifies for the Help Library --> http://justlinux.com/forum/forumdisplay.php?f=49
    Need help in realtime? Visit us at #linuxnewbie on irc.libera.chat

    Few of us will do as much for our fellow man as he has done.
    --Andrew Morton on RMS

  3. #3
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    je_fro,

    Thanks. Is it possible for me to edit the sticky? I might have additional information or improvement later on. I use it to help others as well because I could just refere them to the Task number.

    So it wasn't you in my dream then!
    -------------------------------------------------------------------
    below is the continuation of Post #1 ( due to size limitation)


    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 (XP or Win2k) 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) This method works only if the Linux is chainloadable. See Section D for how to make a Linux chainloadable first.
    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
    
    Add C:\boot_hda8.lnx="My New Linux in hda8" to boot.ini, under the section "Operating system"
    save the file boot.ini
    
    attrib +r +s +h boot.ini
    Tip : Using a modern Linux way is a lot faster. Some modern Linux like Slax 6.0 is already shipped with ntfs-3g, gives root privilege to the user, mounts all partitions in the PC, sees every Windows hidden file and permits the boot.ini to be edited directly. So the work needed is just the Magenta bits as everything can be done in Slax Linux without booting up Xp.

    E5: To use Windows Vista or Windows 7 (bith 32 or 64 bit) 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 Vista is booted. (commands are showed in red) This method works only if the Linux is chainloadable. See Section D for how to make a Linux chainloadable first.
    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 Vista
    
    In Windows Vista right click "Command Prompt" and select "Run as Adminstrator"
    
    bcdedit /create /d "Linux_in_hda8" /application BOOTSECTOR
    
    bcdedit will issue a unique idenfier with a response like 
    
    The entry {c4c13df3-7949-11dc-98f8-81e4e48608ff} was successfully created.
    
    You shall use the given idenfier marked Magenta below for the next 3 steps
    
    bcdedit /set {c4c13df3-7949-11dc-98f8-81e4e48608ff} device boot
    
    bcdedit /set {c4c13df3-7949-11dc-98f8-81e4e48608ff} PATH \boot_hda8.lnx
    
    bcdedit /displayorder {c4c13df3-7949-11dc-98f8-81e4e48608ff} /addlast

    In the above the data in Magenta are input.

    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 (initially 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 terminal line 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
    
    (a) by booting a Linux Live CD
    
    mkdir /mnt/tmp
    mount /dev/hda8 /mnt/tmp
    ls /boot 
    
    (b) by booting a Grub floppy/CD to get a Grub prompt
    
    Use Task A4 to list Grub's configuration file  /boot/grub/menu.lst  
    
    or
    
    Use Task A5 to list Lilo's configuration file /etc/lilo.conf
    
    Stage (2) to boot the Linux directly (adjust the Green bits to suit your case)
    
    root (hd0,7)
    kernel /boot/vmlinuz-2.6.15-8-i386 ro root=/dev/hda8
    initrd /boot/initrd-2.6.15-8-i386
    boot
    Note : Task G2 is a method using Grub to boot up a Linux installed with Lilo as its boot loader.

    No need to type out every file name in full, just type part of it and use the "tap" key to let Grub to match what it can find for you


    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
    J3: To make a bootable Grub CD (for laptop users without a floppy drive)
    Note : There are two mthods. One is to use Linux's "mkisofs" command to turn Grub's file stage2_eltorito into an iso file and then burn it into a CD. The other is to burn a bootable Grub floppy into a CD using the emulation mode available in certain CD burners
    Code:
    Method (1) Follow Chapter 3.4 of the GNU/Grub official bible Grub Manual.
    (a) Need only one file "stage2_eltorito" from Grub 
    (b) Use the latest version of Grub whenever possible
    (c) Copy "stage2_eltorito" into designated directory in Linux
    (d) Create an iso file out of it by the "mkisofs" command
    (e) Burn the iso image into a CD, all done in Linux.
    
    Method (2) Follow the steps of this site
    
    (i) You need a bootable Grub floppy (See Task A).
    (ii) You also need Ahead's Nero Burning ROM software
    (iii) The resulting CD is an emulation of the "A" drive.
    (iv) No installed Linux needed and CD is created in Windows
    J4: From a Linux Live CD booted up by Grub instead of isolinux
    Note : At boot up screen press "Esc" key will change from graphic to text mode then press "c" key will get into a Grub prompt.
    Code:
    The following Linux and Solaris CD/DVD are booted by Grub instead of isolinux.  As such any one can provide a Grub prompt (First press "Esc"  key then "c" key) -- idea prompted by i845
    
    Mepis
    Frugalware
    Sidux
    Kanotix
    Yoper
    DreamLinux
    eLive
    Linux Gamer
    Belinix
    Solaris (both Version 10 and Express)
    
    Please note the list not exhaustive and changes can take place between releases
    Task K : Booting tasks with Grub2
    Note : Grub2 is now available hence some simple tasks are described below. In general a user can use Grub2 (version 1.x) substantially similar to Grub1 (version 0.9x) which is also known as Legacy Grub. The Grub2 prompt is again a major functionality similar in usage as Grub1 prompt.

    K1: How to make a bootable Grub2 floppy
    Note : Boot up a Linux Live CD that has Grub2. Go into the root console and issue these Bash commands.
    Code:
    
    grub-mkrescue --image-type=floppy /tmp/grub-rescue.flp
    dd if=/tmp/grub-rescue.flp of=/dev/fd0 bs=1024
    
    K2: How to make a bootable Grub2 CD
    Note : Boot up a Linux Live CD that has Grub2. Go into the root console and issue these Bash commands.
    Code:
    
    grub-mkrescue --image-type=cdrom /tmp/grub-rescue.iso
    wodim /tmp/grub-rescue.iso
    
    Alternatively with a more modern distro
    Code:
    
    grub-mkrescue --output=rescue.iso /boot/grub
    
    then use K3B to burn the iso file onto a CD.

    K3: How to ask Grub2 to replicate itself in the root partition of Linux (alternative to MBR and rendering the Linux "chainloadable")
    Note : Boot up any Linux Live CD. Goes into the root console. Mount the Linux that has Grub2 inside (say this is in partition ada9), chroot to it and issue these Bash commands. Due to the difference in Grub1 and Grub2 and not all Linux can change root to another this method has the best success if the original CD is used as the kernel and Grub2 would be the same.
    Code:
    
    mkdir /mnt/sda9
    mount /dev/sda9 /mnt/sda9
    chroot /mnt/sda9 
    grub-install --force /dev/sda9
    exit
    
    Alternative method without using chroot (recommended)

    Code:
    
    mkdir /mnt/sda9
    mount /dev/sda9 /mnt/sda9
    grub-install --root directory=/mnt/sda9 --force /dev/sda9
    exit
    
    If Grub2 were to be in the MBR of hard disk sda and the root partition of the Linux is sda9 then omit the partition reference in the grub-install command as follow

    Code:
    
    mkdir /mnt/sda9
    mount /dev/sda9 /mnt/sda9
    grub-install --root directory=/mnt/sda9 /dev/sda
    exit
    

    K4: How to use a Grub2 or CD to manually boot a chainloadable Linux
    Note : Remember in Grub2 the disk number starts at 0 (same as Grub1) but the partition starts at 1 (new change in Grub2)
    Boot up any Grub2 floppy or CD. If the chainloadable Linux is in partition sda9 issue these commands at a Grub2 command prompt.

    Code:
    
    set root=(hd0,9)
    chainloader +1
    boot
    
    K5: How to use a Grub1 prompt (off a floppy, CD or MBR) to manually boot a unbootable Linux directly with a failed Grub2
    Note : This is the case when Grub2 was originally in the MBR but has been overwritten rending the Linux unbootable. A Grub2 floppy/CD is not yet obtainable but an older version of Grub1 is available for use. The Grub1 or Legacy Grub is booted up to a Grub prompt. The unbootable Linux here is ada15 known to Grub as (hd0,14). The green bits show below are not typed by pressing the "tab" ket to get Grub to complete for us. In Linux 99.5% of the distros start the kernel names with "vmlinuz" and the ramdisk file name with "initrd" which are always stored in /boot directory. The below are no more than half guess and half filled in by Grub.

    Limitation - the Grub1 must be able to read the unbootable Linux partition. Newer Linux may have a Ext4 filing system that a standard Grub1 cannot read unless it has been modified to do so. If the partition has been formatted to the normal Ext2/3 filing system then the limitation does not apply. If the limitation is valid then Error 2 will be reported by Grub.


    Code:
    
    root (hd0,14)
    kernel /boot/vmlinuz-2.6.31-9-generic ro root=/dev/sda15
    initrd /boot/initrd.img-2.6.31-9-generic
    boot
    
    To be continue in Post #5 (due to size limitation on post size)
    Last edited by saikee; 08-12-2012 at 05:46 PM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  4. #4
    Join Date
    Apr 2001
    Location
    Vancouver, Canada
    Posts
    113
    Thanks for all the work you've done in posting your knowledge of booting. I found this through the mention in the Inquirer, and the links in your sig. This thread should help me fix a Vector Linux SOHO install that won't boot (and I even reinstalled it to fix the booting problem).

    I have another booting issue you might be able to offer advice on. I have a notebook with a Win2k and Ubuntu dual boot. Prior to this I tried to install WinXP with the machine's own restore disks. The restore disks booted to Win 98 Dos and appeared to run Ghost files, but the install failed on the second disk with read errors. It also gave read errors with another XP disk from my other notebook. My own burned Win2k slipstreamed with USP5.1 disk and the Ubuntu disk had no problems.
    But I digress. The failed restore left an "Intel boot agent" on the boot sector. It boots to that, which fails, and then Grub takes over and gives me my Ubuntu and Win2k choices. I'd like to get rid of the Intel boot agent so it would boot directly to Grub, but I've been afraid of messing up the boot sector and being left with an unbootable system.
    I'm guessing that some of your instructions above could be used to rewrite the MBR, but I'd like to get specific advice on how to proceed. Should I use a Win CD to restore the Win MBR, and then the Ubuntu CD to restore Grub? Would doing this overwrite the Intel boot agent, and would it restore my current Grub dual boot?

  5. #5
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Best bet is while booting up Ubuntu and in root terminal type
    Code:
    fdisk -l
    to see if there is any partition that you are not aware of.

    Grub only occupies the first 512bytes of the hard disk known as the MBR and you can restore Xp's MBR as often as you want. Equally booting any Live CD can allow you to restore Grub back into the MBR as stated in my booting tips.

    My guess is the vendor booting agent could have its own partition.

    Ghost does use Dos to restore and clone XP because XP does not permit itself to be cloned. You always need to run another OS to clone it. Your XP re-install may need the other systems clear out of the hard disk as it might need specific location of the hard disk to reside in ( for example it was mean to be reinstalled back to the second partition with the booting agent in the first.

    Equally you may be running out of a primary partition for XP to come back to.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  6. #6
    Join Date
    Apr 2001
    Location
    Vancouver, Canada
    Posts
    113
    Equally you may be running out of a primary partition for XP to come back to.
    Not sure precisely what you mean by this.

    I partitioned the disk with GParted before I did anything. I'll have to check again, but because I was only going to have three partitions and a swap, I may have left them all primaries. Experience also taught me to leave the first partition as unallocated space and let Windows partition and format it during the install. The third partition is for data, currently a hidden FAT32 that needs to be unhidden. Windows couldn't see the FAT32 created by GParted, and another partitioner had only the hidden option for a FAT32.
    The XP attempt was done over top of an existing Win2k install. Following that, Win2k was reinstalled. Prior to the original partition, the disk had zeros written with Dban.

  7. #7
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    You are only allowed 4 primaries in a hard disk. If you have logical partitions then one primary must be given up for exchange for an extended partition.

    I feel you definitely need to know your own partitioning scheme of the hard disk.

    I am not confiident of restoring a XP on top of a Win2k partition because the files are different in the two OSs. You may need to format the Win2k partition before letting XP to take up residence.

    Also i expect a Fat32 partition created and formatted in Linux to be recognised and used by Windows. If a Windows system doesn't see it then it is mostly likely the partition has not been formatted.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  8. #8
    Join Date
    Apr 2001
    Location
    Vancouver, Canada
    Posts
    113
    I knew about the 4 primaries. I spent several days partitioning and repartitioning a disk with GParted and fdisk (linux from a KnoppMyth disk) and it was a great learning process. By the time I partitioned this disk, I had a fairly good grasp of what I was doing. It's just that after a month and a half since I did it, I can't remember everything precisely. I just checked from within the Ubuntu install and it showed only 4 partitions, including the swap. I'll check again from bootable cd's, but it's not showing a partition for the Intel boot agent. I'm assuming the MBR is contained within the Win partition, which is the first on the disk.
    I've confused you. I tried to install XP from the restore disks, but for now 2k will stay on the drive and I'll use my 2k disk for any MBR repairs.
    Windows could not see the FAT32 partition (from its creation with GParted) in order to format it. That's why I tried another partitioner. I think I may just need a partitioner with more options, and then a bootable cd that can format in FAT32.

  9. #9
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    I use cfdisk mainly and fdisk for display the contents of the hard disks.

    The above partitioning programs DO NOT format the partitions. In fact I don't think any of them do except XP/Win2k's Disk Management which is a combination of the two.

    What you need to do is in Ubuntu to issue the mkdosfs command. If you want hda3 to be formatted in Fat32 just type
    Code:
    mkdosfs -F32 /dev/hda3
    It is a good practice to unmount the partition first if it has been mounted by Linux in any formatting.

    Ubuntu do a Live CD and with it you should be able to cure all the booting problems if you have any.
    Last edited by saikee; 02-14-2006 at 08:05 AM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  10. #10
    Join Date
    Apr 2001
    Location
    Vancouver, Canada
    Posts
    113
    I solved the FAT 32 partition problem with a linux disc that I think is called the System Rescue disk. It contains partitioning tools and one of them did the trick.
    I still haven't tackled the MBR issue. I will probably be reformatting the entire disk later this summer after the next version of Ubuntu comes out, and will likely try to get XP on the Win partition at that point.

  11. #11
    Join Date
    Jan 2004
    Location
    France
    Posts
    19
    saikee, those "Just boot tips" are just great
    Thank you for this yeah !
    Internet was created to share knowledge !
    Linux related howtos in French http://guides-info.org/linux/

  12. #12
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Glad it is of use to some. I just summarized the tips I picked up from the forum.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  13. #13
    Join Date
    Nov 2002
    Location
    Hermitage, TN, USA
    Posts
    778

    Thumbs up Re: Just booting tips

    Hello, 'saikee'.
    Quote Originally Posted by saikee
    Glad it is of use to some. I just summarized the tips I picked up from the forum.
    Although I realize that "me, too" replies have been a violation of "netiquette," since the early days of the BBS, FidoNet, and Usenet, I want to take a moment to express my gratitude for your thorough and well-written tips!

    I am about to start work on two Linux computers. The CentOS-based server should not pose any booting problems -- except for unexpected ones caused by "user error," but I plan to install Debian GNU/Linux on my workstation, after I install and stabilize SuSE Linux 10.1 (or, possibly, 10.0).

    Your booting tips will definitely be a comforting resource when I set up a Linux multi-boot environment. (I may even try to install the copy of FreeBSD 6.1 that I have had since June.)

    Thank you, 'saikee', for your many contributions to the JustLinux community!

    Cordially,

    David
    Last edited by DavidMD; 10-01-2006 at 09:17 PM.
    Linux Distribution: Debian GNU/Linux (Desktop & Server)


    Registered Linux User # 315892
    * * *
    <http://ddickerson.igc.org/>

    "In a world of absurdity, we must
    invent reason; we must create
    beauty out of nothingness."
    -- Elie Wiesel


    Gary Arthur Weaver: 18 July 1942 - 29 December 2006

  14. #14
    Join Date
    Dec 2002
    Location
    Montreal Canada
    Posts
    383
    Hey Thanks.
    That thread was not a waste of the company's ink and paper.

    Linux Counter


    Debian "Lenny"
    Mandriva 2010.2

    "Where am I?" "In the Village." "What do you want?" "Information.""Whose side are you on?" "That would be telling.... We want information. Information! INFORMATION!"

  15. #15
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    My face turns red when reading your compliements. I benefit a great deal from reading the JustLinux posts and comments from the moderators.

    I see this thread, an indeed myself, as an end product of the effort from various forum members/moderators in helping me to understand Linux since I joined as a newbie.

    I cut my teeth here and am pretty pround of it. I carry this thread (and some other JL threads) as signature in other forums too.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •