Making the commitment to partition your precious laptop’s hard disk in order to install the Ubuntu Linux operating system is not always an easy thing to do. This tutorial will describe in detail how to install Kubuntu on a removable 4GB USB flash drive, and configure the bootloader to boot Linux whenever the drive is connected.

USBuntu

Lately I have been fooling around with Kubuntu on a desktop computer and I really wanted to use it on my laptop. However, I was hesitant to partition my hard drive because I have a lot of documents and pictures and software that I would hate to lose in the event something went wrong. Additionally, I don’t have a tremendous amount of free space on my hard drive to devote to another operating system. So I decided to try to install Kubuntu on a USB flash drive.

I found some posts in the Ubuntu forums that helped figure out how to make installing Kubuntu to a USB drive possible; this one was the most helpful. It’s very thorough and the thread covers many issues that arise with different hardware configurations. My experience was slightly different than what the post describes so I will detail the steps I took to install Kubuntu on a USB drive.

First off, my laptop is a Dell E1405, and the USB drive I used is the SanDisk Cruzer 4Gb which periodically goes on sale for a little less than 40 bucks. I think the write speed is slow but it has a nice orange light which will dazzle you while you wait. The 2 Gb version will work, but I had to do a lot of software removal to make it happen (I will be testing Xubuntu on the 2Gb drive in the near future). I highly recommend just using 4Gb or more.

Secondly, I’m still relatively new to Linux. This certainly isn’t the be-all-end-all tutorial, and I can’t guarantee that these steps will work on hardware other than Dell’s E1405 with an Intel Pro wireless card, or the San Disk Cruzer USB drive.

Preparing the USB Drive

Before you do any thing else. Uninstall ALL of the software that comes pre-installed on the USB drive. When you plug in the USB drive SanDisk U3 software automatically loads. Use the icon in the system tray to find the uninstall feature. It is a bit hidden and I don’t remember exactly what tab it is under. It might require a right click. After I uninstalled U3 I also re-formatted the drive, not sure if it is necessary.

Getting Kubuntu

Head over to the Kubuntu download page and download the Feisty Fawn 7.04 Live CD and the Alternate install CD. There is a Ubuntu Documentation page that will tell you how to burn the files on to a CD to make a bootable .ISO image using the Infra Recorder software. (The Live CD is not part of the actual install process but it is helpful in determining what you computer calls the devices that we will be installing Kubuntu on. It is also nice to have around for future use.) After your CDs are burned make sure to take them out of the CD drive. You should then restart your computer and enter the BIOS Setup page as your computer restarts. Verify that your computer will boot in the order of CD, USB, then Hard Drive.

Finding Your USB (Device Node) Name

Insert the Live CD and exit the BIOS. The live CD takes a little while to load. Once you are on the Kubuntu Desktop, plug in your USB device. You can find the device node by putting the mouse pointer over the device icon or by using the system menu icon, the second icon from the left on the bottom panel menu, and select “Storage Media.” In the Storage Media expanded menu you can see the internal drive and the USB drive. Write down the name. On my Dell E1405 the USB drive is listed as /dev/sdb and the hard drive as /dev/sda with the various drive partitions numbered like /dev/sda2. So I know that I will be doing all of my installing to sdb and NOT my internal drive sda. Other computers use device nodes like hda or hdb.

Installation

When you are ready to install, log out and get the Live CD out of the tray. When you restart the computer, enter the BIOS and insert the Alternate Install CD. Exit the BIOS. The Install Menu screen be present now.

The “Install in Text Mode” is the first option. Select it for a normal install. I’ll just walk through my notes here and what I remember the installer asking and the choices I made. IMPORTANT: Be careful not to install GRUB Loader to the Master Boot Record! This step comes after the timezone and username selections.

  • Choose your Language and Country.

  • Detect keyboard layout. For US keyboards select “No” then select Origin–>U.S. English and Layout –>U.S. English.

  • Network configuration. If you are not connected to a network you can hit “Cancel” or if a network is not present select “Configure later”

  • Hostname. Choose a name for your computer.

  • Partition Disks. Select “Guided - use entire disk.” Select your USB drive. It should show a description of your USB drive and include the device node that you found earlier (e.g. sdb). Do NOT choose your internal drive!

  • Finish Partitions and write changes. Write to disk–> yes

  • Choose Timezone

  • Choose Username, Username Account, and Password.

READ THIS: The GRUB Boot Loader wants to install next. DO NOT install to MASTER BOOT RECORD. Select NO. If you do not select “NO” GRUB will install to your hard drive.
  • Write in your USB device node. Once again, mine was: /dev/sdb. (The text says you could use (sdb) instead of /dev/sdb but the installer didn’t like when I tried it that way.)

Configuring the GRUB Bootloader

Your installation should now be complete. Be sure to eject the disk before you shut down your computer. When you start up again you will have to do some editing in the GRUB menu. GRUB is looking at the wrong drive to boot so we need to tell it to look at the correct drive. This editing is temporary for this start up only.

When the GRUB menu appears, use an arrow key to move the line selection so that the automatic start up timer stops. If you missed the timer the system will try to boot and will give you some sort of Error 17 message about invalid partitions or something. The ESC key should bring you back to the GRUB menu.

Select the first line in the grub menu “Ubuntu Kernel….” Type ‘e’ to edit.

In the next menu select the first line Root (hd1,0). Type ‘e’ to edit.

Use the arrows and back space to edit the line grub edit> root (hd1,0) to read grub edit> root (hd0,0)

Hit the ENTER key to make the change and you will be directed back to the previous menu.

Now hit “b” to boot Kubuntu!

You can make this boot change permanent by entering the terminal from Kmenu-> System-> Konsole(Terminal Program)

Editing GRUB menu.lst

On my first attempt at installing Kubuntu on a USB I edited the menu.lst to make the permanent change. It works fine until you do a kernel update. In my latest attempt I have not permanently edited the file and I have not done a kernel update.

To edit type:

sudo nano /boot/grub/menu.lst

Use the arrow keys to navigate down until you see this just past the line that reads

## ## End Default Options ##

title           Ubuntu, kernel 2.6.20-15-generic
root            (hd1,0)

kernel/boot/vmlinuz-2.6.20-15-genericroot=UUID=75660762-f5cf-4b5d-97$
initrd          /boot/initrd.img-2.6.20-15-generic
quiet

savedefault

change root (hd1,0) to (hd0,0) make this change for the recovery mode “title Ubuntu, kernel 2.6.20-15-generic (recovery mode)” and memtest “title Ubuntu, memtest86+” too. Both are the right underneath the first group that you just edited.

The tutorial mentions making changes to ## default grub root device

## e.g. groot=(hd0,0)

# groot=(hd1,0)

so that # groot=(hd1,0) also is changed to (hd1,0). One user posted a comment about the kernel update reading the line with only one # to determine the location of the Boot Loader. As I mentioned previously, I have not made these permanent edits yet and do not know if they work. I bricked my USB Kubuntu after a kernel update and had to start over again. I’ll try making these edits in the near future and post my findings when I can. In the meantime I edit the GRUB every time I start up … I think it’s kinda fun.

Hardware Issues

If your hardware differs from mine or something is not working, check out the tutorial I mentioned above. This tutorial makes many edits in the terminal which I found my with hardware configuration or Kubuntu version to be unnecessary.

The only major glitch I had with hardware was my screen resolution. The intel i810 driver didn’t want to give me the native 1280×800 resolution. There was a quick fix found here. Once again there are several steps listed, but for some reason all I had to do was go to the Terminal and type:

sudo apt-get install 915resolution

After logging out and back in, my resolution worked. Again if you have troubles or different hardware that link is a good place to start and you may need to follow the additional steps to get your screen resolution working.

The other nice thing is that you can mount your internal hard drive so that you can read (and possibly write) files. This is great when you need to access something from your hard drive and you don’t want to shutdown your computer and restart without the USB.

That’s all for now. Hope this helps.



6 comments so far Add your own

  • 1. Bob Keenan  |  May 22nd, 2008 at 4:36 pm

    A Newbie to Linux here. Wanted to install Kubuntu 8.04 on a USB flash drive.

    Was wondering if you could simply turn off your hard drives in BIOS rather than worry about grub installing on your MBR? Also, can Grub read info from your BIOS and perhaps turn back on your hard drive??

    Why I ask is — I turn my hard drive off in BIOS and VERIFIED that it was so, but when I started an install from a live CD, the 250GB hard drive was mentioned and two partitions of 40 some odd GBs each. Sounds unlikely but there it was!

    Any comments?

    Bob Keenan

  • 2. Pinsky  |  May 23rd, 2008 at 8:59 pm

    Hi Bob,

    I am not sure how to turn off a hard drive from the BIOS. I don’t think my BIOS will do that so I can’t really comment on that. But I have heard of people physically removing their hard drive during the Kubuntu Installation just so they don’t accidentally load GRUB on the hard drive.

    Also I haven’t tried to install Kubuntu from a Live CD, only the alternate install CD. So there could be a difference there or with the new *.04 installation. I have been waiting for the 8gb Jump drive prices to come down a little bit more before I buy one and try the 8.04 installation. I’ll let you know if I come up with something when I try to install it.

  • 3. Bob Keenan  |  May 24th, 2008 at 9:59 am

    Hi again:

    Enter your BIOS, go to the hard drive section and selct the choices to turn them off or on. Various BIOS systems use different terminologies such as “ON/OFF, Available/Not available, Present/Not Present, etc.

    I did a little more investigating and found that with the drive turned off, I could still read all my files and partions in that drive when booting from a Kubuntu 8.04 live DVD. Windows cannot do this.

    Interestingly enough, a second 250 GB hard drive, also turned off, doesn’t show in the list of drives.

    I can see danger in this if Linux can see a turned off hard drive, it likely can access it and damage the MBR if one is not very careful.

    Am running a Dell E520 with an Intel 965G chipset and an Intel RAID BIOS but am not operating a RAID configuration.

    Bob

  • 4. Gazerbeam  |  July 16th, 2008 at 5:39 pm

    I’ve tried this twice, each with the same outcome. this all seems to go fine for me, but then I get an error. I have a photo of the screen, but here’s what it says:

    [!!] Install the base system Unable to install the selected kernel An error was returned while trying to install the kernel into the target system.

    Kernel package: ‘linux-generic’.

    Check /var/log/syslog or see virtual console 4 for the details.

    this happened the first time I tried it, so I reformatted the flash drive (it’s 4 GB) to FAT files system and tried again (tho I know that the installation reformats the drive anyway). any ideas on what could be causing this?

  • 5. Gerard Wassink  |  September 18th, 2008 at 1:35 pm

    Thanks for publishing this. It works for ubuntu version8.04.1 as well. Did an apt-get install kubuntu-desktop also, worked like a charm. Did an install of nvidia drivers for my dual head card geforce 8800 ultra as well, worked fine. Gonna try to boot it on my toshiba Protege R400 next…

  • 6. Gerard Wassink  |  September 27th, 2008 at 11:19 am

    This USB stick also boots perfectly on my Toshiba Portege R400. Recognizes the wifi at once, sound, the works!

    Linux rocks !

Add a comment




Basic HTML tags and/or Markdown are allowed.