Valid HTML 4.01 Transitional
Prev: Server Location Protocol (SLP) Next: Gnome Keyring Daemon in Pentagram
Jim Carter's Bugfixes

Bootable USB Flash Drive

James F. Carter

You have a new machine with no optical drive, and you want to put your distro's installer CD or DVD on a USB flash drive and install that way. But your favorite method has stopped working, or you have never been able to get it to work.

What's happening:

I've used unetbootin to make bootable USB flash drives, but it uses a very specific procedure to extract the needed files from the ISO image, and when the distro changes its boot paradigm, chaos can ensue. This is the case for my preferred distro, openSuSE 13.1 (probably started with the 12.x versions). The methods discussed here are tested with openSuSE 13.1, and help info for the live-fat-stick script suggests that they are supposed to work also for Ubuntu, Fedora and Mint.

How to fix:

SuSE has a page on creating a Live USB Stick, with sub-pages for doing it under Microsoft Windows and Mac OS-X.

Copy ISO Image

The procedure is absurdly simple, if you want essentially a copy of the CD/DVD and nothing else. First plug in the flash drive and identify its device name. On a host with one disc, /dev/sdb is typical, but be very careful because you don't want to wipe out one of your other discs. Locate the ISO image, either a downloaded file, or (typically) /dev/sr0 to read directly from the CD drive. Then just do:

dd if=openSUSE-13.1-DVD-x86_64.iso of=/dev/sdb bs=1M

bs=1M is optional but makes dd more efficient. For my flash drive, copying the DVD took about 12 minutes; speeds vary. The final sync takes some time also. Be sure to do it before removing the drive. This done, the drive can be booted and behaves the same as the CD or DVD would.

Since the flash drive now allegedly has turned into a DVD, it is readonly, and it has the disc label and booter that was on the DVD, which for SuSE is a GPT partition table and a EFI-capable version of grub (with a signature that should be accepted). If you want to use the flash drive normally again, you will need to repartition it, and your favorite partitioning tool may or may not give you some grief. If so, wipe the disc label like this:

dd if=/dev/zero of=/dev/sdb bs=1M count=2

This wipes the partition table and the superblock of the first filesystem. (Again, make sure you are doing this to the disc you really want to wipe.) Now the various partition utilities should create a new disc label of the kind you specify.

Live Fat Stick Script

The SuSE page referenced above has a link to a RPM package called live-fat-stick whose payload is one script of the same name. You need your flash drive to have a partition with a fat32 (VFAT) filesystem on it, big enough to hold the ISO image and about 100 Mbytes in addition. According to the script you can put on several ISO images, but I couldn't figure out how to choose any but the first one. To set it up:

live-fat-stick -l #Prints device path, e.g. /dev/sdb1
live-fat-stick --suse /path/to/openSUSE-filename.iso /dev/sdb1

The script needs an absolute path to the ISO image. When you boot you get two choices: boot from hard disc (doesn't work, see below) and the name of your ISO image. It is booted with no extra parameters, e.g. no rescue system and no network configuration, which is not very useful for a network installer.

Since the ISO image is not findable by the time the OS finishes booting, live-fat-stick would not be too useful either for installationn from local files.

Multiple Images

Although the copied DVD image is versatile, I took it as a challenge to overcome the limitations of the live FAT stick. The result was actually useful.

Boot from Hard Disc

The SuSE CD and DVD default menu choice is Boot from Hard Disc, which automatically happens after 30 seconds or so. Press any key, like down arrow, to stop the clock. If you do try this menu choice, on my test machine it would not override the boot device, instead going through the normal boot order, and booting the flash drive (or CD) again. This must work on some BIOSes, but definitely it doesn't work on others. In the multi-image grub.cfg I have a heuristic to overcome this -- which also was ineffective on my test machine.

Prev: Server Location Protocol (SLP) Next: Gnome Keyring Daemon in Pentagram