Archive for June, 2007

Ubuntu Feisty on your USB drive – finally!

IMPORTANT NOTE: Unless for some specific reason you want to run Ubuntu version 7.04 specifically from your USB Drive, this tutorial is deprecated. I’ve written an updated and much easier tutorial on how to run the latest version of Ubuntu from your USB flash drive.

Important: As SurJector mentions, he has found another workaround that is much less work. After you have followed his instructions, you can skip on to the partitioning part (i.e. that part that is very similar to almost my whole post about putting Xubuntu on your USB drive).

Update: I now also have a guide on putting Xubuntu Feisty on your USB drive.

Note: All screenshots are also available as a slideshow.

When, in June 2006, Ubuntu Dapper Drake was released, it introduced a very exciting new feature: the ability to run it from a USB drive (also pendrive, USB bar or memory stick). This would work just like a LiveCD, with the big improvement that all your data could be saved onto the USB drive! This means not just your documents, but also e.g. network settings or your desktop background. You were practically carrying around a fully-functional operating system on your USB drive!

However, as Ubuntu 7.04 “Feisty Fawn” contained some new packages, it also introduced a bug due to which your data would no longer be saved. When it was released, this bug still wasn’t fixed. It is expected to be fixed in the next release, 7.10 “Gutsy Gibbon”, to be released in October of this year. Up until then, we’re out of luck.

You’d think. However, thanks to the hard work of Mike (mjpca on the Ubuntu Forums) and some others (see the bug report on Launchpad and the thread on the Ubuntu Forums) there is now a way to work around this bug, which I’m going to show you in this post.

The basic idea is that the files that prevent persistence (the ability to save your data to the USB drive) from working can be replaced by their previous versions as present in Ubuntu 6.10 “Edgy Eft”. However, because files on the LiveCD are compressed so they can fit on one CD, replacing these files requires quite some effors. Luckily, Mike has done all the hard work for you and has created a new hybrid Edgy/Feisty image. To use it, your computer needs to be of the type Intel x86. Don’t worry, if you don’t know what this is, you probably use it. Furthermore, I recommend you use a USB drive of at least 2 GB, because the image is quite large.
For those with 1GB USB drives or who prefer Xubuntu (which would be me ;)) I plan on creating a Xubuntu image, but I’m not quite sure if I’m able to. If it works out, of course I’ll post on this blog.

Note: This tutorial is adapted from this How-to from

To start, fire up Gparted from Applications->System->GNOME Partition Editor (note: for those that do not use Xubuntu, you’ll have to find the applications yourself). On the top, right-hand side, you can select which drive you want to partition — select your USB drive. Be careful not to select any other drive, because you will be erasing all data that is available on that drive! You first have to delete all existing partitions, which will erase all existing data. Note down or remember the name of your drive, because you’ll need it later. Mine is /dev/sda

Preparing my USB drive for persistence - clear partitions

We then create the first partition, which will contain Ubuntu. Set its size to 840 MB (which is the same as MiB), its filesystem to FAT16 and leave the rest as is.

Preparing my USB drive for persistence - creating main partition

We will then create the second partition, which will hold all of our data. Just let it take all of the remaining space and set the filesystem to ext2.

Preparing my USB drive for persistence - creating casper-rw partition

Make sure that every partition is unmounted. If a partition is not, right-click it and select unmount.

Preparing my USB drive for persistence - make sure they are unmounted

You then see an overview of how the drive will be partitioned — click the checkmark or select Edit->Apply to apply your actions.

Preparing my USB drive for persistence

It will ask you if you are sure, because it will erase all your data. If you’re fine with that, select Apply.

Preparing my USB drive for persistence - continue?

You’ll then have to wait a little while Gparted applies the operations. When it’s finished, you can close Gparted.

Preparing my USB drive for persistence - creating partitions...

Now you need to format each partition and give it a label. The name of the first partition, which holds Ubuntu, does not matter that much, however, the partition that needs to hold your data needs to be named casper-rw.

To partition and label the first partition, run the following command, in which you replace /dev/sdx with the name of your drive (Remember? Mine was /dev/sda). Note that I named it UbuntUSB (how original) but if you want, you can just use another name:
$ sudo mkfs.vfat -F 16 -n UbuntUSB /dev/sdx1
This won’t take long. For the second partition, you run this command, again, replacing /dev/sdx with the name of your drive (but keep the name casper-rw!):
$ sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2
This will take a bit longer, and will also output more.

Preparing my USB drive for persistence - setting labels

And here comes the fun part. You need to download the image that Mike created (generously hosted by pepeio. Use the second ISO he created). After it has finished downloading (can take quite a while) you need to extract the .iso file using Xarchiver. I recommend you to save it to a folder in /tmp so that it will be deleted on shutdown, because you don’t need it after you’re finished. I saved it to /tmp/ubuntu-livecd. Make sure you check “Extract files with full path”.

Extracting the .iso

Now you need to copy some files (which contain Ubuntu) to your USB drive, onto the first partition (which I named UbuntUSB). First copy the folders casper, disctree, dists, install, pics, pool, preseed and .disk (to see this one, select View->Show Hidden Files). Then we need the files md5sum.txt, README.diskdefines and ubuntu.ico. Then move to the folder “isolinux” in the extracted folder (so for me, that would be /tmp/ubuntu-livecd/isolinux), but do not change your location in the USB drive. Copy all the files that are present in the isolinux folder to your USB drive. Then, move into the “casper” folder in the extracted folder (/tmp/ubuntu-livecd/casper) and copy vmlinuz and initrd.gz to your USB drive. Finally, move into the “install” folder in the extracted folder (/tmp/ubuntu-liveusb/install) and copy mt86plus to your USB drive.

Preparing my USB drive for persistence - copying required files

Now, on your USB drive, rename the file isolinux.cfg to

Preparing my USB drive for persistence - rename isolinux.cfg to syslinux.cfg

Replace all its contents with the following:

DEFAULT persistent
GFXBOOT bootlogo
APPEND file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL persistent
menu label ^Start Ubuntu in persistent mode
kernel vmlinuz
append file=preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL live
menu label ^Start or install Ubuntu
kernel vmlinuz
append file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL xforcevesa
menu label Start Ubuntu in safe ^graphics mode
kernel vmlinuz
append file=preseed/ubuntu.seed boot=casper xforcevesa initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL check
menu label ^Check CD for defects
kernel vmlinuz
append boot=casper integrity-check initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL memtest
menu label ^Memory test
kernel mt86plus
append -
menu label ^Boot from first hard disk
localboot 0x80
append -
DISPLAY isolinux.txt
F1 f1.txt
F2 f2.txt
F3 f3.txt
F4 f4.txt
F5 f5.txt
F6 f6.txt
F7 f7.txt
F8 f8.txt
F9 f9.txt
F0 f10.txt

Save that and close. For our last step, we need the packages syslinux and mtools, so fire up Synaptic (Applications->System->Synaptic Package Manager) and install them. Make sure that your USB drive is unmounted, then go into a terminal (Applications->Accessories->Terminal) and enter the following command, replacing /dev/sdx with the name of your drive:
$ sudo syslinux -f /dev/sdx1

Preparing my USB drive for persistence - making my USB drive bootable

Well, all that is left now is to test it, so boot from your USB drive, and then you’ll (if everything went right) be greeted with a screen like the one I was greeted with:

My Ubuntu Feisty Desktop from my USB drive

If this tutorial worked for you, please leave a reply in the comments here. If it didn’t work, you can also leave a comment, or rather (if you have an account) post a message in the Ubuntu forums thread, so we can find a way to fix it.

Note: If you want to create a new user, be sure to grant administrator rights, otherwise it may cause errors.


  • Toad mentions that he could not boot from his USB drive, but he fixed it:

    I finally got the computer to boot from the USB stick. I had to set the fat16 partition to bootable. ‘cfdisk /dev/sdx’ should do the trick, just press enter on the set bootable option.

  • If this worked, but after a while it doesn’t anymore, you can remove any edits you did to restore it to the point where it worked (all your settings will be lost though):
    $ sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2
    (Thank zenobiaflex for this one)
  • If you want more than the two partitions described here on your disk, be sure that the first partition needs to be the FAT16 partition, as that’s where the bootloader gets loaded which needs to be on the first partition. Thanks Matt.
  • If your drive won’t boot correctly, your Master Boot Record may be corrupted. You can repair it with Lilo (so open up Synaptic from Applications->System->Synaptic Package Manager and install the package lilo) using the following command from the terminal:
    $ sudo lilo -M /dev/sdx
    (From PiterP)
  • If, during shutdown, the screen switches from the shutdown screen with the Xubuntu logo with the progress bar to a black screen, possibly with error messages, then you computer is probably just shutting down the normal way without notifying you of its status. At a certain moment (not too long after the screen turned black) it will have reached the point where it would have normally said something like “remove the disk, close the tray (if any) and press enter”. So when the screen turns black, you just have to try to press enter a little while after it has turned black.

Controlling your media player

In my previous post, I promised I’d show how to control your media player to skip to the next song when you press a combination of keys. Admittedly, I should’ve posted this earlier (especially since it’s not that big a post), but better late than never, isn’t it?

The basic idea is that you can run a command with so-called arguments. Most (if not all) media players on Linux also take arguments to skip to the previous or next song in your playlist, or to play/pause the current track. This is extremely useful if you just want to listen to music without the program you use to play it bothering you.

You know how to find the command of your media player (I explained it in Your wish is Xubuntu’s command). My media player is Exaile, the command of which is “exaile”. This is what I’ll be using in this post, but you can replace it by the command of your preferred media player.

To find out which arguments a program takes, you have to resort to a terminal window (Applications->Accessories->Terminal). From there, you can read a program’s manual by typing man <command>, so I’d use man exaile:
Exaile's man page
You can read through it by using the arrow keys and exit the manual by pressing “q” (so “Esc” won’t work!).

Some programs don’t have a manual, but if they don’t, they mostly take the --help argument, which gives you an overview of all other arguments available. I’d use exaile --help:
exaile --help

As you see, Exaile supports both of these commands. It doesn’t really matter which I use, both tell me I can skip to the next song with the --next argument (or -n), to the previous one with --prev (or -p), and play/pause (depending on its current state) with --play-pause (or -t, from toggle).

Knowing that, I opened up the Keyboard Settings (Applications->Settings->Keyboard Settings) and in the Shortcuts-tab I set the commands exaile --prev, exaile --play-pause and exaile --next to some keyboard shortcuts. I could then control Exaile using my keyboard! Now, every time I start Exaile I minimize it to the system tray so that it would just be an icon in my panel. Using the “LibNotify Plugin” I get a notification which song I skip to, making my media player as unobtrusive as possible:

Xubuntu Feisty just installed - Cool, integration!

Customisations like this are the reason I love using Xubuntu – it adapts to you instead of the other way around. It are these little things that makes using a computer just that extra bit more pleasant.