Ubuntu: How do I install Ubuntu to a USB key? (without using Startup Disk Creator)



Question:

If you are hurrying to reply, System â†' Administration â†' StartUp Disk Creator -- no, that's not what I'm talking about.

I want to try Ubuntu 11.04's Unity without touching my existing Ubuntu install.

To do this, I need to install the nVidia drivers first (sigh).

To do this, I need changes to persist a reboot.

To do this, I need to really install Ubuntu on a USB key.

How do you do that?


What I tried

  1. I tried to make a USB key from Testdrive, then boot from it, then choose "Install Ubuntu." The installer refused to install to the installation media itself.

  2. I tried, from my installed copy of Ubuntu:

    sudo kvm /dev/sdb --cdrom .cache/testdrive/iso/ubuntu_natty-desktop-i386.iso  

    ...but the installer didn't detect the disk properly.


Solution:1

Ubuntu/Linux solution

1. Obtain latest image

You should do this with testdrive Install testdrive.

TestDrive

Note. If your key is smaller than 4.4 GB (for Ubuntu 11.04), you must get the alternate installer. The Desktop installer refuses to continue if there is less than 4.4 GB of free disk space.

2. Format the USB disk.

This is important if you already have anything looking like a Linux install on your disk, or the installer will not want to touch that disk, for some reason. I failed earlier because I didn't perform this step, so skip at your own risk! You need a key that is at least 3GB in size.

You can do so from System â†' Administration â†' Disk Utility. Choose the destination USB key, unmount all partitions and select Format Drive.

Disk Utility

You need to make sure you select "Don't Partition" before it lets you format the disk.

Format drive window.

3. Start a virtual machine on the USB key

I made sure (with file) that my USB key was in /dev/sdb, then ran:

sudo qemu-system-x86_64 /dev/sdb -cdrom ~/.cache/testdrive/iso/ubuntu_natty-desktop-i386.iso  

...to install the i386 ISO of Natty desktop -- the file name will vary if you download a different ISO.

Details for your virtualization solution of choice will vary, but you want to use the device file of your USB key as the VM's hard drive.

Append -boot order=dto the kvm command to make it boot from the image in case it tries to boot from the 'hard disk' and fails because it cannot find an operating system there.

4. Install normally.

At this point you are working on a virtual machine that sees your USB key as the only connected hard drive. From inside the "QEMU" window, install as you would normally do.

A few notes:

  • Partitioning. Avoid using the automatic partitioning system, as it will create a swap partition on your USB key. That's no good, as swapping becomes super slow (seconds-long system freezes slow) and quickly kills your drive's life. Simply allocate a single partition for /. If you're using the alternate installer, make sure you set the noatime flag to further reduce the amount of writes to the disk.

  • Updates. Skip the option to automatically download and install updates. It is not guaranteed that the repositories will be in a consistent state by the time you run the installer. Personally, I'd rather manage the upgrades manually with a tool such as aptitude (which does no longer ship with Ubuntu by default).

  • Alpha-quality software. Things are a little wonky -- it is alpha quality software, after all. I had dpkg exiting with error code 1 without being able to review the error - no packages were broken as a result, however. I tried to shutdown the virtual machine cleanly after the setup, but it hung. On a reboot, however, the system booted fine.

5. Reboot and boot into your copy of Ubuntu

You may need to fiddle with your BIOS settings to make this work.


A nice (or annoying, based on your use case) thing about Ubuntu on a USB is that next time it'll refresh GRUB, it'll also detect and add to the list the kernels and operative systems on the HDD. This should let you boot straight into your HDD from your USB key's GRUB.


Solution:2

Installing Ubuntu to a removable USB drive with Virtual Box

In order to install Ubuntu to a portable external USB drive (either disk or stick) we may also use Virtual Box to install from a virtual environment. For USB 2.0 support the closed source but free PUEL-version of Virtual Box is needed.

Create a virtual machine for the installation live environment:

We create a virtual machine for a Linux/Ubuntu environment (32- or 64-bit, depending on the installation medium):

enter image description here

As we want to install to an USB drive we do not create a virtual harddisk (VDI) for this machine by unticking the box in the following window:

enter image description here

We then need to assign system memory (e.g. 1024 MB), graphics memory (e.g. 128MB), and adjust CPU settings according to our host hardware. Also we may want to create a bridged network in order to be able to download files during the installation.

Mount the installation CD to the virtual machine:

In the Storage menu from Virtual Box Manager we select the .iso image of our installation CD to mount as CD drive. Make sure the boot order of the virtual machine is set to boot from CD.

enter image description here

Mount the USB drive to the installation environment

After we started the virtual machine (USB support needs to have been set up first) to boot the installation CD we need to mount the USB drive either by clicking on the small icon in the bottom panel or by choosing from Devices -> USB Devices menu of Virtual Box Manager.

enter image description hereThis is when the USB drive needs to have been mounted before we proceed

Partition and format the USB drive

After having chosen Something else the graphical partition manager GParted will guide us through the partitioning process:

enter image description here

We need at least a partition with a mount point root (/). In the example above an additional /home partition was created. By unticking Format we keep the data that may already be there. A /swap partition may not be needed for an USB-stick or a portable drive.

  • At this point take extra care that the boot loader Grub indeed will be installed to the USB drive (/sda) and not to anywhere else

By selecting Install Now we start the installation to our USB drive. Consider that this installation may take a bit longer than we are used to.

After the installation has finished we may unmount our drive eith the brand new operating system and boot from any other machine to customized it to our needs.

  • Do not forget to enable booting from USB in this computer's BIOS.


Solution:3

If you are talking about an actual install, as in a full Ubuntu install rather than just a Live USB type then what you can do is use an external hard drive that plugs in via USB and install to that via the following method.

Please Note: The following steps were tested using Ubuntu Version 9.10, but has not been tested with the later versions. Use at your own risk & discretion.

What You Will Need

  1. A Computer with Internet access.
  2. A LiveCD or LiveUSB with Ubuntu.
  3. An external Hard Drive with USB capability.

What To Do

  1. Open up your computer and remove the Hard Drive.
  2. Plug in your external USB Hard Drive via the USB cable.
  3. Stick in your LiveUSB or LiveCD and then boot up your PC.
  4. Open up the boot menu, and choose to boot from the LiveCD/LiveUSB.
  5. During the installation process you should your external hard drive listed, install Ubuntu to that.
  6. Finish the installation process, turn off your PC, and put your other hard drive back into your computer.
  7. Reboot your computer, go to the boot menu and select your external hard drive and attempt to boot from it. If it does congratulations, you now have an external hard drive with a full fledged Operating System on it.
  8. Enjoy your external hard drive running Ubuntu/Linux! Please do let me know if this helps you! If not let me know about that too. :)

But if you're just wanting a Live USB then you can use the Universal USB Installer for that or the Ubuntu USB Startup Disk Creator...


Solution:4

I did it using the following method :

  • insert liveCd and plug USB key.

  • select install ubuntu.

  • chose advanced when selecting drive partition.

  • chose your USB key partition as target.

  • CAUTION : chose your USB partition for the grub loader.

After installation process, boot on your USB key not your hard drive


Solution:5

1) Universal USB Installer:

Universal USB Installer is a Live Linux USB Creator that allows you to choose from a selection of Linux Distributions to put on your USB Flash Drive. The Universal USB Installer is easy to use. Simply choose a Live Linux Distribution, the ISO file, your Flash Drive and, Click Install. Other features include; Persistence (if available), and the ability to fat32 format the flash drive (recommended) to ensure a clean install. Upon completion, you should have a ready to run bootable USB Flash Drive with your select Linux version installed.

2) UNetbootin:

UNetbootin allows you to create bootable Live USB drives for Ubuntu, Fedora, and other Linux distributions without burning a CD. It runs on Windows, Linux, and Mac OS X. You can either let UNetbootin download one of the many distributions supported out-of-the-box for you, or supply your own Linux ISO file if you've already downloaded one or your preferred distribution isn't on the list.

3) LinuxLive USB Creator:

LiLi creates portable, bootable and virtualized USB stick running Linux. Are you sick of having to reboot your PC to try Linux ? No need with LiLi. It has a built-in virtualization feature that lets you run your Linux in Windows just out of the box.

All three programs above allow you to install any Linux operating system to a flash drive, but the persistence feature (allows you to save any changes made to a LiveOS installation permanent to be used even after reboot) is only available for Ubuntu and its many other flavors.


Solution:6

The only way I have been able to do it, is

  • to burn the CD iso,
  • disconnect my hard drive (physically remove cable(s)) and
  • install to the USB.

Not very elegant, but it works.


Solution:7

You can, yes.

This process assumes you are installing from a live cd. While a live usb should work fine as well, the cd option is theoretically the safest, as there is no chance of overwriting the cd during the partitioning.

I recommend you start off by disabling your internal HDD in your BIOS first, as this makes sure there is no chance of accidentally overwriting your internal partitions. Also, the partitioning step of the Ubuntu setup will be much easier, since it will only detect the USB drive. With other words, it's best to make the USB drive the only storage device present on the machine during the installation.

Next, boot up the live cd and initiate the installation as usual. Make sure you choose "use whole disk" if you disabled all other storage devices, otherwise you will have to do manual partitioning. In the last case, create an ext4 partition on the USB stick (make a partition table if there isn't one) and, if necessary, a SWAP partition if you intend to run heavy applications. Set the mount point to /. don't touch the other storage devices and their partitions!

When the setup asks for the bootloader location, choose the device name of your USB drive. This can be /dev/sda, /dev/sdb, so on, but don't choose a partition (e.g. /dev/sda1).

Wait for the installation to complete, then reboot. Make sure your machine boots from the USB drive. This can be made sure either from the boot menu (usually esc or a function key) or from the bios, where the boot sequence can be altered.

If everything went okay, Ubuntu should boot from the USB drive. If GRUB shows up, choose the first option.

Lastly, run the following command from your freshly installed Ubuntu desktop:

sudo chmod -x /etc/grub.d/30_os-prober  

This makes sure that update-grub does not detect any other OSes that may be present on the system, as they do not matter for your Ubuntu USB drive installation. Also, when you boot up your USB drive from a strange computer, the OSes on its internal drive will be included into GRUB when a kernel/grub update occurs. This is unwanted.

Also, make sure to turn back on your internal storage devices from your BIOS.


Solution:8

The process of doing a full installation of Ubuntu to a USB flash drive is identical to installing Ubuntu on a hard drive except for the installing the GRUB bootloader. All of the steps to follow in the Ubuntu installer are identical except for installing the GRUB bootloader. Installing the GRUB bootloader on the USB flash drive will replace the existing GRUB bootloader on the hard drive which you don't want to do, unless you disconnect the cables to your hard drive(s) first before you start the Ubuntu installer to do a full installation of Ubuntu on a USB flash drive. So disconnect the hard drives first, then you can install Ubuntu on a USB flash drive.

It's also possible to do a full installation of Ubuntu on a USB flash drive without disconnecting the cables to the hard drives first by following the steps in the accepted answer to this question by Takkat.

Prepare a 16GB flash drive with 3 partitions: 250MB EFI System Partition (ESP), 250MB-1GB BIOS boot partition and a root partition. This way the flash drive will work on both BIOS and UEFI systems. GPT is probably the most reliable disk partitioning format for this.

The formats of the three partitions are as follows:

  • EFI System Partition - FAT32
  • BIOS boot partition - ext4 (can also be ext2 or ext3)
  • root partition - ext4 (can also be ext2 or ext3)

After installing Ubuntu on the 16GB drive, boot to it and install an EFI-mode boot loader/manager like rEFInd in the ESP partition as EFI/BOOT/bootx64.efi

To install rEFInd from the PPA of Rod Smith, the developer of rEFInd, open the terminal and run the following commands:

sudo add-apt-repository ppa:rodsmith/refind    sudo apt-get update  sudo apt-get install refind  

Additional information about a full installation of Ubuntu on a USB flash drive.

  • I recommend that the USB flash drive be at least 16GB.
  • A USB 3.0 flash drive is a lot faster than a USB 2.0 flash drive.
  • A swap partition will cause necessary read/writes to the USB flash drive, which will slow down the operating system and shorten the life of the USB drive. So select the manual partitioning option in the Ubuntu installer and create only a single / partition (root partition) without a swap partition.
  • The advantage of using a USB flash drive lies in its portability, not in its performance. The performance of a full install of Ubuntu on a 16GB USB flash drive is nothing like what you would get from running Ubuntu in a virtual machine application such as VirtualBox.


Solution:9

Things have changed since 2011, Nvidia drivers are no longer required for Unity and unlimited persistence using casper-rw/home-rw partitions is possible, (but not with recent Ubuntu syslinux type boots, (SDC, Unetbootin, Roofis, Universal, etc)).

Mkusb is an installer that will fill all of the op's requirements, (if Nvidia drivers were only needed for Unity).

The user is given a choice of setup options and can select the percentage of space used for the persistent partitions, mkusb will then make remaining disk space available to Linux or Windows as storage. https://help.ubuntu.com/community/mkusb .

If the user does require Nvidia drivers a Full install is required as these drivers load before before persistence during boot


Solution:10

mkusb

Tested on Ubuntu 16.10 host, 16.04 USB, Lenovo Thinkpad T430.

Previously mentioned at: https://askubuntu.com/a/848561/52975 but here are more details.

Only available from PPA currently:

sudo add-apt-repository universe  sudo add-apt-repository ppa:mkusb/ppa  sudo apt-get update  sudo apt-get install mkusb  dus  

and I tried the GUI version. More details at: How to make a persistent live Ubuntu USB with more than 4GB

I couldn't install NVIDIA drivers successfully however, bug report: https://bugs.launchpad.net/mkusb/+bug/1672184

qemu

Tested on Ubuntu 14.04.

Download the Ubuntu ISO.

Find your USB with:

sudo lsblk  sudo fdisk -l  

Say it is /dev/sdX. Most often it will be /dev/sdb: sda is the main hard disk, and sdb the first USB. Now:

sudo apt-get install qemu  # Remove any existing boot sector, that causes installation problems.  sudo dd if=/dev/zero of=/dev/sdX count=16  sudo qemu-system-x86_64 -boot d -enable-kvm -hda /dev/sdX -m 512 \      -cdrom ./Downloads/ubuntu-14.04.2-desktop-amd64.iso  

From inside the emulator, do a normal Ubuntu install that erases the old disk.

Installation took a bit longer than on a hard disk, but worked.

I tested with:

  • plug the USB on a computer and boot from it
  • create a file on my home directory
  • reboot

The created file was still there.


Solution:11

I followed the Ubuntu guide on their site.

Cononical recommend this program and I have uses it for every install of Linux to date and the program also writes Grub2 to the installation so all you need to do is select 'boot from USB' in your BIOS and go from there.

Here's the download link too:

To install to a USB

How do I install Ubuntu to a USB key? (without using Startup Disk Creator)


Solution:12

Another way to start Ubuntu installation is to get to Grub console from Grub2 Boot Menu. It will fire up installation from Ubuntu ISO file on your HD.

Lets say you have your Ubuntu.iso on 3rd partition of your hard drive

Type c to get to Grub command promt and type the following:

loopback loop (hd0,3)/Ubuntu.iso  

press "Enter"

linux (loop)/casper/vmlinuz.efi iso-scan/filename=/ubuntu.iso file=/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash  

press "Enter"

initrd (loop)/casper/initrd.lz  

press "Enter"

boot  

press "Enter"

note (hdx,y) - is the partition where your Ubuntu ISO file is

This will fire up normal Ubuntu installation process just like you see it when installing from Ubuntu CD. From there you can choose your USB Flash Drive to install Ubuntu on it.


Solution:13

I was able to do this using 2 usb's:

One created as a usb ubuntu installer the normal way (the installer usb) Another as the OS usb.

(I recommend to rm your hdd's first)

1) plug in the installer usb, boot into it's live desktop 2) run the installer, installing to the os usb

Worked a treat!

Now I've got an OS usb I can boot from anything! yay.


Solution:14

For Ubuntu 12.04 through 16.10 (all currently supported versions and flavors) the documented requirements vary but regardless an 8GB flash media should be sufficient to the task. A 16 GB version doesn't cost much more and can provide some "running room". The process itself couldn't be simpler.

1) Obtain a current ISO in the flavor of your choice

2) Check the hash to insure it's valid

3) Create a bootable media with the ISO (flash or optical disk)

There are a number of ways of doing this, my preferred method is to either

A) Flash drive method

Use dc3dd to simply duplicate the ISO to a target installer flash drive via the command line with the command sudo dc3dd if=yourisoname.iso of=medianame where yourisoname.iso is the name of the iso you downloaded and checked the hash for previously and medianame is the device name of your flash media. (as in /dev/sdb for example) you can easily determine the device name by checking the output of sudo fdisk -l

or

B) Optical Disk method

Burn the image to optical disk with your preferred OD image writing software. I'm rather partial to K3b but any optical disk burning software that supports the "Burn image" option should be suitable.

4) Continue to install normally as in:

Boot the installer and select the target flash drive as the target (I use manual partitioning AKA something else so that I can avoid creating a swap partition to reduce writes to the flash media that may cause early demise)

If any part of this process is unclear to you please drop me a comment and I will attempt to clarify. Note that if you are using a flash drive to install from, you'll need a second flash drive for your target installation.

EDIT: Another option would be to perform a Netboot Installation from the Internet I have not attempted this personally but include it as an option here in an attempt to cover all the options.

If you are careful there isn't much risk of overwriting the MBR of an existing drive in your system. After booting the live system you can run sudo fdisk -l from the CLI or Disks from the GUI and determine which drive is your valid usb target.

Once installation is complete you should be able to boot from your flash drive on any system with similar architecture simply by selecting your flash drive as the boot device in the BIOS.


Solution:15

It has been described here and in many other places how to install Ubuntu into a USB drive like you install it into an internal drive. It is straight-forward to do it with the standard installer (Ubiquity), if you can disconnect or unplug the internal drive. It works in either UEFI mode or in BIOS mode, the same mode as was booted when installed.

Installed system that boots from UEFI and BIOS mode

But if you want a USB drive with an installed system, that boots in both UEFI and BIOS mode, it is more difficult. I made such systems and prepared compressed image files, that can be installed in linux with mkusb directly, or in Windows in a two step procedure, extraction and cloning (and fixing the GPT). mkusb does it all, including fixing the GPT.

The mkusb Launchpad project is here.

The systems created from these compressed image files are quite portable between computers, not quite as portable as a persistent live system, but more flexible, when you want to update and upgrade the system (kernels, drivers etc).

See the following links and links from them,

help.ubuntu.com/community/Installation/UEFI-and-BIOS

Installed systems with guidus and gparted

You find compressed image files at this link,

phillw.net/isos/linux-tools/uefi-n-bios

Look for the newest files with updated versions of the installed program packages.

If there is a temporary problem to download these compressed image files, you can try the following torrent files,

dd_text_16.04-UEFI-n-BIOS_2017-01-15_intel-4-pendrive-7.8GB.img.xz.torrent

dd_dus-lxde_16.04-UEFI-n-BIOS_2016-12-12_intel-4-pendrive-7.8GB.img.xz.torrent

uploaded at UEFI-and-BIOS/torrent where you also find a short description. [Left]click on the torrent link, get to the attachment page, and there you right-click on the link and select 'save link as' to get the torrent file.

user: guru  password: changeme  

dd_text_16.04-UEFI-n-BIOS_2017-01-15:

enter image description here

dd_dus-lxde_16.04-UEFI-n-BIOS_2016-12-12:

enter image description here


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »