Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Sunday, November 6, 2011

Grub Rescue Image

from The Grub 2 Guide

A bootable Grub 2 rescue image is available for both floppies and CDs. To obtain the images, install “grub-rescue-pc”. Once installed, three images are available in /usr/lib/grub-mkrescue. Use the I]grub-mkrescue [/I] command to create the rescue ISO. See the MAN page for more information. Note: A customized rescue ISO only uses the current systems Grub 2 /boot/grub files. No information from /etc/grub.d or /etc/default/grub is imported. The ISO only boots to the grub prompt. It uses the Grub 2 files found on the ISO; if the problem is with the system’s Grub 2 files the rescue ISO should boot. However, the ISO contains no kernels and must be told where to find the correct kernel and initrd files on the system. The user must know the drive/partition on which the boot files are located and the non-Grub files must exist and be uncorrupted.
If the user hasn’t made a rescue floppy/ISO, other alternatives include the Ubuntu Installation/LiveCD or SuperGrub Disk.
  • grub-rescue-floppy.img – For floppy images.
    • To Install:
    • Insert a disk in the floppy drive.
    • Code:
      fdformat /dev/fd0
      mkfs -t msdos /dev/fd0
      dd if=/usr/lib/grub-rescue/grub-rescue-floppy.img of=/dev/fd0
  • grub-rescue-cdrom.iso – When burning the image to a CD, select the option to copy an image and not the files.
    • Generate the image using the following command:
      • Code:
        grub-mkrescue --output=
    • If an error message “/usr/bin/grub-mkrescue: 324: xorriso: not found”, install the xorriso package and rerun the command.
    • Copy the ISO image to a CD using the CD burning app of your choice.
Once the grub rescue floppy/CD boots to the grub prompt, run the following commands.
The commands are slightly different than those used for booting by other means. The Grub 2 files on the floppy/CD are used, and only the kernel and initrd.img files need to be loaded.
Command line tips:
  • Drives start counting at 0 (sda=0, sdb=1, etc). Partitions start counting at 1 (1=1, etc). Substitute the correct drive letter for X, correct number for Y, and substitute the correct numbers for (hd0,1).
  • You must type the entire path and kernel and initrd names if (hdX,Y)/vmlinuz and (hdX,Y)/initrd.img do not exist. You can check by running this command:
    • ls (hdX,Y)/
    If vmlinuz and initrd.img do not exist at (hdX,Y)/, you can simplify the typing using the TAB complete feature.
  • On the linux line, type “vml” and then TAB to help complete the kernel number. Ensure the complete kernel name is entered. Be sure to fill the kernel number completely, and don’t forget the “root=” and “ro” sections of the linux line.
  • On the initrd line, type “ini” and TAB to fill in a large part of the name. Continue typing/TABBING to ensure the complete .img name is used.
  • Sections in bold should be changed to match the user’s system.
Code:
set root=(hd0,1)
linux (hdX,Y)/vmlinuz root=/dev/sdXY ro
# or if (hdX,Y)/vmlinuz does not exist:
linux (hdX,Y)/boot/vmlinuz-2.6.32.25-generic root=/dev/sdXY ro
# then
initrd (hdX,Y)/boot/initrd.img
# or if (hdX,Y)/initrd.img does not exist:
initrd (hdX,Y)/boot/initrd.img-2.6.33-25-generic
boot

No comments: