Outline

The general procedure to install Ubuntu from a USB flash drive is:

  1. Acquire the correct Ubuntu installation files ('the ISO')
  2. Put Ubuntu onto your USB flash drive
  3. Configure your computer to boot from USB flash drive and boot from it
  4. Try Ubuntu or install it to your hard drive.

Introduction

Ubuntu can be installed from a USB flash drive. This may be necessary for netbooks and other computers without CD drives and is handy for others because a USB flash drive is so convenient. Also, you can configure Ubuntu on the USB flash drive to save changes you make, unlike a read-only CD-ROM drive.

Booting from a USB flash drive created with this utility will behave just as if you had booted from the install CD. It will show the language selection and then the install menu, from which you can install Ubuntu onto the computer's hard drive or launch the LiveCD environment.

Note: This article uses the term "USB flash drive" instead of: USB stick, USB drive, and thumb drive.

Prerequisites

To create a USB installation disk, you will need:

  • a 2 GB USB flash device/drive/stick. If the iso file is smaller than 1 GB, it is possible to use a 1 GB USB device, at least with some of the methods. Files on this USB device will be erased, so previously backup your documents. Make sure this USB device is properly formatted and mounted.
  • an Ubuntu ISO file (see GettingUbuntu to download it)

Notes about speed

The most common USB ports and USB flash drives work according to the USB 2 standard. Booting from USB 2 from a live drive is faster than from a corresponding CD/DVD disk. Standard USB 2 flash drives have rather slow flash hardware, with read and write speed much slower than the transfer speed of USB 2, so it is worth checking if the speed is specified.

USB 1.1 is also possible to use, but it is very slow, slower than a corresponding CD/DVD disk.

Hardware according to the USB 3 standard is much faster than USB 2. So if you have a USB 3 port and a USB 3 flash drive, booting and running will be as fast as from an internal drive (SATA or IDE) or an external eSATA drive. And a USB 3 flash drive has much faster flash hardware, and it is usually specified. The market changes quickly, so it is worth checking on the internet, which brand and model to select to get the best buy 'today'.

USB 3 flash drives are much faster than USB 2 flash drives also in USB 2 ports, because the flash hardware is not limiting the transfer speed. For the same reason a USB connected HDD is also much faster than a USB 2 flash drive.

USB 2 flash drives are particularly slow when there are many small files to read and write. This makes then very slow when running persistent live systems and 'installed systems' (installed in the normal way, but to a USB drive). Also the lifetime (number of write operations on a memory cell) is much higher with the high quality hardware in USB 3 flash drives. But still, you should use noatime in fstab and use swap only for extreme situations to avoid excessive wear.

A LED (light emitting diode) helps you avoid unplugging the USB flash drive too early (while it is saving data from the buffers in RAM), and decreases the risk of corrupting the file system.

Flash drive tests are described by C.S.Cameron in this link, post #5.

See also the following links

Link to USB 3.0 Flash Drive Speed Tests

Link to USB 2 and USB 3 speed tests for installers

Conclusion

Standard USB 2 flash drives are good for normal live systems. Typically the speed is between 4 and 20 MB/s.

USB 2 flash drives work, but USB 3 drives (or USB 2 HDDs) are recommended for persistent live systems and 'installed systems'. In the beginning of 2014, it seems that there are no really fast pendrives below 16 GB.

Notes about size

1 GB is enough for a live USB flash drive made from a 'CD size' iso file. But unless you already have a 1 GB drive, you are recommended to get one with at least 2 GB, hence the general recommendation above.

2 GB is enough for 'CD size' iso files as well as many but not all 'DVD size' iso files.

If you want a persistent live system with a decent size casper-rw storage, you need at least 4 GB (2 GB is possible, but might soon run out of space).

If you want an installed system you need at least 8 GB (4 GB is possible with Lubuntu, but might soon run out of space). In the beginning of 2014, it seems that there are no really fast pendrives below 16 GB. If you want a fast system, install it into a pendrive that performs well in a test, even if it is 'bigger than necessary'.

Notes about bootability

Most but not all USB pendrives are reliable for booting, even many of the slower ones, and they are much cheaper, and should be OK particularly for regular read-only live drives (without persistence).

Some computer hardware and some operating systems have issues with certain ports. And some USB pendrives just have issues also. Some of them cannot be used for booting. They are made to be mass storage devices, and have not exactly the same electronics and firmware. Some USB pendrives and computers 'do not like each other'. The pendrive might boot another computer, and the computer might boot from another pendrive (everything else being the same).

This is a link to test by Pendrivelinux including bootablility of USB flash drives. This test was made a few years ago. The cheap and slow Sandisk Cruzer Blade, 4GB, can be added to the list of reliable pendrives for booting. I have used it extensively for years and it has failed only once (chainloading from Plop in a very old computer). This link shows a bootability test in January 2014.

Some pendrives that did not work are shown in this link. This user is not the only one who likes 32GB Sandisk.

The flash hardware

This link to a post by DuckHook in the Ubuntu Forums describes how a flash drive works, and how it can fail, first getting read-only, then totally 'bricked'.

Creating a bootable Ubuntu USB flash drive from Ubuntu

Install and run usb-creator

You can find usb-creator-gtk in the Unity Dash by typing "Startup Disk Creator" (Ubuntu Desktop) or usb-creator-kde in K-Menu-->Applications-->System-->Startup Disk Creator (Kubuntu). If it is not there, then you can install it using the Synaptic Package Manager or Ubuntu Software Center

  • Insert and mount the USB drive. Inserting the USB drive should auto-mount it.
  • Start usb-creator. It looks like this in 13.10:

usb-creator-gtk_erase-disk.png

  • in the top pane of usb-creator, pick the .iso file that you downloaded.
  • if the .iso file isn't listed, click "Other" to locate and select the .iso file that you downloaded.
  • Alternately, if you have a CD or DVD-ROM with the Ubuntu version you want to install on the USB flash drive, insert it in your CD-ROM drive and usb-creator can use that.
  • It is not necessary to erase the USB flash drive, however it is advisable that you do so.
  • Select the first bootable partition on the USB device as the disk to use
  • The bootable partition should be formatted as either a FAT16 or FAT32 filesystem. This is the default for most USB flash drives.

Notes

  • NEVER use one of your hard drive partitions in this process unless you really know what you are doing, as data will get erased.

  • There may be a bug during the formatting which will cause two partitions to appear when booting from the USB flash drive. Try selecting each of them and one should work. If not, restart the computer and try booting from the USB flash drive again.
  • If you get a DBus error with usb-creator, this bug report may be helpful: https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/458334

  • Temporary edit: The startup disk creator version usb-creator-gtk is buggy in Lubuntu 13.04, Please install two additional packages, that help it work, either directly or via a PPA!

    sudo apt-get install usb-creator-gtk python-gudev gir1.2-gudev-1.0
    or
    sudo add-apt-repository ppa:jmarsden/lubuntu
    sudo apt-get update
    sudo apt-get install usb-creator-gtk

    Usb-creator-gtk in 13.10 is buggy too, but this way it is possible to make persistent live drives (at least in Lubuntu 13.10 'Saucy'). Let it wipe whatever is on the USB pendrive and then create a partition and file system: Click on Erase disk! [Testing the usb-creator-gtk in the release candidate, it had to be run twice (both times wiping with 'Erase disk') to succeed. The first time it crashed early, the second time it created a good boot drive (from the Lubuntu Saucy 32-bit desktop iso) and then crashed with segmentation fault.]

    If you still have problems with usb-creator-gtk, as a temporary workaround, you can try using the KDE flavour usb-creator-kde

    sudo apt-get install usb-creator-kde

    or one of the other tools. See this bug report (and comments #15 and #16). It is improved in current updated/upgraded development installations of Lubuntu 13.10 (saucy-proposed December 18 2013)) and can create persistent USB drives without errors, but this version crashes when trying to erase a disk. See this bug report.

Unetbootin

Install Unetbootin from the repositories

sudo apt-get install unetbootin

Start it, select an ISO file or a distribution to download, select a target drive (USB drive or Hard Disk), select persistence if you wish, then reboot once done. If your USB drive doesn't show up, reformat it as FAT32.

See this detailed description.

dd image of iso file to USB device safely

Cloning with dd is a straight-forward way to make an Ubuntu flavour USB install device (pendrive, HDD, SSD, flash card). It has a high success rate, but using dd is risky, unless there is some guidance to make sure you write to the intended target drive. Otherwise you might overwrite your internal hard drive or an attached USB drive with all your photos. dd is nick-named "disk destroyer". This method uses a shell-script to make it much safer.

Doing the same thing many times during iso testing of new versions was the reason to make the shell-script mkusb, which gives advice from a help text window. You have to run dd manually only once, but with support from the script to avoid writing to any internal drive. The first time you must select the correct USB device, if more than one are connected. So it is safer and also much more convenient (but not 100%).

The next daily build will automatically select the correct USB device (when it is inserted into the computer). So for the next daily builds it is safe and very convenient.

The method and the script for dd image of iso file to USB device safely are described in the Ubuntu Forums tutorial "Howto make USB boot drives".

Booting USB drives with grub2 and iso files 'grub-n-iso'

There is a good wiki page about booting with grub2.

The 'grub-n-iso' method uses grub2 to boot from an iso file, so once you have such a USB pendrive, you can boot most Intel and AMD computers that can run a 32-bit system (except very old non-PAE systems, UEFI systems, systems with too low RAM, and systems with non-compatible hardware). The 'grub-n-iso' method can be used to create multi-boot USB pendrives by selecting iso file to boot from in the grub menu. There is space in 'grub-n-iso-n-swap' for a second iso file. You can also start from this link to Pendrivelinux and modify the USB drive to suit what you need: size, number of iso files ...

The Ubuntu wiki page 'grub-n-iso' refers to Lubuntu-fake-PAE, because it is a method to boot the new pae kernel also with Celeron M and Pentium M CPUs without the PAE flag, but with PAE capability. However, the 'grub-n-iso' and 'grub-n-iso-swap' USB boot drives use the standard Lubuntu desktop iso file without any fake-PAE installed, and it can boot almost all computers, that can run 32-bit systems, but it cannot be used for UEFI systems.

64-bit versions work only in 64-bit computers. 32-bit versions work in 32-bit and 64-bit computer with BIOS, but not with UEFI. If you want to boot in UEFI mode and install your Ubuntu flavour alongside Windows, you should use for example the ubuntu-13.04-desktop-amd64.iso directly and not via grub2.

There is a good wiki page about booting with UEFI

Booting USB drives with grub2 and installing tar files 'One Button Installer'

The Ubuntu Forums Tutorial page One Button Installer, 'OBI' and Ubuntu wiki page https://help.ubuntu.com/community/OBI describe a new method to install an Ubuntu flavour or Ubuntu based operating system.

The One Button Installer consists of a compressed image of the installer with its operating system and tarballs containing the systems to be installed. It makes it very easy to install a simple (single boot) system. Install from the standard desktop iso, the alternate iso or 'grub-n-iso' if you want dual boot or multiple boot systems.

Creating a bootable Ubuntu USB flash drive from Mac OSX

See How to install Ubuntu on MacBook using USB flash drive and this Ubuntu Forum thread by Quackers

Creating a bootable Ubuntu USB flash drive from Windows

Linux Live Usb Creator

Download and use Linux Live Usb Creator.

Once you have usb-creator.exe, run it and follow the same steps as described for Linux (point it at your .iso file or your Ubuntu CD-ROM, point it at your USB flash drive, make sure you have the right device selected, then "Make Startup Disk").

Note

  • You won't be able to select the USB flash drive if it wasn't formatted in a way that Windows can see it. You may have to format it using Windows Explorer in order for it to show up in a creator tool.

Unetbootin

Download and use Unetbootin for Windows.

Run the file, select an ISO file or a distribution to download, select a target drive (USB drive or Hard Disk), select persistence if you wish, then reboot once done. If your USB drive doesn't show up, reformat it as FAT32.

Booting USB drives with grub2 and iso files 'grub-n-iso' and 'One Button Installer'

See the corresponding text for Ubuntu with more details.

Graphical user interface tools

There are instructions to use graphical user interface tools. In 'grub-n-iso' and this One Button Installer README file see paragraph f.2

f.2 Check download and clone image in Windows

Download the following help programs
http://www.md5summer.org
http://www.7-zip.org
http://sourceforge.net/projects/win32diskimager
...

UEFI

There is a good wiki page about booting with UEFI

If you want to boot in UEFI mode and install your Ubuntu flavour alongside Windows, you should use for example the file ubuntu-13.10-desktop-amd64.iso directly and not via grub2.

Persistent USB drive that works with UEFI and BIOS

A persistent USB install of *buntu, usable with both Legacy and UEFI systems is described in the following post at the Ubuntu Forums

Portable installed system booting from UEFI and BIOS

The following web page describes how to install a portable Ubuntu system, that boots in UEFI as well as BIOS mode. It can be installed into a USB pendrive and is a good alternative to a persistent live system, because it can be updated and upgraded without limits.

Portable installed system booting from UEFI & BIOS

Booting the Computer from USB

Remove all unneeded USB items, but keep the network cable attached.

Insert the bootable USB flash drive that you just created in your target computer and restart it. Most newer computers can boot from a USB flash drive. If your computer does not automatically do so, you might need to edit the BIOS settings.

Restart your computer, and watch for a message telling you which key to press to enter the BIOS setup. It will usually be one of F1, F2, DEL, ESC or F10. Press this key while your computer is booting to edit your BIOS settings. (On HP Mini Netbooks, they correct key is usually F9.)

Instead of editing BIOS settings, you can chose a boot device from the boot menu. Press the function key to enter the boot menu when your computer is booting. Typically, the boot screen displays which key you need to press. It maybe one of F12, F10. Note: with some motherboards you have to select 'hard disk/USB-HDD0' to choose the USB flash disk. It may work like this because the system sees the USB drive 'a mass storage device' as a hard disk drive, and it should be at the top of the boot order list.

So you need to edit the Boot Order. Depending on your computer, and how your USB key was formatted, you should see an entry for "removable drive" or "USB media". Move this to the top of the list to make the computer attempt to boot from the USB device before booting from the hard disk.

Chainloading

The 40_custom method

In the particular case, that you have linux and grub installed there is also the 40_custom method. Some pendrives boot from grub even if they won't boot from the computer's own (bios/uefi) USB boot menu entry. See the following link for a background about grub Scripts: /etc/grub.d/

Edit the file

sudo nano /etc/grub.d/40_custom

Add the following text to the file 40_custom (notice that it is important to keep the first lines, that come with the file)

menuentry "External drive (on hd1) if no eSATA drive connected. edit if necessary" {
        insmod part_msdos
        insmod fat
        set root='(hd1)'
        drivemap -s (hd0) ${root}
        chainloader +1
}

and run the command

sudo update-grub

Then you will get a grub menu option to boot from a second drive (hd1), which could be a USB pendrive. If another drive is hd1, you can edit the line to (hd2) etc.

If there is no grub menu, press the left shift key during boot, and it should appear.

The Chainloader

This method is developed into a method to boot the computer with one USB drive that is a good booter, and chainload to another USB drive, where the operating system resides. See this link Howto help USB boot drives

Alternative methods

PLoP Boot Manager

Some computers can see the USB flash drive and have the option to boot from USB but cannot actually do so. All hope is not lost.

Requirements

Just follow the instructions on the PLop website.

Note: When you use this method, the files on the USB flash drive are changed during boot. To use this method more than once, you must delete all files from the USB flash drive and prepare the USB flash drive again as described below.

A detailed guide to make Plop Boot Manager work from GRUB by installing it on hard drive is available here - http://makegadgetswork.blogspot.com/2012/02/how-to-boot-from-usb-when-bios-does-not.html#more

Windows

This method is recommended if you are creating Linux installation to coexist with your existing Windows installation.

  • Find a usb-creator app and run it

Installing Ubuntu directly on a USB flash drive

In order to install a fully working Ubuntu operating system on your USB flash drive make sure that:

  • Your USB flash drive has more than 2GB of space
  • Your USB flash drive is bootable
  • Your USB flash drive has a high read/write speed and is USB 2.0 enabled

The process is described in detail in an external source.

Create Bootable USB Manually

Here is a way to create a bootable USB flash drive manually. The advantage is you don't have to empty your USB flash drive as long as you have enough space for the files. It also allows multi boot, so you can, for example, have your USB flash drive holding both 32bit and 64bit versions of Ubuntu and other Boot CD tools at the same time.

In order to do so you need :

First you need to install grub onto the USB's MBR. Follow the link to the Grub4DOS Wiki: Simple example:

./bootlace /dev/sdx

For more details, visit: http://sourceforge.net/projects/grub4dos/

Next, you open up the ISO file and extract the files in casper directory. The size (and possibly manifest) are needed if you want to install from the USB flash drive otherwise the install will fail.

total 701060
-rwxr-xr-x 1 adrian adrian     38784 2010-07-27 16:15 filesystem.manifest
-rwxr-xr-x 1 adrian adrian        10 2010-07-27 16:15 filesystem.size
-rwxrwxrwx 2 adrian adrian 704487424 2010-04-29 05:38 filesystem.squashfs*
-rwxrwxrwx 1 adrian adrian   9365872 2010-04-29 05:34 initrd.lz*
-rwxrwxrwx 1 adrian adrian   4029792 2010-04-16 06:01 vmlinuz*
/media/Fujitsu 60GB USB/bootimg/ubuntu.10.4.x86$

Copy grldr to the root of the drive.

drwx------ 1 adrian adrian   4096 2010-05-05 16:49 bootimg/
-rwxrwxrwx 1 adrian adrian 220049 2009-09-24 17:30 grldr*
-rwxrwxrwx 1 adrian adrian   2760 2010-05-04 23:08 menu.lst*
/media/Fujitsu 60GB USB$

Now create menu.lst at the root of USB. Example of menu.lst:

default /default
##################### 
title Ubuntu 10.04 LiveCD
find --set-root /bootimg/ubuntu.10.4.x86/initrd.lz
kernel /bootimg/ubuntu.10.4.x86/vmlinuz boot=casper live-media-path=/bootimg/ubuntu.10.4.x86/ ignore_uuid
initrd /bootimg/ubuntu.10.4.x86/initrd.lz
boot

Make sure the path match where the files you copy to.

Now, reboot.

Simpler way using the ISO file

Another way is just using the ISO file as it is on an already bootable USB flash drive that uses Grub (to create one, see above).

  • copy the iso file onto the USB flash drive in the root (top) directory
  • add these lines to the menu.lst file:

title Ubuntu 11.04 i386
find --set-root /ubuntu-11.04-desktop-i386.iso
map /ubuntu-11.04-desktop-i386.iso (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=/ubuntu-11.04-desktop-i386.iso splash quiet --
initrd /casper/initrd.lz

Note: this might not work with all versions of grub. It was tested with GRUB4DOS 0.4.4 2008-11-11

Known Issues

[This information about known issues is a few years old, and may or may not be valid today (September 2013).]

Ubuntu 11.04 is having issues with USB flash drives from Sandisk that have U3 Launchpad. You can either use another brand or use either u3-tool from Ubuntu Repositories or Sandisk's U3 Launchpad Removal Tool to remove U3. Otherwise Sandisk pendrives work well as USB boot devices (updated June 2013).

Some BIOS's (eg., the Eee PC netbook') have trouble recognizing that the USB is bootable. You may have to trick it into booting using the following method: At boot, enter the BIOS by pressing F2. Then, right as you exit the BIOS, hit the Esc key. For some systems, this will bring up the boot menu.

The error "Can not mount /dev/loop1 on /cow" is because usb-creator.exe is not creating a valid casper-rw file holding ext2/ext3 filesystem. Fix: 1) Use Unetbootin or 2) After running usb-creator.exe, recreate casper-rw using cygwin tools or http://www.pendrivelinux.com/casper-rw-creator-make-a-persistent-file-from-windows/. (As of April 2010)

You need Mac OS X to create a USB flash drive that can boot on Macs. Even so, the process is less reliable than using a CD, as the USB flash drive is not always recognized on boot. Reversely, you can't create bootable USB flash drives for other platforms than Macs from within Mac OS X. This is because Macs use a custom EFI bios with a custom boot-loader and need a special filesystem layout to boot correctly.

See also

CategoryLive CategoryInstallation CategoryInstallation CategoryInstallation

Installation/FromUSBStick (last edited 2014-03-26 12:11:13 by nio-wiklund)