Outline

The general procedure to install Ubuntu (or Ubuntu flavour, Kubuntu, Lubuntu, Xubuntu, ...) 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 (Kubuntu, Lubuntu, Xubuntu, ...) before installing it

  5. Install Ubuntu to your internal drive (hard disk drive or solid state 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 usb-creator alias Startup Disk Creator and mkusb 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. Other utilities, e.g. Unetbootin, may create slightly different boot drives or if on UEFI might not work at all with Debian iso files due to a bug

Note: This article uses the term "USB flash drive" alongside USB stick, USB drive, USB device, USB pendrive and thumb drive.

Prerequisites

To create a USB installation device, 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 backup the files you want to keep before making the device bootable. Make sure this USB device is properly formatted and mounted.

  • an Ubuntu flavour 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'.

The following link describes different hardware problems and what can be done to repair a USB stick/pendrive/flash drive http://www.wikihow.com/Repair-a-USB-Flash-Drive. Look for the tips and warnings!

Creating a bootable Ubuntu USB flash drive from Ubuntu

Install and run Startup Disk Creator alias 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.
  • Creating an Ubuntu 14.10 bootable USB stick currently requires that it be made from 14.10. See bug: https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/1325801

  • 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

Unetbootin

If you're using UEFI, do not currently use Unetbootin with Debian iso files due to a bug.

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.

mkusb - dd image of iso file to USB device safely

Simple, safe, high success rate

The mkusb tool was developed to make it simpler and safer to create boot drives with the method to flash or clone an iso image or a compressed image file. It is using dd under the hood.The target is a mass storage device, often but not always a USB drive, sometimes an internal drive or an eSATA drive.

Cloning an iso file to a mass storage device makes a boot drive, provided it is a hybrid iso file, post-processed with isohybrid. See

man isohybrid

This method with dd has a high success rate.

[This is the situation now with the new Ubuntu 14.10 version] mkusb is particularly good for pre-release testing and new releases, when the standard tools like Startup Disk Creator might not be ready (if the configuration of the booting has been changed since the previous release).

Quick start manual and mkusb PPA

The fastest way to start making USB boot drives is to install the mkusb PPA, install and update the mkusb package like all the other program packages. See this link

https://launchpad.net/~mkusb/+archive/ubuntu/ppa

sudo add-apt-repository ppa:mkusb/ppa  # and press Enter
sudo apt-get update
sudo apt-get install mkusb

You can download the quick start manual and check the md5sums at this link http://phillw.net/isos/linux-tools/mkusb/

mkusb - wiki page

mkusb is described with more details at the following wiki page

https://help.ubuntu.com/community/mkusb

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

If you're using UEFI, do not currently use Unetbootin with Debian iso files due to a bug.

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.

Win32DiskImager

You can copy/flash/clone the ISO file (like it is done with mkusb and dd) using Win32DiskImager.

[This is the situation now with the new Ubuntu 14.10 version] Win32DiskImager is particularly good for pre-release testing and new releases, when the standard tools like Startup Disk Creator might not be ready (if the configuration of the booting has been changed since the previous release).

This method is described with screenshots in the following link

https://wiki.ubuntu.com/Win32DiskImager/iso2usb

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, and a good tutorial thread, UEFI Installing - Tips.

If you want to boot in UEFI mode and install your Ubuntu flavour alongside Windows, you should use a 64-bit ISO file, for example

ubuntu-14.04.2-desktop-amd64.iso

directly and not via grub2.

Creating an EFI-only image

If you need to install Ubuntu in EFI-only mode, you might want to create a EFI only image. Askubuntu describes how to do this.

Ubuntu single boot in UEFI mode

Single boot Ubuntu systems are still often installed in BIOS/CSM mode. Normally you install in UEFI mode because Windows is installed in UEFI mode and you want to dual boot. But it is possible to install Ubuntu (and the flavours Kubuntu Lubuntu, Xubuntu) as a single boot system in UEFI mode too, which can be useful for two purposes

  • to keep the systems separated, Ubuntu in one drive and Windows in another drive (so it will actually be a dual boot system, but not during the installation)

  • to make a portable installed Ubuntu USB pendrive for UEFI mode (portable alias works in many computers)

It is straight-forward to install Ubuntu 14.04.2 LTS (64-bit), ubuntu-14.04.2-desktop-amd64.iso in UEFI mode to the whole pendrive, when no internal drive is in the computer.

This installation works without any tweaks (no need for Boot Repair to make it work in UEFI mode so version 14.04.2 LTS is improved compared to previous [point] versions).

You can get it via this torrent file with the following md5sum (but the torrent should check for it automatically)

md5sum ubuntu-14.04.2-desktop-amd64.iso
1b305d585b1918f297164add46784116  ubuntu-14.04.2-desktop-amd64.iso

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

One pendrive for all PC (Intel/AMD) computers

You may want a 'Swiss Army Knife' pendrive, that works in most computers, from old 32-bit computers via 64-bit computers in BIOS mode to computers running in UEFI mode. It is useful for travelling and borrowing computers or for installing. There is a compressed image file and also a recipe how to make it, so that you can extend it or change it for what you need. See this tutorial about One pendrive for all (Intel/AMD) PC computers.

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. This system is not stable enough to survive certain updates. It is good only as an illustration of a method to make a bootable drive in UEFI as well as BIOS mode.

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

[Current issue at the release of Ubuntu 14.10 "Utopic Unicorn"] There are problems with the Startup Disk Creator alias usb-creator, if you try to create a 14.10 boot drive from a previous version of Ubuntu. See this link to the release notes https://wiki.ubuntu.com/UtopicUnicorn/ReleaseNotes#Boot.2C_installation_and_post-install. Unetbootin works from Ubuntu 12.04.5 and 14.04.1 (can make a working USB boot drive for Ubuntu 14.10), but the bug is still there in Startup Disk Creator (tested Nov 1 2014 in 12.04.5 and 14.04.1)

Until these problems are solved other tools work, for example mkusb and Win32DiskImager described in the following links

https://help.ubuntu.com/community/mkusb and https://wiki.ubuntu.com/Win32DiskImager/iso2usb


[The following 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 may run into issues booting Ubuntu from a USB on a mac due to the EFI firmware (the predecessor to UEFI) that Apple uses. Macs can also boot a disk in BIOS mode, which works around the issue. With a modern mac, and a modern version of Ubuntu, EFI/UEFI booting should no longer be an issue, even with an Ubuntu USB drive created from Linux (July 2014). Also see UEFIBooting#Apple_Mac_EFI_systems.

See also


CategoryLive CategoryInstallation CategoryInstallation CategoryInstallation

Installation/FromUSBStick (last edited 2015-03-17 06:53:57 by nio-wiklund)