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 4 GB USB flash device/drive/stick. If the iso file is smaller than 2 GB, it is possible to use a 2 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 ubuntu.com/download or 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 SSD flash drive has much faster flash hardware, and there are USB 3 pendrives with specified high read/write performance. 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 them 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 with specified high read/write performance (or even USB 2 HDDs) are recommended for persistent live systems and 'installed systems'. In the beginning of 2017, it seems that there are no really fast pendrives below 16 GB.

Notes about size

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

4 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 8 GB (4 GB is possible, but might soon run out of space).

If you want an installed system you need at least 16 GB (8 GB is possible with Lubuntu, but might soon run out of space).

In 2019, 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!

Postrequisites - restore the USB stick

'Postrequisites' - after installation: how to restore the USB stick to a standard storage drive. The standard is an MSDOS partition table (MBR) and a partition with the FAT32 file system.

gparted

In order to re-use the stick after installing Ubuntu, just format it completely (including MBR) using gparted in Ubuntu or Disk Management in Windows. This works in most cases.

Otherwise, see details in this link: https://wiki.ubuntu.com/Win32DiskImager/iso2usb/FormatHelp

gparted comes with the iso file but is available only in the live system. You install it into an installed system with

sudo apt-get install gparted

mkusb

mkusb with a GUI and mkusb-nox in text mode have built-in features to wipe the first megabyte, create a new partition table and file system. See the following links

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

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

mkUSB-quick-start-manual-nox.pdf

If you run standard Ubuntu, you need an extra instruction to get the repository Universe. (Kubuntu, Lubuntu ... Xubuntu have the repository Universe activated automatically.)

sudo add-apt-repository universe  # only for standard Ubuntu

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

and if you want also the command line version without graphics

sudo apt-get install mkusb-nox

It is very easy to restore the USB stick to a standard storage drive with mkusb-dus

mkusb version 12, mkusb-dus, has a dedicated menu to restore a USB stick to a standard storage device.

Screenshot of mkusb - selecting restore to Standard storage device

It is very easy to restore the USB stick to a standard storage drive with mkusb-nox

sudo mkusb­-nox restore

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.
  • 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.

Notes

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

  • There are bugs that affect the Ubuntu Startup Creator, when you run it in Ubuntu versions 12.04 LTS, 14.04 LTS, 15.10 in BIOS mode and try to create USB boot drives with other versions. Some of the bugs are caused by conflicts between different versions of syslinux. These bugs do not affect installing in UEFI mode, where grub2 is used. And with the Ubuntu Startup Creator version 0.3.2 in Ubuntu 16.04 LTS, these bugs are no longer a problem, so you can install any version of the Ubuntu flavours from 16.04 LTS.

The Startup Disk Creator looks like this in Ubuntu 18.04 LTS:

Screenshots: Startup Disk Creator - to SSD or pendrive

This new version clones the iso file, which means that you need neither erase nor format the target drive. It will be completely overwritten anyway by the cloning process.

Unetbootin

Unetbootin works well in Ubuntu, when installed via the developer's ppa. The version in the Ubuntu repositories is not up to date in order to install from the versions 12.04 LTS and 14.04 LTS to 15.04 and 15.10.

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

sudo add-apt-repository ppa:gezakovacs/ppa
sudo apt-get update
sudo apt-get install unetbootin

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

Start Unetbootin, 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. Mount the FAT32 partition (for example by un-plugging and re-plugging the drive).

If you don't reboot, because you want to use the pendrive in another computer, unmount (eject) the FAT32 partition before unplugging it, otherwise you might corrupt the file system.

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. Most modern linux distros provide hybrid iso files, and you should not treat the file twice. See

man isohybrid

This method with dd has a high success rate.

[This is the situation now with the new current Ubuntu versions] mkusb is particularly good for pre-release testing and new releases, when the standard tools 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

If you run standard Ubuntu, you need an extra instruction to get the repository Universe. (Kubuntu, Lubuntu ... Xubuntu have the repository Universe activated automatically.)

sudo add-apt-repository universe  # only for standard Ubuntu

Otherwise the following three command lines are enough to install mkusb.

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

View or download the quick start manual http://phillw.net/isos/linux-tools/mkusb/mkUSB-quick-start-manual.pdf

mkusb - wiki page

mkusb is described with more details at the following wiki page

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

mkusb - persistent live drives

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

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, 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.

'grub-n-iso' for all PCs

64-bit versions work only in 64-bit computers. 32-bit versions work in 32-bit and 64-bit computer with BIOS, and now also with UEFI. It is possible to create 'grub-n-iso' pendrives that boot most PCs with Intel and AMD processors according to the following links,

How to Create a EFI/UEFI GRUB2 Multiboot USB drive to boot ISO images

One pendrive for all PC (Intel/AMD) computers

But old style 'grub-n-iso' does not work in UEFI mode.

If you want to boot in UEFI mode and install your Ubuntu flavour alongside Windows, you can use for example the ubuntu-16.04.1-desktop-amd64.iso directly.

There is a good wiki page about booting with UEFI

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

There are various methods available for Windows to create a bootable Ubuntu USB flash drive.

GRUB2

See the corresponding text for Ubuntu with more details.

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").

Pendrivelinux's Universal USB Installer

For more on this project, please see https://www.pendrivelinux.com.

Rufus

A Rufus tutorial is available from here. For more on this project, please see here.

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.

Win32 Disk Imager

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 current Ubuntu versions] Win32DiskImager is particularly good for pre-release testing and new releases, when the standard tools 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

UEFI

There is a good wiki page about booting with UEFI, and a good tutorial thread, UEFI Installing - Tips.

Boot and install

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.4-desktop-amd64.iso

Make the boot drive with for example mkusb, Disks, the new Ubuntu Startup Disk Creator (version 0.3.2) or the Win32 Disk Imager. These tools clone the iso file and are likely to succeed. Some 'grub and ISO' systems work in UEFI mode, others work only in BIOS mode. Syslinux does not work in UEFI mode.

If you have problems, try another tool to create the USB boot drive. You can also try the simple extraction described in this link. It works [only] in UEFI mode.

You can get this ISO file via this torrent file and the torrent client should check the md5sum automatically.

Test if running in UEFI mode

You may want to test if your Ubuntu flavour is running in [U]EFI mode. An installed system and a live system too is using the directory /sys/firmware/efi, so you can run the following command line,

test -d /sys/firmware/efi && echo efi || echo bios

The following command line is more robust and also easier to understand, so you may prefer it (if you copy & paste and are not bothered by typing a long command line),

if test -d /sys/firmware/efi; then echo efi; else echo bios; fi

Stable portable systems - good for USB sticks

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.

A new and so far successful attempt to create a stable portable system, that works in UEFI and BIOS mode

If you want a pendrive with a live and an installed system, that works in UEFI and BIOS mode, you can try

Installed system: add an ESP to an existing installation with MBR

Adding required partitions for different platforms

Platforms: Legacy PC, UEFI-based Windows computer, Apple computer

AskUbuntu: Is it still possible to install Ubuntu to an external harddrive with UEFI?


Creating an EFI-only image

If you need to install Ubuntu in EFI-only mode, you might want to create an 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). Probably stable when installed in an internal drive.

  • to make a portable installed Ubuntu USB pendrive for UEFI mode (portable alias works in many computers). Not stable when installed in an external drive (USB stick).

It is straight-forward to install

  • Ubuntu 14.04.1 LTS (64-bit), ubuntu-14.04.1-desktop-amd64.iso or

    Ubuntu 14.04.5 LTS (64-bit), ubuntu-14.04.5-desktop-amd64.iso or

    Ubuntu 16.04.1 LTS (64-bit), ubuntu-16.04.1-desktop-amd64.iso

in UEFI mode to the whole drive, when no other drive is connected in the computer.

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

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. An original system was not stable enough to survive certain updates. But a new and simplified system seems stable,

Portable installed system booting from UEFI & BIOS

Multiboot pendrives

These links describe a multiboot pendrive based on the grub-n-iso method.

See also the following links

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, F9, F10, DEL, Enter or ESC, you can search your hardware on boot-keys.org. Press this key while your computer is booting to edit your BIOS settings. (On HP Mini Netbooks, the correct key is usually F9.)

Instead of editing BIOS settings, you can choose 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, F9. 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 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 part_gpt
        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.

This chainloading method does not work in UEFI mode.

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

'Do it yourself'

When the boot structure is modified in Ubuntu or the booting software, there can be problems until the extracting tools are modified to manage the modification. It is worthwhile to find a method that is as simple as possible and to learn how to use it in order to manage the extraction also when the boot structure is modified.

  • For an UEFI only boot flash drive you need no installer
  • Make the drive boot both in UEFI mode and BIOS mode

See this link: Installation/iso2usb#Do_it_yourself

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.

A detailed guide to make Plop Boot Manager work from GRUB by installing it on hard drive is available here - http://mgw.dumatics.com/how-to-boot-from-usb-when-bios-does-not-have-the-option/

Known Issues

  • There are problems with the versions of the Startup Disk Creator alias usb-creator in versions of Ubuntu older than 16.04 LTS. Unetbootin works from Ubuntu 12.04.5 and 14.04.2 (can make a working USB boot drive for Ubuntu 15.04). 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 version 0.3.2 (and newer versions) of the Startup Disk Creator alias usb-creator in Ubuntu 16.04 LTS (and newer versions) clones the iso file and creates a read-only file system. This method is very robust, but if you want to re-use the USB stick as a storage drive, you must restore it. Two methods are described in the following link: #Postrequisites_-_restore_the_USB_stick.


See also


CategoryLive CategoryInstallation CategoryInstallation CategoryInstallation

Installation/FromUSBStick-old (last edited 2020-01-24 08:32:39 by nio-wiklund)