What is the proper way of creating installation media from Ubuntu iso?

This is the third time I've tried to install Ubuntu Server 14.04.03 64-bit on the same laptop, and each time it caused different problems.

Each time I wrote the same iso image to a USB flash drive by using a different application and OS.

  1. Universal USB Installer (pendrivelinux.com) from Windows
  2. WinImage writer from Windows
  3. built-in image writer from Linux Mint 17.2

The iso image is the same in all three cases, the USB flash drive is the same, and the laptop is the same. However each time the installation of Ubuntu gave me different installation options. For example, the last time I installed Ubuntu, it didn't show all the packages to choose while installing (Basic Ubuntu server, etc.).


This flowchart shows how to make a bootable USB for installing Ubuntu and troubleshoot problems booting Ubuntu from it.

flowchart

Links

  • How to create a bootable USB stick on Windows
  • Ubuntu on 32-bit UEFI-based tablet PC
  • Need help regarding dd command on Ubuntu app for Windows 10

How to make an Ubuntu USB on Ubuntu using Startup Disk Creator

Ubuntu has a built-in application for creating a bootable Ubuntu live USB for installing Ubuntu called Startup Disk Creator. Search the Dash for Startup Disk Creator and click the Startup Disk Creator icon to open the Make Startup Disk window.

The USB flash drive that you use with Startup Disk Creator should be 2GB or larger, and for Ubuntu 18.04 and later it should be 4GB or larger. Startup Disk Creator will automatically format your USB flash drive to FAT32 and make it bootable. If you have only one USB flash drive plugged in to your computer, Startup Disk Creator will select it automatically. Be very careful to select the USB flash drive in the Make Startup Disk window in order to avoid overwriting the partition which Ubuntu is installed on, which may make Ubuntu unbootable. In the screenshot below you can see how the USB flash drive Device is identified by its model name, the same model name that appears under the Drive heading after Model: in the Disks (disk utility) application.

Startup Disk Creator
Startup Disk Creator in Ubuntu 16.04

How to make an Ubuntu Minimal USB using dd

While the minimal iso image is handy, it isn't useful for installing on UEFI-based systems that you want to run in UEFI mode. The mini iso lacks the proper files for booting the computer in UEFI mode. Thus the computer will boot in BIOS compatibility mode, and the installation will be in BIOS mode.

  1. Download the Ubuntu Mini CD iso file for Ubuntu 18.04 and earlier from the link on the Ubuntu Documentation Installation Minimal CD webpage. Download the Ubuntu Mini CD iso file for Ubuntu 20.04 from http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/legacy-images/netboot/mini.iso. Download the file called mini.iso to your Downloads folder. You can download the mini.iso file to wherever on your computer that you want, but download it to your Downloads folder so that you can easily run the commands in the following steps without changing anything.

  2. Verify the md5 checksum of the Ubuntu mini CD iso file that you downloaded by running these commands:

    cd ~/Downloads/
    md5sum 'mini.iso'
    

    If you are using Windows Subsystem for Linux download the Microsoft File Checksum Integrity Verifier tool from the official Microsoft Download Center. The Microsoft File Checksum Integrity Verifier tool is a command line utility that computes MD5 or SHA1 cryptographic hashes for files.

  3. Check that the results of the command match the MD5 checksum of the mini.iso file on the Ubuntu Documentation Installation Minimal CD webpage.

  4. Get a USB flash drive, 1GB or larger. Delete all the files from the USB flash drive. Mount the flash drive using the Disks disk utility.

  5. Check in the Disks disk utility to find out the device name of your USB flash drive. This is very important because if you use the wrong device name in step 6, you will overwrite your whole operating system instead of writing to the USB flash drive. So check the USB flash drive device name twice. It should be something like /dev/sd* where instead of the * character there is a lower case letter like a, b, c, etc. In the following step I am assuming that the device name is /dev/sdc, but the device name of your USB drive could be something else like /dev/sda or /dev/sdb so check the device name of your USB drive twice and make sure that you get it right in step 6!

  6. Open the terminal or Windows Subsystem for Linux 2 and run the following commands:

    cd ~/Downloads/  
    sudo -i  
    dd if='mini.iso' of=/dev/sdc bs=4096  ## make sure that the device name of your USB drive is correct!
    

    The dd if='mini.iso' of=/dev/sdc bs=4096 command should take only a few seconds to complete on most computers because the mini.iso is a small file, less than 60MB. The result of running this command will be a bootable Ubuntu mini USB.

  7. Boot the computer from the Ubuntu mini live USB. The Ubuntu mini live USB should boot successfully and show a menu screen.

  8. If you select the Install option (the complete install, not the cli install) from the menu screen in Step 7, then you can select other options during the Ubuntu installation process to download all the packages that you need to perform a complete Ubuntu installation. Select the Ubuntu desktop package collection from the list of predefined collections of software in the Software selection screen in the Ubuntu mini CD installer. When you restart the system at the end of the installation, you will have a working Ubuntu desktop with the default desktop environment.

    enter image description here


Try "Startup Disk Creator" or "UNetbootin" on Linux.

I installed Ubuntu 15.04amd64 last week using Unetbootin and it worked fine.


Download the iso file and check that it was downloaded correctly

The official website is

www.ubuntu.com/download

and you find all current iso files including standard Ubuntu and the community flavours (Kubuntu, Lubuntu ... Xubuntu) via the following link,

releases.ubuntu.com/

and the mini.iso files via

cdimages.ubuntu.com/netboot/

It is somewhat tricky to find Ubuntu 16.04.1 LTS (the version with the longest support time). The following link works (2017-06-27),

old-releases.ubuntu.com/releases/xenial/

The following link can help you check that the iso file was downloaded correctly,

help.ubuntu.com/community/UbuntuHashes

You can use md5sum or one of the other checksum programs, and check that the result matches what is provided in the corresponding file with upper-case name, for example 'MD5SUMS', as shown with the following command line, and check with your own eyes,

md5sum ubuntu-16.04.1-server-amd64.iso

or copy and paste from 'MD5SUMS' to the following command line,

echo 'd2d939ca0e65816790375f6826e4032f *ubuntu-16.04.1-server-amd64.iso'|md5sum -c

This last command should return

ubuntu-16.04.1-server-amd64.iso: OK

Cloning from a hybrid iso file to a USB drive or a memory card

If you clone from a hybrid iso file to a USB drive or memory card, everything relevant will be overwritten, so wiping and formatting will make no difference (except maybe making the final cloning faster, but the total time and effort will increase).

All current Ubuntu iso files are hybrid iso files (including Ubuntu Server and Ubuntu mini.iso).

dd deserves the nicknames 'disk destroyer' and 'data destroyer'

Cloning with dd produces a reliable result, if you do it correctly,

sudo dd if=/path/file.iso of=/dev/sdx bs=4096

where x is the drive letter. But dd does what you tell it to do without questions. If you tell it to wipe the family pictures ... and it is a minor typing error away.

Tools with a final checkpoint

So I would recommend that you use a tool with a final checkpoint, that gives you a chance to double-check that you will install the live system to the correct drive.

Two such tools come with standard Ubuntu and the community flavours (Kubuntu, Lubuntu ... Xubuntu),

  • The Startup Disk Creator (in Ubuntu 16.04 LTS and newer versions; older versions come with an old and buggy version, that you should avoid),
  • Disks alias gnome-disks.

You can install mkusb from its PPA.

  • The standard function is to clone from an iso file or [compressed] image file,
  • but it can also wipe a drive,
  • restore a drive from an 'install device' to a 'standard storage device' (with an MSDOS partition table and partition with a FAT32 file system),
  • create Windows install drives and
  • create persistent live drives with Ubuntu and Debian.

Ubuntu Server is normally run without a desktop environment, so you need a text mode tool, if you want to create the USB install drive or memory card when running Ubuntu Server.

  • mkusb works in text mode too, and is a safe alternative to dd. You can use the simple text version mkusb-nox but also the new mkusb version 12 alias mkusb-dus, which will test for zenity (when there is a GUI), then test for menus with dialog, and finally fall back to a simple text screen interface, if dialog is not installed.

  • If you don't want to install anything you can download the simple text mode bash shellscript mkusb-min or mkusb-minp, check it in a text editor and run it locally without any particular installation.

In Windows you can use the cloning tool

  • Win32 Disk Imager

If cloning does not work

Most modern linux distros provide iso files treated with isohybrid, which make them hybrid iso files. Such iso files can be used to

  • burn CD/DVD disks that are bootable
  • clone USB drives and memory cards that are bootable

But some iso files are not hybrid iso files, for example Windows iso files and older Knoppix iso files (before version 8.1). These iso files must be extracted and special care must be taken to make the target drive bootable. (You can treat an older Knoppix iso file with isohybrid, but it does not work with Windows iso files.)

There are several extracting tools, for example Rufus, which is the officially recommended tool to install Ubuntu from Windows.

Do it yourself

Cloning from the iso file is straight-forward. The only issue is to be sure that you have selected the correct target drive.

If you want to understand the steps in extracting the content from an iso file and creating a USB boot drive, the following links may help,

  • help.ubuntu.com/community/Installation/iso2usb
  • help.ubuntu.com/community/Installation/iso2usb/diy