The Lowdown on LiveUSB

After experiencing many problems creating 'bootable' USB memory sticks that would work with my older PC, I spent hours on a long and frustrating search for good information about USB memory and 'LiveUSB' sticks. This article details the results of that search. If you have comments or questions, please leave a comment on the blog.

Overview

Accurate information is very hard to find, and complete information is almost non-existant. I hope that these notes will help others avoid the huge volume of 'hints' and 'tips' that are misleading at best, and are often incorrect or long outdated. The information and reference links here are accurate as of 15-April-2010, and were reconfirmed to be good, working links as of 15-Nov-2011.

This article explains how to create a LiveUSB stick using the 'syslinux boot loader.' If you take nothing else away from reading this, the most important tip is to start with the latest version of 'syslinux.' After installing version 3.86, all of the strange problems that I was having on my PC went away. This article also explains adding an 'EFI' boot loader such that a LiveUSB can be booted on both an Intel-based Mac and a PC.

None of what follows is original work on my part, but was accumulated from many bits and pieces that I found on the Web. I have made changes to some of the pieces for better integration into the examples. See the Reference section, below, for links to where I found things. Special thanks go to Mathieu Carbou for a very nice example of syslinux menu configuration.

This Article Includes the Following Topics


Dispelling Some of the Myths

The concepts of booting a PC from a USB are fairly simple, and it no longer needs to be obscure and arcane dark magic that is known by only a few voodoo priests.

If you have an ancient PC you may not get everything to work as described here, but it should be sufficient for most PCs built since the year 2000.

I have tested all of the steps described in this article using USB sticks made by Kingston (2GB), PQI (4GB), and Sandisk (16GB) on an older Gateway tower PC, a newer HP laptop, a MacBook white model, and a MacBook Pro black model.



Confirm That Your PC Can Boot From a USB Memory Stick

(For Macs, you don't need to do this. See the steps for Macs, below, for details.)

Most PCs sold since the turn of the century can be configured to boot from a USB memory stick with only a couple of simple changes. Unfortunately, the way to do this can be very different depending on the manufacturer.

To check if this is possible, start your PC and press the key to enter "Setup Mode" which is sometimes called the "BIOS Menu." To do this, notice what the initial startup message tells you. It may flash by rather quickly, so be ready to react. On many computers you must press and hold the F2 key, but sometimes it's a different key.

Once you get the Setup Menu, look for a menu labeled "Boot Order" or "Startup Sequence." If nothing is obvious, try some of the menu choices. What you are looking for is a list that determines the way your computer searches for a 'bootable' device.



Warning: Making changes to your PC's BIOS settings can potentially prevent your computer from booting or working correctly. If you are not comfortable making these changes, it may be best to have someone else do this part.

Usual choices include

What you want is to change this list to the following order Some computers have a special menu choice to 'Enable' booting from Removable Devices, so read the menus carefully.

After you have made any necessaary changes to the Boot Priority order, remember to save the changes. As the way to do this often varies, read the menus to determine how to accomplish this.

Then, to confirm that everything works, make a USB stick 'bootable' as described next, and give it a try.



Make a USB Stick 'Bootable'

The first step in creating a LiveUSB memory stick is to install 'boot loader' software. This article discusses the 'syslinux' boot loader. Included below is an example of multi-level scrolling menus.

To get started, download the following little zip file.

Expand the 'boot-syslinux.zip' file into the top-level directory of your USB stick. You should then have a directory tree on your USB stick that looks like this, and contains boot loader tools and menu files.

Select the correct script to run depending on the Operating System that you are using
(thanks to Mathieu Carbou for these, with a fix from "Judago" [see response #11]).

Warning: Altering memory devices connected to your PC can potentially prevent your computer from booting or working correctly. If you are not comfortable making these changes, it may be best to have someone else do this part.

Run the selected setup script to make your USB memory stick 'bootable' — this will alter the Master Boot Record (MBR) of your USB stick, but it shoud not alter or harm any data on the device. That said, it's always best to back up anything that you don't want to loose before altering or reconfiguring any memory device.

That's all it takes. Your USB stick should now be 'Live.'

Give It A Try

With your new 'LiveUSB' memory stick connected, reboot your computer. You should soon see a menu screen with several choices. Use the arrow keys on your keyboard to move up and down, then use the 'Enter' key to select an entry.

If it doesn't work, confirm that your PC can and will boot from a USB memory stick, as explained above. Of course, none of the entries to actually boot things will work until you install applications onto your new LiveUSB memory stick.



An Example of Nested Syslinux Menus

Ultimate Boot CD (UBCD) was chosen for this example because it has a large number of nested sub-menus. However, the menus included with UBCD currently use a text-based menu system. The syslinux menus system ('simple' version) includes support for two different types of menus: text-based and graphical. The menu demo here is an example of converting the original text-based menus into graphical menus.

Download the following syslinux menu archive file. If you want the new menus to actually boot things, install one or both of the applications as explained below, which can be done either before or after you complete the steps here. The demo here contains only the menus, and not the application files.

Expand the 'ubcd-menus2.zip' file into the top-level directory of your USB stick. You should then have a directory tree on your USB stick that looks like this, and contains boot loader menu files.

That it. You're ready to go.

Give It A Try

With your new 'LiveUSB' memory stick connected, reboot your computer. The menu entry for 'Ultimate Boot USB' should now include a lot of sub-menus. The menu shown here is from the sample configs by Mathieu Carbou.

When you see a "scroll bar" on the right-hand side of the menu, you can use the arrow keys to scroll, or you can use the "page up" and "page down" keys.

Most entries will have sub-menus. When in a sub-menu, you can use the "Return..." entry to return up one level, or you can use the 'Esc' key as well.

If it doesn't work, confirm that your PC can and will boot from a USB memory stick, as explained above. Of course, none of the entries to actually boot things will work until you install the applications onto your new LiveUSB memory stick.



Installing Multiple 'Live' Applications on One USB

Okay, so you have a working LiveUSB stick and the menus are fun but, up until now, it doesn't actually boot anything. Let's fix that.

Many Linux distributions assume they will be the only thing installed to a given USB drive. In addition, the many applications available to assist with creating a LiveUSB assume this as well. An easy solution is to create a separate top-level directory on your USB memory stick to hold each of the various applications that you may want to install and boot.

However, after the installation, the boot menus included with a given application will not work as originally designed. Fortunately, it is fairly simple to change the menus as explained below.

These two applications were chosen for several reasons. They are both small. they are both useful, and installing Puppy first makes it very easy to install UBCD and other 'Live' distributions.

Note that it is not necessary to install this software. The menu examples, above, will work as examples. However, for the menu entries to actually boot anything, you must install something for syslinux to boot.

Update. Here's an example of Ubuntu Linux
on Live USB for both PC and Mac:
Ubuntu Linux for eBanking



App I: Puppy Linux

This is a small yet elegant and fully featured version of Linux. Puppy is a wonderful introduction to using Linux. In addition, Puppy makes it very easy to extract the contents of ISO files, as explained below, which is useful when installing from the UBCD ISO file (App II in this section).

Puppy is included here as an example of eliminating the ISO file and distributing via ZIP. You should note that this is a custom version of Puppy Linux.

Create a top-level folder on your USB stick named puppy, and expand the ZIP file into this new top-level folder. You should then have a directory on your USB stick that looks like this, and contains the Puppy Linux distribution files. As this is not an 'ISO' file, there is no need for any special software to install it.

For Windows simply right-click on the file name and click "Extract..." then enter the drive letter of your USB stick and the puppy subdirectory. For example, if drive 'E:'

For Linux use the 'unzip' command to extract the files onto your USB stick using the current mount path. For example, if '/mnt/sdb1'

If you are familiar with Puppy Linux: This version is from a project I did to create a safe way to do online banking. To ensure that no trojan or 'malware' is retained on the system, the 'save session' option is disabled. To re-enable 'saved sessions' boot Puppy Linux from your LiveUSB and then delete the following file (this is a hidden file so either delete using a terminal window or, if from the File browser, click the 'Eye' icon to show hidden files)

and then use the Menu to 'Remaster LiveUSB'. The remaster process will take three or four minutes to complete.



App II: Ultimate Boot CD

This is a collection of many great utilities for diagnosing and repairing problems with PCs. These are specialized tools and are probably not something that casual PC users should attempt, but they are very useful to PC technicians.

These are also nice for this tutorial because they come packaged with simple text-based menus. The menus included above are an example of how to convert the original menus into graphical menus.

If you do decide to download this collection of utility tools, start by downloading the ISO format file. From the following link it may be tempting to download the ZIP file, but this simply contains the ISO file which means you have to extract things twice.

If the download link doesn't work for any reason, a list of additional websites containing the ISO file is available.

To install this application, create a top-level folder on your USB stick named ubcd, and copy everything from the ISO file into this new top-level folder. You should then have a directory on your USB stick that looks like this, and contains all of the UBCD distribution files and sub-directories.

For an easy way to copy files from the ISO file, see the notes below (which requires installing Puppy Linux, as explained above).



How to Copy Files From Inside an ISO

As mentioned earlier, ISO files are necessary to distribute 'Live' software applications for use on a CD-ROM and DVD disks. However, when installing to USB memory sticks, ISO files are a distinct disadvantage. It is usually necessary to obtain special software to extract the contents of an ISO and copy it to a USB stick.

Using Puppy Linux makes it very easy to open ISO files. (This example assumes that the ISO file is already on the PC, and that Puppy Linux 4.31 is booted.)

First, from the Puppy Desktop, click the icon of a house labeled 'File,' which is located in the far upper left-hand corner of the screen.

Second, using this new window, navigate to the directory on the PC where you stored the ISO file. If you use Puppy Linux to download the ISO file, best to download it to the /root subdirectory. If you get an error message, see the note, below.

Third, to open the ISO file, all you need to do is click on the ISO file in the 'File' browser window. A new window will open showing the contents. At this point, click the icon near the lower left-hand corner of the desktop that looks like a little USB memory stick. If you don't see this icon, make sure that your new LiveUSB stick is plugged in.

Fourth, to copy the contents, 'drag-select' to highlight all of the files in the ISO window, and then 'drag-n-drop' to the USB window. You may need to make the ISO window a little larger to easily select all of the contents.

Fifth, to ensure that all files are copied, right-click on the USB icon (lower-left hand corner) and select 'Unmount sdxx (if currently mounted)', which is the equivalent of a 'safe removal' of a USB device under Windows. It may take a few moments for this to complete as the files finish copying to the USB. When the green dot on the USB icon goes away, it's safe to remove. Have a little patience and remember that you're copying a lot of data to your USB stick.

I did encounter one problem: If, in the second step, you get a message that the ISO file could not be opened, open another 'File' browser (which will be the /root subdirectory), and copy the ISO file into this new window. (Simply drag-n-drop, then click the 'copy' menu entry.) Then open the ISO file from this window, by clicking on the file, and it should work.

I'm not sure why this error occurs. it may be because my ISO file was in a directory tree that was too deep, or maybe it doesn't like spaces in the directory names.



Making Necessary Menu Changes

Because we are installing the software in a location that is not expected by the designers of the application, we need to alter the syslinux boot menu entry(ies) for the things we wish to boot. This can be rather a tedios part of the process.

You must locate the syslinux menu file(s). There may only be one file, and it may have one or more entries, or there may be multiple menu files.

Making changes to syslinux menus can be quick and simple if you only need to change an entry or two. Otherwise it can be tedious. It would be nice if application developers would not assume that their product is the only one installed.

For a first example, this shows the Puppy Linux boot entry. There is only one file with a single menu entry, and the changes are straight forward. Each file needs the path updated. The changes are shown in bold. As a second example, the Ubuntu Linux distribution has many, many menu files. This shows one of several menu entries from the text.cfg file. The trick here is to determine which parts are files that need the path updated, which parts are nice to change for the text that you want to display, and which parts are merely additional parameters. Again, the changes are shown in bold. In this case, one single entry was copied into a different menu file that is available in the menus example ZIP file, above. Changes were also made to the text displayed in the menu label. It may help to examine the changed menu files for the UBCD application, described above. This has 27 files each containing anywhere from 3 to 17 menu entries. Compare the files in the \ubcd\menus directory with those in the \ubcd\menus2 directory. The original UBCD menu files are included with the UBCD distribution, while the new UBCD menu files are available in the small example ZIP file.

Once you become familiar with what parts need changing, it becomes a matter of identifying the entries you want, and making the necessary changes.



Boot on Both a PC and a Mac

Put the 'U' back into USB and create a truly Universial LiveUSB. The setup part is very easy but, to boot Linux or another application, it will need to have been compiled especially to run in the 'EFI' environment.

At this point I have not yet got Puppy Linux booting on the Mac. However, I have successfully booted the latest Ubuntu Desktop (9.10 for i386) on both my PC and my MacBook using the same USB.

Start by downloading the following little zip file.

Expand the 'efi-boot.zip' file into the top-level directory of your USB stick. You should then have a directory tree on your USB stick that looks like this, and contains a few boot loader tools and a menu.

That's all there is to it.

Just remember that to boot the OS you need to use one, such as Ubuntu, that has been built with EFI support.

Give It A Try

To prove that it will boot, insert your LiveUSB into your MacBook. Hold down the 'Option' key, and then press the power button to turn on the computer. Continue holding the 'Option' key until you see an image with the USB logo displayed on the screen. After that appears, you should soon see a second image of a hard disk. It should also work if you connect the USB stick after you see the hard disk image, so long as you hold down the 'Option' key.

Click on the arrow underneath the USB image to select that, and then click on the image a second time to start the boot loader. You should soon see a simple menu screen. Of course, none of the entries to actually boot things will work until you install the applications onto your new LiveUSB memory stick.

If you download and install from the Ubuntu ISO, open the ISO file and copy the contents into a top-level folder on your USB stick named '\ubuntu' you should then be able to boot Ubuntu Linux on both your PC and your Mac using the existing menus that are included with these examples. (One way to open the ISO file is described above.)

Two additional notes: The Ubuntu ISO file is nearly 700 Megabytes, so make sure you have the space and a reasonably fast network connection. Also, while my MacBook worked fine, I was unable to boot Ubuntu on my neighbor's MacBook Pro, and have yet to determine the problem. (It could be as simple as not waiting long enough — booting on the MacBook seems to take somewhat longer than on the PC, and the USB stick I used did not have an LED so I couldn't tell if there was any activity or not.)

And one update: It's now possible to boot Ubuntu and some of the other Linux distros directly from the ISO file without copying any files out. However, this relies on using a boot loader that supports ISO booting. The EFI boot mechanism described here is based on Grub2, which does suport this feature. If you want to try this, sample Grub2 menu entries for Ubuntu are available on this site.



Some Things You May Want to Avoid

There are a lot of posts on the Web that give advice on how to create a LiveUSB stick. Most of them suck, and suck quite badly. Avoid all of the posters who give short incomplete answers, and especially those who are obviously guessing and can't even be bothered to try out the solution they 'think' should work. Among the worst were postings which were partially correct but were totally useless given recent progress today.

Also stay away from the many little applications that 'help' to create a LiveUSB by copying the contents of an ISO file to your USB stick. Of the dozen or so that I tried, all of them copy the ISO file contents to the root directory of the USB stick. This is not helpful if you ever decide to add another application.

In addition, all of these little 'helpers' will update the Master Boot Record (MBR) on your USB stick but, with one exception (see below), they don't bother to let you know how it is done, or using what version of the syslinux boot loader. This is not helpful either.

One of these 'helpers' named Linux Live USB Creator, or LiLo, actually removed the /boot subdirectory from one of my USB sticks. I would avoid this one at all costs until such time as this serious defect is fixed.


What would be helpful is a LiveUSB creator that provides the option to install everything into a subdirectory, and gives the option to not update the MBR. For extra credit, if it could copy the syslinux menus for that app and create new versions that pointed to the correct location that would be fantastic. Something similar to how FireFox can save a web page, create a subdir with all of the graphic elements, and change all of the links to access the new subdir. It can be done.


(There is maybe one exception to this list of things to avoid: the Pendrivelinux Universal USB Installer was the nicest of all the 'helpers' that I tried — even though it copies files to the root subdir and forces an update of the MBR every time it is run.)

(Another exception to this list is MultiBootUSB, a great script that runs on Linux systems and can install around 100 different Linux distros to a Live USB. However, this relies on the Grub2 bootloader — which can boot directly from ISO files, when they are built correctly. The problem is that Grub2 doesn't install correctly on all USB sticks. See the other resource links, below, for details.)



Why ISO Files are No Longer Useful

So-called 'ISO' distribution files are necessary when creating CD-ROMs and DVDs that will boot an operating system. They contain special files in a special format that is needed when booting from optical disk drives. However, when booting from USB memory sticks, this requirement disappears.

The 'ISO' distribution files and complicated instructions to create (or 'burn') CD-ROMs can become a thing of the past. If you don't think that instructions to install software from ISO files are complicated, it's probably because you have some experience doing this. For people who may only ever do this once or twice, it's daunting and unpleasant.

As a software distribution mechanism CDs do remain somewhat useful, so long as you don't have to create the silly things yourself. For archival purposes CDs, and even DVDs, are limited in space. Newer DVDs will hold more but, for archival use, even the best DVDs have a limited life span. A 1- or 2-terabyte hard disk is an inexpensive backup solution, and can keep a lot of backups instantly available.

Perhaps it's time for CDs and DVDs to follow floppy disks into extinction, and the 'ISO' file should become extinct as well. I'm sure there will always be people who think they need ISO files for some reason, but don't let them force you to think that way. (There are also people who still think that the Earth is flat, but most people now agree that the Earth is a round speck of dust nestled in a pink clover which is held safe by the trunk of an elephant named Horton. Who?)

As USB memory sticks increase in capacity and reduce in size and price, the usefulness of optical disks will be limited even further. 32GB sticks are now around US$100, and Kingston has a new 256GB stick available in Europe. Granted this beast is currently US$900, but remember how expensive 4GB sticks were only a few years ago. A 4GB PQI stick today is under US$15 on Amazon and is smaller than any of the keys on my keychain. It won't be long before 64GB and 128GB sticks are as common as 1GB and 2GB sticks are today.


Summary

This article is an effort to collect good, accurate information and provide some workable examples that are complete and have been tested. It is the result of many hours of searching through hundreds of blog posts and thousands of comments, and perusing other sites for useful information. In addition, I tried using about a dozen helper apps that all purport to be the 'best' LiveUSB creator, and tried obscure methods to alter 'virtual geometry' of USB sticks and perform special formatting.

If the results have been helpful, I'd appreciate hearing from you. If you experience problems following these notes, post a comment and I will attempt to further clarify the examples.

References

Other Resources


Post any comments or questions on the blog.