Starting Debian or Kubuntu Installation from a USB Memory Stick

Assume that you have downloaded the Ubuntu ISO image. And due to whatever reason, you cannot install it using a CDROM (eg: No CDROM drive, or it is just too much work to record a CD ;-)

So you decide to start installing Ubuntu or Kubuntu Linux from a USB thumbdrive. How can one boot from a USB thumbdrive? Read on.

What You Will Need:

  • A working Linux machine (Debian or Kubuntu, maybe)
  • An empty USB memory stick, atleast 700MB+ in size (say 1GB)
  • A target machine where you want to install Linux, should be capable of booting from USB disk. Set the BIOS boot order accordingly.

In the following screenshots, /dev/sdb is the USB thumbdrive. See the confirmation below:

root@mkgg64:~# lsscsi
[0:0:0:0] cd/dvd MATSHITA DVD-R UJ-857D KBV9 /dev/scd0
[2:0:1:0] disk ATA SAMSUNG HM250JI HS10 /dev/sda
[9:0:0:0] disk USB007 mini-USB2BU 0.00 /dev/sdb

 

First step, wipe out the USB stick, create a DOS FAT16 filesystem

root@mkgg64:~# mkdosfs -I -F 16 /dev/sdb
mkdosfs 2.11 (12 Mar 2005)
root@mkgg64:~#

Mount the source ISO image and the target USB stick on some mount points.

root@mkgg64:~# mount -o loop,ro /home/nc/downloads/hardy-alternate-i386.iso /media/cdrom
root@mkgg64:~# mount /dev/sdb /mnt

/home/nc/downloads/hardy-alternate-i386.iso
667M 667M 0 100% /media/cdrom0
/dev/sdb 984M 0 984M 0% /mnt
root@mkgg64:~#

Copy all the files on the CD to the USB stick, ignore any errors such as "Operation not permitted":

root@mkgg64:~# rsync -al /media/cdrom/ /mnt/

rsync: symlink "/mnt/ubuntu" -> "." failed: Operation not permitted (1)
rsync: symlink "/mnt/dists/stable" -> "hardy" failed: Operation not permitted (1)
rsync: symlink "/mnt/dists/unstable" -> "hardy" failed: Operation not permitted (1)
rsync: symlink "/mnt/install/netboot/pxelinux.0" -> "ubuntu-installer/i386/pxelinux.0" failed: Operation not permitted (1)
rsync: symlink "/mnt/install/netboot/pxelinux.cfg" -> "ubuntu-installer/i386/pxelinux.cfg" failed: Operation not permitted (1)
rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]
root@mkgg64:~#

Flush the RAM buffers and unmount the ISO image and USB drive

root@mkgg64:~# sync
root@mkgg64:~# umount /mnt/
root@mkgg64:~# umount /media/cdrom
root@mkgg64:~#

Now we need to make the USB drive bootable. For that we need syslinux package. If you do not have it, install it (ap-get install syslinux)

root@mkgg64:~# dpkg -l|grep syslinux
ii syslinux 1:3.36-4ubuntu5 Bootloader for Linux/i386 using MS-DOS flopp

root@mkgg64:~# syslinux /dev/sdb
root@mkgg64:~# sync

Now, look at the file, /isolinux/isolinux.cfg in the ISO image, which normally defines the path to the kernel, initrd (drivers) etc. We will be lazy and just do no more work. ;-)

menu label ^Install Kubuntu
kernel /install/vmlinuz
append file=/cdrom/preseed/kubuntu.seed initrd=/install/initrd.gz quiet --

Note the above. Remove the USB drive, plug it into a USB port on the system where you want to install linux and power-on or reset the machine.

At the boot: prompt, type the following, the installer should bring up the familiar Kubuntu installer screen

boot: /install/vmlinuz initrd=/install/initrd.gz file=/preseed/kubuntu.seed

Success!