0% found this document useful (0 votes)
106 views3 pages

HOWTO: Boot & Install Ubuntu From The Grub Rescue Prompt: Preconditions

This document provides instructions for booting an Ubuntu Live CD ISO from the Grub rescue prompt without requiring a physical CD. It details loading the necessary Grub modules from a previous Ubuntu installation, locating the ISO file, creating a loopback device, and loading the Linux kernel and initrd image to boot the Ubuntu live environment entirely from the hard disk. The instructions should work for corrupted or missing Grub configurations, as long as the underlying Grub modules and Ubuntu ISO file are accessible.

Uploaded by

luisfranc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views3 pages

HOWTO: Boot & Install Ubuntu From The Grub Rescue Prompt: Preconditions

This document provides instructions for booting an Ubuntu Live CD ISO from the Grub rescue prompt without requiring a physical CD. It details loading the necessary Grub modules from a previous Ubuntu installation, locating the ISO file, creating a loopback device, and loading the Linux kernel and initrd image to boot the Ubuntu live environment entirely from the hard disk. The instructions should work for corrupted or missing Grub configurations, as long as the underlying Grub modules and Ubuntu ISO file are accessible.

Uploaded by

luisfranc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

http://ubuntuforums.org/showthread.php?

t=1599293
HOWTO: Boot & Install Ubuntu from the Grub Rescue
Prompt
This guide will detail how to boot an Ubuntu Live CD ISO from the "grub rescue>" prompt. The procedure will also work from the "grub>"
prompt for Grub 2 users. I started this thread to help netbook users who are unable to mount the Live CD to resolve Grub problems on a
previously-working installation. No CD is required. While writing the guide, I realized there might be others who could also use the
instructions so I removed references to "Netbook" from the title.

Preconditions
This procedure will work for:

 Ubuntu family releases using Grub 2


 Malformed Grub 2 menu (grub.cfg)
 Missing Linux kernels & initramfs images
 Corrupted system folders (not including the module folder)

In order for this procedure to work, you must:

 Have an Ubuntu family Live CD ISO image on a partition accessible from the Grub rescue prompt.
 Grub modules from a previous installation must be found and properly loaded.

The procedure will not work for:

 Missing Grub 2 modules (normally in /boot/grub or /usr/lib/grub/i386-pc )


 Corrupted Ubuntu ISO images
 Corrupted partition structure - "ls" returns only "(hd0)"

Boot Procedure

1. Download the ISO.


o Download an Ubuntu ISO from: http://www.ubuntu.com/desktop/get-ubuntu/download
or
o Download an Ubuntu Netbook ISO from: http://www.ubuntu.com/netbook/get-ubuntu/download

2. Locate the Ubuntu partition and the folder containing the Grub modules.
The Grub folder containing the modules must be located so the correct modules can be loaded. This folder would have been
created during the initial installation of Ubuntu and should be located in the Ubuntu partition. This folder would normally be
located at either (hdX,Y)/boot/grub or (hdX,Y)/usr/lib/grub/i386-pc

Find your existing Ubuntu partition and the module folder. 

Code:

ls # List the known drives (hdX)


and partitions (hdX,Y)
ls (hdX,Y)/ # List the contents of the
partition's root
ls (hdX,Y)/boot/grub # Normal location of the Grub
2 modules.
ls (hdX,Y)/usr/lib/grub/i386-pc # Alternate location of the
Grub 2 modules.

o ls - should return all known drives (hdX) and partitions (hdX,Y)
o ls (hdX,Y)/ - should show the contents of the root directory of the partition.
 If you get an "error: unknown filesystem" this is not your Ubuntu partition; more on that later.
 If this is the Ubuntu partition, you will see the Ubuntu folders,
including lost+found/, home/, boot/ andvmlinuz and initrd.img. Use this address as the first part of the
next command.
o ls (hdX,Y)/boot/grub - should display several dozen *.mod files. This is the folder you are looking for.
 If you don't find the modules, try the alternate location: ls (hdX,Y)/usr/lib/grub/i386-pc
3. Load the modules.

Code:

set prefix=(hdX,Y)/<path to modules>

This command must correctly point to the folder containing the Grub modules. The address should be the one in the previous
section which displayed the modules.
Examples: 
set prefix=(hd0,5)/boot/grub 
set prefix=(hd1,1)/usr/lib/grub/i386-pc

Load modules:

Code:

insmod linux
insmod loopback
insmod iso9660
insmod fat # If ISO is located on fat16 or fat32
formatted partition.
insmod ntfs # If ISO is located on an NTFS formatted
partition.
insmod nftscomp # If NTFS compression is used on the
partition. Load if you aren't sure.

A "file not found" error means that the path in the prefix is incorrect or the specific module does not exist. The prefix setting
may be reviewed with the set command. Rerun the "set prefix=" command with the proper path.

4. Locate the Ubuntu ISO file.


Using the same combinations of ls commands, locate the Ubuntu ISO image. 

Code:

ls (hdX,Y)/

o You are looking for contents including the ISO, such as ubuntu-10.04.1-desktop-i386.iso
o Expand the path if the ISO image is not located in the / folder.
o If you receive an error: unknown filesystem you may need to load the filesystem module (such as ntfs or fat.
Return to the previous section for guidance.

5. Create the loopback device.

Code:

loopback loop (hdX,Y)/<path to ISO>/<ISO-name.iso>

Example: 
loopback loop (hd1,1)/ubuntu-10.04.1-desktop-i386.iso

6. Load the Linux kernel and initrd image.

Code:

set root=(loop)
linux /casper/vmlinuz boot=casper iso-scan/filename=/<ISO-
name.iso> noprompt noeject
initrd /casper/initrd.lz

If the path to the ISO or filename is not correct, the boot will halt at the BusyBox screen and produce a message stating "can't
open /dev/sr0: No medium found".
Note: If the ISO file is not in the / folder, include the path in the iso-scan/filename= entry. See second example.

Examples: 
linux /casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-10.04.1-desktop-i386.iso
linux /casper/vmlinuz boot=casper iso-scan/filename=/my-iso/ubuntu-10.04.1-desktop-i386.iso

7. Boot.
That should be it. If the commands ran without any messages/errors, the commands were accepted as entered. It's now time
to boot:

Code:

boot

You might also like