Jul 22, 2009

How to make a bootable USB drive to install Linux

I have an ASUS EEE PC 900HA. As you already know, these small netbooks don't come with a CDROM drive so you can't install your operating system as you used to, with the exception of connecting a external drive. There is another way: creating a bootable USB thumb drive. The ASUS EEE supports booting from USB thumb drives and SD cards.

There is a manual and complicated way of making the flash drive bootable but fortunately there is free tool available for Linux and Windows called UNetbootin that can install several LiveCD Linux distributions on your choice of flash storage and make it bootable.

I was happy to find this great tool and I downloaded the latest minimal Gentoo installation CD and used the tool to make a bootable drive. To my disappointment, it didn't work... not matter how many times I tried or which distribution I chose. I was also disappointed that the USB drive had to be mounted first.

But thanks to Google and googling and googling and ... glooging, I found a fix.

First you need to edit /etc/mtools/mtools.conf and uncomment the lines which correspond to your architecture. For me it was:

# # Linux floppy drives
drive a: file="/dev/fd0" exclusive
# drive b: file="/dev/fd1" exclusive

# # First SCSI hard disk partition
drive c: file="/dev/sda1"

And as I gathered, some USB flash drives might come formatted in a way that will have the MBR (Master Boot Record) not readable by the BIOS, like the Kingston Data Traveler, which I used. To fix this, install Lilo (the linux loader) on your favorite distribution and issue:

lilo -M /dev/sdX

where /dev/sdX is the USB drive. I have a SATA hard drive so I have sda1..sda5 and the USB drive would be sdb along with sdb1 for its first partition. On the lilo command line enter the device name without the partition, ie. sdb, not sdb1.

If Unetbootin still doesn't produce a bootable drive for you, try running syslinux manually to see if there is any error installing the bootloader:

syslinux /dev/sdXX

This time specify the partition, otherwise read the syslinux man page. :)

I hope this helps.