Wednesday, December 1, 2010

Ubuntu Installation From USB Stick

Outline

The recommended way to install Ubuntu 9.10 and later versions from a USB flash drive is to use the usb-creator program, point it at a ISO image of a Ubuntu installation CD that you have downloaded, and let it create a bootable USB that you can use instead of the CD.
  1. Acquire the correct Ubuntu installation files and tools
  2. Put Ubuntu onto your USB drive
  3. Configure your computer to boot from USB drive and boot from it
  4. Try Ubuntu or install to your hard drive.

Introduction

This page gives instructions on how to run Ubuntu from a USB flash drive for installation or to try it out. 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 drive up to save changes you make, unlike a read-only CD-ROM drive. Recent Ubuntu CD/DVD ISO images come with the necessary Windows and Linux utilities to get the system on a USB drive.
Booting from a USB 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.
For custom, manual, older versions, and technical instructions and troubleshooting see USB Installation Media. There are also network installation options available. You can also see the instructions for USB drives from the official 9.04 Install Guide.
Note: This article uses the terms USB stick, USB drive, thumb drive and flash drive interchangeably.

Known Issues

The 9.10 CDs and DVDs are missing the usb-creator.exe program used by the Windows installation processes discussed below. To install the i386 desktop version to a flash drive from a disk image on Windows, use the incredibly easy process described at http://www.pendrivelinux.com/create-a-ubuntu-9-10-live-usb-in-windows/ . When you boot the resulting live persistent USB, you can install to your hard disk if you wish at any time, or not.
If you just get a black screen when running from USB, using the setting "Discarded on shutdown, unless you save them elsewhere" in usb-creator might help. Forum: 9.10 NBR issues
9.10 Netbook Remix does not bring up Broadcom WIFI automatically. Poll and install a few packages manually with dpkg to get networking up. https://bugs.launchpad.net/ubuntu/+source/jockey/+bug/449268
If you get "Incorrect CD-ROM detected" error on detection stage, reboot, press F6 and then ESC to go to manual boot line editing, and add the option 'cdrom-detect/try-usb=true'. On Ubuntu 9.10 server edition the install menu will be shown right after reboot. Chose "Help" and then press F6. At the boot prompt type "install cdrom-detect/try-usb=true" and hit enter.
If the above doesn't solve your CD-ROM detection problem and you used the "Universal USB Installer" to prepare your USB flash drive another solution might be give UNetbootin instead of the "Universal USB Installer" a try. If you are encountering this problem with UNetbootin, press tab at the splash screen to access the boot line editor.
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.
"Can not mount /dev/loop1 on /cow" message because usb-creator.exe is not creating a valid casper-rw file holding ext2/ext3 filesystem. Fix: 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)
There is an unresolved issue in that you cannot create a bootable USB flash drive from within Mac OS X. You must create the stick in Linux or Windows.

Prerequisites

Source machine

Windows

Mac OS X

  • Administrator privileges on computer used to set up the USB flash drive

Linux

  • Administrator privileges on computer used to set up the USB flash drive
  • Install and run usb-creator

USB flash drive

  • A Netbook installation requires a minimum 1 GB USB flash drive.
  • Desktop or server requires a 2 GB USB flash drive.
  • Check the USB drive for files and back them up if needed. Putting the Ubuntu system files on the USB flash drive and making it bootable will destroy all pre-existing files on the USB drive!
  • The Windows utility won't let you select the USB drive if the drive isn't properly formatted and mounted.

Target machine

Netbook

  • 1GB USB flash drive with everything backed up elsewhere, because these commands will over write the partition table.
  • ISO image file, or CD and another computer ubuntu-netbook-remix ISO, or kubuntu-netbook ISO, or
  • Optional, large capacity SD card for storing ISO and or backing up data

Desktop or Server

  • 2GB USB flash drive, or just do network install

Ubuntu CD or ISO

The Ubuntu system files that you will be putting on the USB flash drive are provided as a ISO file that is an image of an Ubuntu install CD-ROM. You need to download the appropriate .iso file.
Ubuntu
Derivatives
Or you can get a physical Ubuntu CD-ROM disk from a friend, order one ... etc.

Creating a bootable Ubuntu USB flash drive

To start Ubuntu from the USB flash drive, it needs the Ubuntu system files from the CD-ROM image, and it must be be configured to start up, or "boot", your computer. There are many guides for doing this on the web, but the easiest way to do the whole thing is to run the Ubuntu usb-creator program. Versions of this are available for Ubuntu and for Windows.

From Ubuntu Linux

The Ubuntu USB startup disk creator is available in the package usb-creator, usb-creator-kde on Kubuntu, or usb-creator-gtk on 9.10.
From the 8.10 release on (9.10 on for Kubuntu), Ubuntu includes the usb-creator by default on all LiveCDs and installations.
You can find it in System-->Administration-->Create a USB startup disk (Ubuntu Desktop) or K-Menu-->Applications-->System-->Startup Disk Creator (Kubuntu). If it is not there then you can install it using the Synaptic Package Manager, or by entering the following command in the Terminal :
sudo apt-get install usb-creator
Make sure the software-sources are activated if you are on a LiveCD (software sources or sudo gedit /etc/apt/sources.list). You may need to install the python-gnome2 package as well.
Start usb-creator. It looks like this
https://wiki.kubuntu.org/Kubuntu/Netbook?action=AttachFile&do=get&target=screenshot-usb-creator.png
  • If you have the physical CD or DVD-ROM of the Ubuntu version you want to install on the USB drive, insert it in your CD-ROM drive. Otherwise, in its top pane, click "Other" and locate and select the .iso file that you downloaded.
  • Insert the to-be-nuked USB flash drive into the computer. You do not need to mount it or view it. It should show up in the bottom pane titled "Disk to use". (You may have to use GParted to format the USB drive--I used 'ext3' as the format and it worked.)
  • Make sure you have the correct device selected before clicking the button to "Make Startup Disk"!
Notes
  • If the progress bar proceeds very slowly (1% every 10 seconds or so) you may want to make sure your USB flash drive is mounted without the "sync" option. This seems to work around single-byte writes bug in Jaunty's usb-creator.
  • There may be bugs during the formatting which will show up as two partitions 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 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
  • If you have problems with usb-creator, you can instead install and use UNetbootin to do the same thing.

From Windows

Versions of Ubuntu other than Ubuntu 9.10 (Karmic Koala) include a file called usb-creator.exe in the CD image. You need to run this program, so you need to copy it out of the CD image. To do so, you can burn the Ubuntu ISO file to a disk, or you can use a Windows utility such as Virtual Clone Drive to access the .iso file's contents. You can also use 7Zip to extract the ISO so you can work with the files inside.
This process is described in detail in a video on this website.
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").
Notes
  • Instead of usb-creator.exe you can use Unetbootin to create a bootable USB drive. http://unetbootin.sourceforge.net/
  • You won't be able to select the USB 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.

Booting the Computer from USB

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 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.)
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 force the computer to attempt to boot from USB before booting from the hard disk.

Alternative methods

PLoP Boot Manager

Some computers can see the USB flash drive and have the option to boot from USB but cannot actually boot from USB. 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 drive are changed during boot. To use this method more than once, you must delete all files from the USB drive and prepare the USB drive again as described below.

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 flash Drive has more than 2GB of memory
  • Your flash Drive is bootable
  • Your flash Drive has a high read/write speed and is USB 2.0 enabled
The process is described in detail in an external source.

9.04 and Earlier .img for Netbook

If you have downloaded an .img file, please refer to the .img writing documentation

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 drive as long as you have enough space for the files. It also allows multi boot, so you can, for example, have your USB 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 on to the USB's MBR. Follow the link to the Grub4DOS Wiki: Simple example:
./bootlace /dev/sdx
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 drive otherwise the install will error out.
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.

Thanks to:
https://help.ubuntu.com/community/Installation/FromUSBStick

No comments:

Post a Comment