Ubuntu Linux Install Error: “'grub-install /dev/sdb' failed”

By Xah Lee. Date:

in the year of our load 2012, installing a clean Linux from CD fails flat on its face, because it's Linux!

so, i got a old (~2005) laptop and wanted to Ubuntu. Downloaded the installer, burned it on a DVD, inserted to laptop, rebooted, and got the step-by-step install GUI screen. All good, until, near the end, i got this error:

Executing 'grub-install /dev/sdb' failed. This is a fatal error.

WTF is “grub” and WTF is “sdb”? Turns out, GRUB is the critical software for machine to start (called bootloader), and “sdb” is actually the CD drive. So, Ubuntu wants to install the Operating System onto the CD it's running from. Can Quality Assurance be possibly worse than this? Viva Linux!

For the record, this is “ubuntu-12.04.1-desktop-i386.iso”.

(my first Linux installation is 1998, MkLinux and Debian Linux.)

Solution

Try re-install, and it should work. Choose the main hard-disk partition to put the “GRUB” on (that's usually /dev/sba).

Tech Info on Booting

Here's some relevant tech info.

GNU GRUB

GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system's partitions.

Typically, “sda” is your main storage device (e.g. the hard-disk main partition). You want to install grub there.

Disk partitioning

Disk partitioning is the act of dividing a hard disk drive into multiple logical storage units referred to as partitions, to treat one physical disk drive as if it were multiple disks.

On Linux, you can see partitions by df -sk or sudo fdisk -l /dev/sda. Things like “/dev/sda”, “/dev/sda1”, “/dev/sdb” are names of different devices. You can look at your partitions visually by sudo cfdisk.

BIOS

BIOS (Basic Input/Output System) is a de facto standard defining a firmware interface.

The BIOS software is built into the PC, and is the first code run by a PC when powered on ('boot firmware'). When the PC starts up, the first job for the BIOS is the power-on self-test, which initializes and identifies system devices such as the CPU, RAM, video display card, keyboard and mouse, hard disk drive, optical disc drive and other hardware. The BIOS then locates boot loader software held on a peripheral device (designated as a 'boot device'), such as a hard disk or a CD/DVD, and loads and executes that software, giving it control of the PC. This process is known as booting.

BIOS software is stored on a non-volatile ROM chip on the motherboard. It is specifically designed to work with each particular model of computer, interfacing with various devices that make up the complementary chipset of the system. In modern computer systems, the BIOS chip's contents can be rewritten without removing it from the motherboard, allowing BIOS software to be upgraded in place.

A BIOS has a user interface (UI), typically a menu system accessed by pressing a certain key on the keyboard when the PC starts. In the BIOS UI, a user can:

Boot sector

A boot sector or boot block is a region of data storage device that contains machine code to be loaded into random-access memory (RAM) by a computer system's built-in firmware. The purpose of a boot sector is to allow the boot process of a computer to load a program stored on the same storage device.

On an IBM PC compatible machine, the BIOS selects a boot device, then copies the first sector from the device, into physical memory at memory address 0x7C00.

Master boot record

A Master Boot Record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. The MBR holds the information on how the logical partitions, containing file systems, are organized on that medium. Besides that, the MBR functions as an operating system independent chain boot loader in conjunction with each partition's Volume Boot Record (VBR).

MBRs are not present on non-partitioned media like floppies, superfloppies or other storage devices configured to behave as such.

Ext4

The ext4 or fourth extended filesystem is a journaling file system for Linux, developed as the successor to ext3.

File system

A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data as well as manage the available space on the device(s) which contain it. A file system organizes data in an efficient manner and is tuned to the specific characteristics of the device. A tight coupling usually exists between the operating system and the file system. Some file systems provide mechanisms to control access to the data and metadata. Ensuring reliability is a major responsibility of a file system. Some file systems allow multiple programs to update the same file at nearly the same time.

Reference