HOW-TO:Install Kodibuntu from a USB drive

This page explains procedures and methods to create a USB bootable drive or install Kodi into a USB flash drive. The instructions are written for Kodibuntu, but may work for other installs with ISO images.

= Outline =

The general procedure to install Kodibuntu from a USB flash drive is:


 * 1) Acquire the correct Kodibuntu installation files ('the ISO')
 * 2) Put Kodibuntu/Ubuntu onto your USB flash drive
 * 3) Configure your computer to boot from USB flash drive and boot from it
 * 4) Try Kodibuntu/Ubuntu or install it to your hard drive.

= Introduction =

Kodibuntu can be installed from a USB flash drive, much like Ubuntu. This may be necessary for netbooks and other computers without CD drives, and is convenient for others. Also, configuration changes can be saved on the USB flash drive, unlike a CD-ROM drive.

Booting from a USB flash drive created with this utility will behave 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 Kodibuntu onto the computer's hard drive or launch the Live USB environment.

Kodibuntu can also be installed to a USB flash drive, though the life-span of the drive may be reduced slightly, due to the extra read/write cycles that Kodi requires. A tmpfs can be created to mitigate this though it is not covered by these instructions.

You can also install Ubuntu and then Kodi on top, but this guide is only about creating a bootable flash drive from an ISO. It's either-or, not both.

= Prerequisites =

To create a USB installation disk, you will need:
 * Your favorite bootable USB creator tool
 * A 2GB or bigger USB flash drive. Files on this USB disk will be erased, so back up your data first. Make sure this USB disk is properly formatted and mounted.
 * A Kodibuntu ISO file. See Kodi Download to download it.


 * A Ubuntu image file. See [|Ubuntu Download] to download it.

= Creating a bootable Kodibuntu USB flash drive =

From Ubuntu



 * Install and run 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 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.
 * 1) Select the first bootable partition on the USB device as the disk to use
 * 2) The bootable partition should be formatted as either a FAT16 or FAT32 filesystem. This is the default for most USB flash drives.


 * 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.
 * 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 (Automated, graphical approach)


UNetbootin for Mac OS X can be used to automate the process of extracting the ISO file to USB, and making the USB drive bootable. The resulting USB drive, however, can be booted on PCs only. If attempting to make a USB drive that can be booted from a Mac, or if UNetbootin does not successfully create a bootable drive, follow the instructions below.

Manual Approach
If you would prefer to use a USB bootable in Mac, please follow the instructions below.

hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/Kodibuntu.iso
 * Download the desired file
 * Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)
 * Convert the .iso file to .img using the convert option of hdiutil (e.g.)

diskutil list to get the current list of devices diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2) diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2) sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./Kodibuntu.img or ./Kodibuntu.dmg). diskutil eject /dev/diskN and remove your flash media when the command completes
 * Run
 * Insert your flash media
 * Run
 * Run
 * Execute
 * Using /dev/rdisk instead of /dev/disk may be faster.
 * If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.
 * If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the Disk Utility.app and unmount (don't eject) the drive.
 * Run
 * Restart your Mac and press Option while the Mac is restarting to choose the USB flash drive

MacBook Air 13" 2010
Please notice: While all of the info and above commands are executed properly on a MacBook Air 3,2 (that is the 2010 version 13" version of the Air) the end result will not produce a bootable USB device, at least not with the image for Ubuntu 10.10 64-bit. When booting of the USB device the following message or something similar will appear: "Missing operating system" and the process is auto-magically halted.

To get the USB device (e.g. a USB stick) to show up at all in the boot menu you also may have to reboot/turn on/off the computer a couple of times and also resync the partition tables using rEFIt. After doing this the USB should then appear as a bootable device while holding in the alt or c key when you are rebooting the computer. Notice that both the computers built in bootloader and rEFIt will identify the USB device as a Windows device, but that's not a problem and expected.

A workaround to the-usb-device-is-not-booting-problem is to:
 * Install rEFIt.
 * Create a bootable start disk using Ubuntu and a USB stick.
 * Create a separate partition on the Airs HD.
 * dd the whole USB stick to that partition.
 * Resync with rEFIt. Turn power off and on.
 * Select Pingo/Windows logo: Install should start. (Here you might want to press F6 to change parameters, e.g. use nomodeset)

Alternatively, burning a CD and installing via an external CD-drive will work fine on the Macbook Air 3,2.

From Windows
Download and use Linux Live USB Creator aka LiLi.


 * 1) Choose a USB flash drive in the dropdown list.
 * 2) Select an ISO/IMG/ZIP file, or Download.
 * 3) If you want to create a Live USB choose the size of persistent data (usually between 250 MB and 2 GB or more depending on size of library and amount of artwork you likely to store in userdata).
 * 4) Check the options you want.
 * 5) Click the lightning button to start the creation.

Steps 1, 2, and 3 are mandatory, and each has a traffic light to indicate its state:
 * Red light: the step has not been completed correctly, and you cannot start creating a Live USB key
 * Orange light: there is a non-critical problem with this step, but you can still start the creation
 * Green light: everything is fine, go ahead

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.

= Booting the Computer from USB =


 * 1) Remove all unneeded USB items, but keep the network cable attached.
 * 2) 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.
 * 3) 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, F8, 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, Asrock ION machines is F11)
 * 4) 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 F11, F12, F10. Note: with some motherboards you have to select 'hard disk/USB-HDD0' to choose the USB flash disk.
 * 5) If 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.


 * Plop boot manager For more instructions and download.

Mac

 * Restart your Mac and press Option while the Mac is restarting to choose the USB flash drive

= Alternative methods =

Installing Kodibuntu directly on a USB flash drive
In order to install a fully working Kodibuntu 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 or newer enabled.
 * Your USB flash drive has persistence enabled

'See A better way to create a customized Ubuntu live usb drive

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 other OS and other Boot CD tools at the same time.

In order to do so you need :


 * Bootable USB flash drive ( NTFS / FAT32 / FAT 16 ), Disk with MBR, you can do this with gparted in Linux or HP format in Win, fdisk ....etc
 * Kodibuntu or Ubuntu ISO
 * Tools to extract files from the ISO ( ISO Mount, WinZIP, WinRAR, 7Zip, etc....)
 * Grub4Dos
 * 1) Grub4DOS Tutorial
 * 2) Grub4DOS 0.4.4 for WIN9x/DOS/Linux (Download Here)
 * 3) Grub4DOS GUI for WINXP/Vista/7 (Download Here

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: 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). 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
 * Copy the iso file onto the USB flash drive in the root (top) directory
 * Add these lines to the menu.lst file:

= Known Issues =

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.

Ubuntu 10.04.3 is having issues. You might get a segmentation fault if used from command line. There are many launchpad bugs regarding segmentation fault (eg: 572611).

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. Fixes:
 * 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 need Mac OS X to create a USB flash drive that can boot on Macs. Even so, the process is less reliable than using a CD, as the USB flash drive is not always recognized on boot. Reversely, you can't create bootable USB flash drives for other platforms than Macs from withing Mac OS X. This is because Macs use a custom EFI bios with a custom boot-loader and need a special filesystem layout to boot correctly.

Resolving problematic installs
If you are having problems not being able to get the installer to behave, below some steps that should correct that.


 * 1) Boot your system with the installer thumbdrive and select the "Try Ubuntu" option.  This should boot into Kodi.
 * 2) Click the Shutdown menu in Kodi (lower-left corner) and select "Exit"
 * 3) You should be presented with a log-in screen.  Click "Other..." and enter Kodi as the login and select Kodibuntu from the dropdown menu (below the Login field).
 * 4) Click "Login" and you will be prompted for the Password;  just leave it blank.
 * 5) Click "Login" again and the Kodibuntu desktop should be displayed.
 * 6) On the top-left corner of the desktop should be an icon to install Ubuntu.  Double-click the icon and, hopefully, you'll get the installation wizard this time.

= See also =

= References =

= Credits = These instructions have been adapted from the Ubuntu Community Documentation and credits for its creation are attributed Ubuntu Documentation Team as per their creative commons licence 3.0.