Archive for the 'Tips' Category

Ubuntu from your flash drive – easier than ever before

As you have probably noticed, new versions have arrived of Ubuntu, Xubuntu and other derivatives. One of the most exciting new features has received far less publicity than it deserves – the ability to “install” it onto your USB flash drive with just a few clicks.

The advantages are obvious: just plug your flash drive into a computer and run your favourite operating system. What’s more, everything you do — installing applications, saving documents, editing preferences — will be saved to your flash drive and will be available to you every time you run it!

The best news is that it’s astoundingly easy: all it takes is a few clicks.

Of course, there are a few requirements. First, you can only run it on computers that support booting from a USB flash drive – this is the case for most computers nowadays. Secondly, you must have a CD or a CD image. The latter can be downloaded free of charge – I, obviously, downloaded Xubuntu. Third, you’ll need to install usb-creator, the new application that is readily available in version 8.10 but which you can also download and install on version 8.04 (with Windows and Qt versions planned). And, last but not least, you’ll obviously need to have a USB flash drive.

Once installed, you can find it in your menu as Create a USB startup disk (on Xubuntu it is located under Applications->System, in Ubuntu this would be System->Administration, IIRC).



The first thing you’ll need to do is to insert the flash drive you’re planning to use. Usb-creator will then detect the drive – if multiple flash drives are inserted, you can pick from a list which one you want to use, and if the drive isn’t formatted yet usb-creator will give you the option to do so (note that this will destroy all files on it!).

The next step is inserting the appropriate CD into your CD drive, or loading the CD image you downloaded before by clicking Other….



Finally, you’ll need to configure whether you want all your documents, settings and applications to be discarded on shutdown (i.e. act as a regular LiveCD) or if you want to save them to your flash drive (this is called persistency, or persistent mode). If you pick the latter, you’ll also be able to select how much space you want to reserve for this.

Do note that usb-creator will not overwrite existing files on the drive – thus, if you want to use your entire drive, you’ll first have to delete all existing files.

Now, with everything configured, click Make Startup Disk, and sit back and relax while usb-creator prepares your flash drive.



You can do something entirely different now, like reading the rest of this blog, viewing all my screenshots of usb-creator, whatever you like. Once usb-creator is finished, it will notify you that it’s done. All that’s left now is to boot your computer from your flash drive and have fun 🙂



Troubleshooting

If persistency does not work, you might need to edit the file text.cfg in the syslinux folder on your flash drive. Just replace the line default livewith the following lines, adding a new Start Xubuntu option to the boot screen the next time you boot. Note that you might want to replace occurences of “Xubuntu” with the name of the distro you’re using. This has been tested with Xubuntu 8.10;

default persistent
label persistent
menu label ^Start Xubuntu
kernel /casper/vmlinuz
append file=/cdrom/preseed/xubuntu.seed boot=casper initrd=/casper/initrd.gz quiet splash persistent
--

Getting help with Xubuntu

Even though I’d very much like to say the opposite, most people will probably need help with Xubuntu at some point. Luckily, it is quite easy to find help – you just need to know where to look.

First of all, you need to determine what kind of problem you are having.

Getting started

If you are new to Xubuntu, you will want to read the excellent Xubuntu documentation, that is also shipped with Xubuntu (in version 8.04 it is located under /usr/share/xubuntu-docs/index.html). It should be your first stop when trying to figure out how to connect to the internet, how to install applications, and similar basic tasks. All this thanks to the huge, voluntary efforts of the Xubuntu Documentation Team (you can also help out with the Xubuntu documentation yourself!).

Of course, if you want to perform slightly more advanced tasks, such as setting up periodical backups on Xubuntu, the internet is your friend. There are a lot of great resources on the internet that can help you with anything from installing Xubuntu on the Eee PC to browsing Windows network shares with Thunar. However, be sure to double-check which version of Xubuntu the guide is written for. For example, the post on browsing Windows network shares I just linked to is, at the time of writing, a little outdated and contains unnecessary steps.

It is also safest to look for articles written specifically targeting Xubuntu – tutorials aiming at Ubuntu users will often work as well, articles targeting just “Linux” are less likely to result in success.

When you can’t find the answer

If you’ve spent time roaming the dark alleys of the internet, spit through every last bit of Xubuntu’s official documentation, but still don’t have an answer, there are a number of support options.

One requirement for all these options is that you specify as much information as possible. This includes, but needn’t be limited to, the fact that you’re running/wanting to run Xubuntu, which version of Xubuntu you’re running, what you’re problem is, what the expected result is, and perhaps how proficient you are with Xubuntu. This allows other people to help you in the best possible way.

The xubuntu-users mailinglist is, well, a mailinglist for Xubuntu users. All messages sent to a certain email address (xubuntu-users@lists.ubuntu.com in the case of xubuntu-users) will be delivered to everybody who has subscribed to that mailinglist. Thus, if you need help with Xubuntu, you can subscribe to that mailinglist, send an email to that address explaining your problem, and perhaps the next time you check your email, the answer is waiting for you.

You might not have the patience to wait for people to respond, however. If that is the case, fear no more, as IRC comes to the rescue! IRC is a way of being able to communicate in real time with other people – in other words, a chatbox. First you need an application to talk IRC – Xchat, DarkIRC, whatever, it shouldn’t really matter. Using your IRC client, you need to connect to a network – FreeNode (on irc.freenode.net) in this case. Once you’re connected to the network, you need to join the appropriate chatroom (how old-school is that?) – the Xubuntu support room (or channel in IRC lingo) is #xubuntu. You can join by typing /join #xubuntu.



Once you’re in – ask away! Be sure to be polite, not to spam the channel, and realize that, if nobody answers, probably nobody knows. Don’t ask the same question over and over again.

It is no secret, however, that the Xubuntu community is not quite the size of the Ubuntu community. Luckily, many people in the Ubuntu community can also help you with your Xubuntu problems if nobody in the Xubuntu community can. The place to get help from the Ubuntu community is the Ubuntu forums. With a very large amount of active members, your question is very likely to find an answer here.

Another place to get help is at Launchpad answers, which is part of Launchpad, a project management website where Ubuntu is managed. Here, you’ll be more likely to find developers, who are most likely to be able to help you.

When there is no answer

Even with this vast range of support options, some problems are just errors in the software – so called bugs. These can be reported at bugs.ubuntu.com, where a developer can look at it and, if you’re lucky, provide a fix for you and other users to enjoy.

Conclusion

Of course, there will still be times when no answer can be found. However, after having read this article, you’ll hopefully be able to better find help yourself. And of course, if you cannot find help, feel free to ask me – I may not be able to provide an answer, but I might be able to give you some pointers.

Design your own desktop with Xfce 4.4 – part 2

By popular demand, I decided to push the limits of Xfce’s customisability even further. This time, I would make it look like Mac OS X 10.5 “Leopard”.



Despite efforts like Mac4Lin, this task proved more difficult than trying to make it look like Windows Vista. Though I haven’t achieved the same degree of perfection as I did when replicating Vista, I still think I came pretty close.

First of all, you will need to download Mac4Lin and extract it somewhere. There’s a lot of material to use in there, but since I have already discussed it in part 1, I won’t elaborate here on how to change your wallpaper, font (to Lucida Grande), GTK theme, icon theme and xfwm4 theme or, for those who use Compiz, Emerald theme. Removing the bottom panel, setting a background image and resizing the top panel have also been discussed. In order to replicate the looks of OS X as close as possible, though, there still is a lot to be done.

Dock

One of the most noticeable things about OS X is its dock. Unfortunately, by default Xubuntu does not include such a dock by default. To have this functionality provided for, we will install Avant Window Navigator (AWN). Luckily, excellent instructions for installing AWN on Ubuntu 7.10 are already available, with the only difference being that we use Xubuntu and thus need to look in Applications->System instead of System->Administration.
Do note that, in order to use AWN, you need to have Compiz installed or have enabled Xfce’s own display compositing by checking “Enable display compositing” under the Compositor tab in Applications->Settings->Window Manager Tweaks.



You can run AWN through Applications->Accessories->Avant Window Navigator. In order to have AWN ran every time you log in, you will also want to add AWN in Applications->Settings->Autostarted Applications.



The next step is making AWN replicate the OS X dock, which can be done through Applications->Settings->Awn Manager. If you click “Themes” on the left-hand side, you will get an overview of installed themes. By clicking “Add” you can install the AWN Dock Theme included in the Mac4Lin package you downloaded earlier, which you can then select and apply.

We then click “General” on the left-hand side to configure the looks in the Bar Appearance tab. I disabled round corners, set an angle of 26°, a height of 52 pixels and an offset of 14 pixels.

With that set, you can start adding applets to the dock by clicking “Applets” on the left-hand side. There are a whole range of applets to choose from, but for my OS X-like setup I opted for “Launcher/Taskmanager”, “Shiny Switcher” and “Stacks Trasher”.



The next step was adding program launchers to the dock (well, technically, to the “Launcher/Taskmanager”). This can be done easily by opening a Thunar window (Applications->Accessories->Thunar File Manager) and browsing to /usr/share/applications. You can then drag applications to the dock to add them. Right-clicking on a launcher allows you to change its icon.

Firefox

Also included in the Mac4Lin package is a Firefox theme, to make the Firefox experience similar to that of Safari. To install this, you open up the Add-ons window in Firefox from Tools->Add-ons, then click “Themes” on top. You can then drag the file FireFox Safari Theme - Vfox2.jar from the Firefox Addons folder into the Add-ons window. Another window pops up allowing you to install the theme. After the installation is finished, you will be asked to restart Firefox. After you have restarted, you can select “Use Theme” through the Add-ons window, after which you have to restart it once again.

To install the extensions, you just select the extension file, copy it (Edit->Copy), then paste it in Firefox’s address bar on top (Edit->Paste). Again, an installation window will pop up, and you will be asked to restart Firefox when the installation has finished. Upon the next start, the extension will be installed.

Cursor theme

An interesting option which we didn’t explore in part 1 was the ability to change cursor themes. Conveniently, the Mac4Lin package also contains a folder named GTK Cursor Theme. Similar to how you installed icon themes, you extract the theme archive to /home/yourusername/.icons.

You can then open Mouse Settings (Applications->Settings->Mouse Settings), where the cursor should be located in the Cursor tab. Selecting the theme will warn you that the theme might not be applied until the next time you login.





Final thoughts

During the process of making my desktop look like OS X, I slowly started to appreciate the approach Apple has taken with its operating system. Instead of replicating the steps of the industry leader, they dare to be different. According to some, this has even led the industry leader to follow in Apple’s footsteps!

Unfortunately, all this innovating does not make creating a lookalike any easier. The most noticeable inaccuracy is in the GTK theme: because of its use of the pixmap engine, button images need to be stretched both horizontally and vertically, so they often look very odd compared to their OS X counterparts. Other themes such as Leopardish also come close, but no cigar.

That said, the result ended up quite nice. When compared to the Vista “clone”, a world of difference can be found. Clearly, an extensive range of customisation options is available to Xfce users, which emphasizes that Xfce really does not lag behind GNOME nor KDE when it comes to customisability.







Those interested in moving application menus to their panel will be interested to know that it is possible, with support for Xfce’s panel. However, this is a very hackish solution and therefore strongly discouraged! As you’ll understand, I take absolutely no responsibility if it happens to end up in a disaster.

Design your own desktop with Xfce 4.4

Xfce is just as customisable as KDE or GNOME, so I set myself a goal: make Xubuntu look like Windows Vista. Why? Because I can. 🙂



Though you won’t be told how to achieve the exact same end result (Microsoft™©® most likely would not appreciate that), this guide provides comprehensive instructions helping you make Xubuntu look the way you want it to. In any case, I would certainly not recommend such a setup for someone new to Xubuntu. Xubuntu is different than Windows; making it look similar is only confusing.

Panels

Since Windows comes with a total of a mere one panel, I had to remove one of Xubuntu’s two default panels. This task was easily done using Xfce’s Panel Manager, which can be opened by right clicking empty space on a panel and selecting Customise Panel, or by opening Applications->Settings->Panel Manager.



Removing the first panel was simply a matter or clicking the - while the target panel was selected in the drop-down menu. Most options in the panel manager are quite straightforward as long as your realize that they apply to the panel currently selected in the drop-down menu. For my setup, I just wanted to change the size of the panel to 30 pixels and set a background image.

Wait… Did I say “background image”? There is no option in the panel manager to set a background image for your panels! Luckily, that other Xubuntu Blog comes to the rescue.
Basically, what we will do is to override the settings of whatever GTK theme you are using to apply a background image to panels. The disadvantage of this method is that this will be applied to all panels.
The first thing you need is, obviously, a background image to use. It can be as much 1 pixel wide, if you like, because it will be tiled throughout the full width of the panel. This image needs to be saved in your home directory (e.g. /home/yourusername/). You can prepend the filename with a dot . to make it a hidden file, e.g. /home/vincent/.panelbackground.png.

Now, to apply this background image, open up a text editor like Mousepad (Applications->Accessories->Mousepad). You then have to open the file .gtkrc-2.0, but since that is a hidden file (starting with a .), it is not listed among the other files. Luckily, in the “Open” dialog, you can just enter .gtkrc-2.0 in the Location field (press Ctrl+L to make it visible if it is not) to open it. More likely than not, it is an empty file.

Now, paste the following into that file, obviously replacing .panelbackground.png with the name of your background image.

style "panel"
{

bg_pixmap[NORMAL] = ".panelbackground.png"
fg[NORMAL] = "white"
}

widget_class "*Panel*" style "panel"
widget "*Panel*" style "panel"
class "*Panel*" style "panel"

Note that the fg[NORMAL] = "white" sets the text colour to white, but you can edit that to whatever (supported) colour you like, or remove the line altogether to use your theme’s default.

And that’s it really! The next time you login, this image will be used as background image for your panel.

Wallpaper

Of course I also wanted to use a wallpaper similar to Vista’s. Setting a background image for my desktop is a breeze, luckily. All that was needed was a click on the “browse” icon next to the File input field to select the image of my preference. If you want to, you can even make a list of files, of which one will be chosen each time you log in 🙂



GTK theme

Next up is changing the GTK theme, which is often one of the most notable changes because it encompasses almost everything on your screen. Download a theme you like (I used Murrina Aero) and open it (with Archive Manager). Select Archive->Extract (or the equivalent option if you use another archive manager than Xubuntu 7.10’s default) and extract it to /home/yourusername/.themes (again, enter .themes in the location field if it’s invisible).

Then open Applications->Settings->User Interface Settings, where your preferred theme should now be listed in the theme list. It will be applied when you select it.



Icon theme

Using icon themes, it is possible to change the commonly used icons. For my Vista-like setup I selected the nuoveXT icon theme.

The process of installing an icon theme is similar to the process of installing a GTK theme. After you have downloaded the theme, you extract it, however, this time you extract them to /home/yourusername/.icons.

Just as when changing your GTK theme, you need Applications->Settings->User Interface Preferences to change the icon theme. This time, however, you switch to the Icon Theme tab (surprise), where you can select the preferred icon theme in the list.

Fonts

Ultimately, I also wanted to use Microsoft’s Segoe UI font. Unfortunately, it can only be obtained together with a copy of Windows Vista.

However, there are plenty of other beautiful fonts available (like Red Hat’s Liberation fonts) that can be installed easily. You just need the TTF files, which you need to place in the .fonts directory. It can then be selected, just as your GTK theme and icon theme, through Applications->Settings->User Interface Preferences. Click the button below Font, where your font should be listed under Family.

Xfwm4 themes

The theming craze isn’t over yet, because you can also theme your window borders. By default, Xubuntu’s Window Manager is xfwm4, which can be themed with xfwm4 themes.

First you need to find an xfwm4 theme you like. Once you downloaded that theme, extract it to the .themes directory in your home folder.

The theme can then be easily applied using Applications->Settings->Window Manager Settings. The theme should show up in the list on the left-hand side, selecting it will apply it.



Emerald themes

If you installed Compiz using Emerald as window manager, then changing window border themes is a little bit different.

First, you need to get yourself an Emerald theme. Emerald themes are files that end in .emerald. I picked the theme included in the Aero-clone pack, aero_blue.emerald. To install the theme, you need to open Applications->Settings->Emerald Theme Manager. Click Import… and open the .emerald file. The theme will be selected when you click it in the list.



Conclusion

Xubuntu (and open source desktops in general) offers an enormous range of options allowing you to tweak the look to your own preferences. You can make it look as ugly or as pretty as you want. Heck, if you want to, you can make it look near pixel-perfect like another operating system!





The end result might not be perfect, but you can get very close 😀



Getting the right image

Update: Using Toad’s very useful comment this post now uses a better method. Thanks Toad!

As noted on the Xubuntu website, there is a most urgent need for testers of Xubuntu’s next release, 7.10, dubbed Gutsy Gibbon. Now, obviously you are eager to help out, so you download Xubuntu’s latest ISO image in order to burn it onto a CD. However, you realize that, when you report a bug in Launchpad, the error might just be caused by an incorrect download. How are you to know that your download completed successfully?

That’s where MD5 comes in. MD5 is an algorithm to convert input to a 32-character text string. When provided the same input, it will always return the same output. What’s more, it can even take a file as argument, including your ISO image!

You get it: if the MD5 sum (the output) of the image you downloaded is the same as the sum of the image on the server, your image is the same as the image on the server, and you know your download was not corrupted 🙂

So how do you get Xubuntu to calculate the MD5 sum of your ISO image? It’s simple, really. First, of course, you need the image itself, so go and download that, save it in a folder of your choice. You also need the MD5SUMS file listed on the same page, so click the MD5SUMS link.



You will see a text file that will look something like this:

d39feb6d64127aac844cf99d788f3b5b *xubuntu-7.10-alternate-amd64.iso
8a6e05a36ff5098ece6e3d28ad3b279a *xubuntu-7.10-alternate-i386.iso
41c7b57b82373d756adf6d90558c2c86 *xubuntu-7.10-desktop-amd64.iso
877ae9aceb9fa5abcc8f8758c3f9f111 *xubuntu-7.10-desktop-i386.iso

As you can guess, this file lists the MD5 sums that are associated with the files listed on the server. Save the file (in Firefox: File->Save Page As) into the same folder you downloaded the ISO image to.

When the download is complete, open Thunar (Applications->Accessories->Thunar File Manager) and browse to the folder you downloaded the image to. Right-click the part of Thunar where the contents of the folder is displayed and select “Open Terminal Here” (yes, you have to work in a terminal window, but it’s not scary or anything). A terminal window opens, in which you have to enter the md5sum command, with the -c argument and instruct it to use the MD5SUMS file. In short, enter this:

md5sum -c MD5SUMS

This will look for each file listed in the MD5SUMS file and, if it is present, calculate the MD5 sum of that file and compare it with the one listed in the file.
The output should be similar to this:

md5sum: xubuntu-7.10-alternate-amd64.iso: No such file or directory
xubuntu-7.10-alternate-amd64.iso: FAILED open or read
md5sum: xubuntu-7.10-alternate-i386.iso: No such file or directory
xubuntu-7.10-alternate-i386.iso: FAILED open or read
md5sum: xubuntu-7.10-desktop-amd64.iso: No such file or directory
xubuntu-7.10-desktop-amd64.iso: FAILED open or read
xubuntu-7.10-desktop-i386.iso: OK
md5sum: WARNING: 3 of 4 listed files could not be read



As you can see, it encounters a few errors about files not found, because, well, it can’t find some files… There are four files listed in the MD5SUMS file, but I only wanted to check the MD5 sum of one: xubuntu-7.10-desktop-i386.iso in my case. And look what it says:

xubuntu-7.10-desktop-i386.iso: OK

My MD5 sum is correct!

However, the image might still get corrupted when burning it onto a CD! Luckily, Xubuntu can check the MD5 sum when you boot the CD, by choosing Check CD for defects in the menu.



It will then “check the integrity” of the CD.



Once it has finished, it will notify you whether errors were found.



If no errors were found both in the downloaded image and burned CD, then you know that any errors encountered are not caused by a corrupt download or an error in burning the CD. Obviously, this means it is a bug and should be reported in Launchpad 😉

(And by the way, thanks for testing 😉 )

Xubuntu Feisty – now from USB drive!

IMPORTANT NOTE: Unless for some specific reason you want to run Xubuntu 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 Xubuntu from your USB flash drive.

In my previous post I showed you how you can run Ubuntu Feisty Fawn from your USB drive, and have it preserve any changes you make. In this post, I’ll show you how to do it with Xubuntu. And of course, as usual, you can also view the screenshots as a slideshow.

Using Xubuntu has a few advantages. The first one is that it is more appropriate for this blog (hence the name Xubuntu blog 😉 ), and that I like it better. The second one is that it is faster than Ubuntu, which is quite handy seeing that running it from a USB drive (or flashdrive, pendrive, memory stick, or whatever you’d like to call it) does bring about a speed decrease. The third advantage is that it takes up considerably less space on your USB drive. About 70 MB matters quite a lot, especially if you’re using a 1GB drive (which is the minimum).

But I hear you thinking: didn’t Ubuntu 6.06 “Dapper Drake” already introduce the possibility of such a “persistent liveUSB session”? Why do we need a specific tutorial for Feisty?
OK, perhaps you didn’t think that. But you would be correct if you were: it is already possible since Dapper. However, some packages in Feisty introduced this bug which prevented this feature from working. To work around this bug, we will use some packages from the previous version, 6.10 “Edgy Eft”, which do not suffer from this bug and which most likely won’t cause you additional problems.

Before we start, I’d first like to thank everyone who has worked and is still working on fixing this bug (more details on the bug page and the forum thread) and especially Mike (mjpca) for providing this teporary workaround. His writeup of the steps he took allowed me to do the same for Xubuntu, also using this great guide from “bibe’s” site. And last but not least, this guide would not have been possible without the detailed How-to from Debuntu on how to install Ubuntu on a USB pendrive.

First off, be sure to realize that this will wipe all existing data on your USB drive. Furthermore, these instructions are geared towards Xubuntu, but they’ll also work on other Linux distributions if you change the instructions a bit (e.g. perhaps you use another program for partitioning). It might also work on Windows (I know “syslinux” is available for Windows) but then the instructions will probably differ a lot so it’s your own responsibility.
You need a USB drive of at least 1GB but as that only leaves about 240MB for any additional programs you’d want to install or documents you want to save, I recommend you to use a USB drive of 2GB or more.

The process of putting Xubuntu on your USB drive is not that difficult. Basically we need to divide your USB drive in several regions (partitioning), one of which will hold the modified Xubuntu and one which will hold all your documents and settings. However, because this will take a while, I suggest you already start downloading the modified Xubuntu image generously hosted by pepeio (I have also created a XubuntUSB torrent, hosted on LinuxTracker. If you know how to, please use that torrent.).

As your partitions need to stay unmounted, I recommend you to turn of “Volume Management” (you can turn it on again after you have finished this tutorial). To do so, open Thunar, click Edit->Preferences, then switch to the “Advanced” tab and make sure “Enable Volume Management” is unchecked.

Then, fire up Gparted (Applications->System->GNOME Partition Editor) and, from the drop-down menu in the top right corner, select your USB drive. Be sure to select the correct one, because if you select your hard drive we will remove all data on that and I suppose you won’t like that. Note down the drive (e.g. mine was /dev/sda) because you will need it later. Delete all partitions on your USB drive if there are any, then click the checkmark to apply. After that, the screen should look like this, without any partitions:
Setting up XubuntUSB - no partitions on my USB drive

Right click the “unallocated” space and select “New” to create a new partition, the one that will hold the modified Xubuntu. Set it to be 760 MB (Gparted calls it MiB) and set the filesystem to “FAT16”.
Setting up XubuntUSB - setting the first partition

Then create the second partition, which can take up all the remaining space. Set the filesystem of this one to “ext2”.

Setting up XubuntUSB - setting the second partition

Now, click the checkmark or select Edit->Apply to apply your changes.

Then, open a terminal window (Applications->Accessories->Terminal). In the following command, replace the “/dev/sdx” with your drive (ine was “/dev/sda”, so that would become “/dev/sda1”). If you want, you can change “xubuntusb”, which will be the label for this partition. Enter this command and press enter:
sudo mkfs.vfat -F 16 -n xubuntusb /dev/sdx1
Again, in the following command, change “/dev/sdx” with your drive. This time, however, you may not change the label “casper-rw”, as it will be used to determine where to save changes to. Enter this command and press enter:
sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2

Setting up XubuntUSB - creating the filesystem of the second partition

Now, make sure you have unmounted both partitions (in Thunar, right click them and select “unmount”), then unplug your USB drive. You can then plug it back in and you should see that it will appear with the new labels in Thunar. If the modified Xubuntu has finished downloading, extract it and copy all the files to the “Xubuntusb” drive. You might get complaints about symbolic links that could not be created, but that is no problem, just select “Yes to all”:
Setting up XubuntUSB - sfailed to create symbolic links, no problem

Copying of the files should take a while (especially the file “filesystem.squashfs”), but when it’s done, there is just one final step you have to do: make sure your computer can boot from the device. In order to do this, you need “syslinux” and “mtools”, so fire up Synaptic (Applications->System->Synaptic Package Manager), mark those for installation and click apply. When they are installed, first unmount both your partitions, then open a terminal window (Applications->Accessories->Terminal) and execute
sudo syslinux -f /dev/sdx1

Setting up XubuntUSB - now allow it to be booted, and we're done!

If everything went allright, you should now be able to run XubuntUSB, congratulations! If it didn’t work for you, see “Troubleshooting” below, if it did, please leave a notice in the comments. Thanks!

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

Another note: For those who don’t like the amount of files on their USB drive, Fisslefink posted a great how-to which guides you to using GRUB instead of Syslinux, so that only two folders will be used. It didn’t work for me, but since he also includes instructions on how to revert back to Syslinux, there is no harm in trying.

Troubleshooting

If you experience any troubles, please first check if your problem is in the following list, and if not, please ask for help in the forum thread.

  • If, upon boot, you get the message no partition active, you have to set it active for boot. Open up a Terminal (Applications->Accessories->Terminal) and type sudo fdisk /dev/sdx (you know, replace sdx with your drive). Press “a” and then “1”. Press “w” to save and then it should work!
  • You might think it is weird that your casper-rw drive shows up on your desktop, and actually, it shouldn’t, but everything still worked as it should with me, so it should not be a problem. Note that you cannot browse it, though.
  • Toad mentions that he could not boot from his USB drive with this tutorial for Ubuntu, 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 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.

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 Debuntu.org.

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
syslinux.cfg.

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

Replace all its contents with the following:

DEFAULT persistent
GFXBOOT bootlogo
GFXBOOT-BACKGROUND 0xB6875A
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 -
LABEL hd
menu label ^Boot from first hard disk
localboot 0x80
append -
DISPLAY isolinux.txt
TIMEOUT 50
PROMPT 1
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.

Troubleshooting

  • 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.

a