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:
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”.
Then create the second partition, which can take up all the remaining space. Set the filesystem of this one to “ext2”.
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
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”:
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
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 typesudo 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.
Where’s the slim version for a 1G USB drive ?
Robi, what do you mean by “slim version”? I’ve removed all language packs except for English to make it a bit smaller, but I don’t think I could’ve decreased the size a lot more (e.g. if I were to have removed Thunderbird or Gaim that would likely have saved only a few MB whereas if they would be installed afterwards they would take in way more space). This one uses 760MB which means on a 1GB drive there should be about 240MB left. It’s not an awful lot, but enough to install quite some applications and create a few documents.
There seem to be plenty of language files left. I’m just looking at the torrent I’m seeding for you and there are all the language files still there in the root directory. Your instructions don’t mention the 1GB USB disk, so you may want to update that and the partitioning.
There’s also plenty of other things that aren’t necessarily needed, but it’s at ones disgression. Pitty one can’t uninstall more after the system is running.
Robi, first of all, thanks for seeding 😀
All the language files you see, are translations of what the boot selection screen. You cannot see the files installed because they are compressed into the file
filesystem.squashfs
.Furthermore, I do mention the 1GB drive, albeit not that explicitly:
I’ll look into mentioning it more explicitly.I have now added that a 1GB drive is possible but that a larger drive is recommended.Could you tell me what you think I ought to update about the partitioning? Even if you use a 1GB drive the process is still the same.
You can also try to build your own image, it’s not that difficult, really, and if you need help you can always contact me or of course ask at the Ubuntu forums.
Oh no problem. From your previous article you made it seem like it’d be tailored for the 1Gb size, so I called you on it. Seeding not at almost 2MB/s, still popular 🙂
Yes, I see that those are the boot languages, they really don’t need to be there either 😛
I’m not in need, I’m just supporting the cause. Keep up the good work.
Robi, sorry for the confusion. And you’re right, I could’ve removed the boot languages. However, they only take up 270.4 kB (I should’ve checked beforehand though).
Hi,
the installation worked for me. But I saw the modified Xubuntu image uses kernel 2.6.17-10. As far as I know, Xubuntu Feisty has 2.6.20.15 kernel. So is this really Feisty?
Mark
Mark, I’m glad to hear it worked for you. Some packages are still at their Edgy versions, and it’s likely that the kernel has been held back too. So at the core, perhaps it’s a bit more Edgy than Feisty. However, it’s got all the new features like the “Restricted Drivers Manager”, and it will still receive Feisty’s updates (except for the packages that have been held back). You’ll also notice (at least I did) that the boot screen differs from the shutdown screen 😉
Hi,
Thanks for the How-to. Was very helpful. I did everything as mentioned in here. But, when I try to boot from the USB stick, I get the following message.
SYSLINUX 3.11 Debian …
Could not find kernel image: linux
boot:
Any ideas.
Thanks,
Mani.
Mani, have you tried
sudo lilo -M /dev/sdx
? If that doesn’t work, well, you could look through the “Troubleshooting” section again, but I’m out of options 😦
Hey Vincent, thanks for leaving a reply on my blog first of all, always nice to get a comment! I read your blog regularly! I never knew there was an effort to get Rockbox going on a ZV:M! I might get involved with the whole project, maybe I could lend a hand!
Finally, if you want to collaborate on an Ubuntu/Xubuntu podcast, let me know, because I have some audio recorded by myself but I could do with a co-host!
Anyway, thanks,
Shane
Hello and thank you for your nice blog.
The installation does not work for me : I can’t write labels.
~$ sudo mkfs.vfat -F 16 -n xubuntusb /dev/sdb1
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat: /dev/sdb1 contains a mounted file system.
and :
~$ sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2
mke2fs 1.40-WIP (14-Nov-2006)
/dev/sdb2 est monté ; ne fera pas un système de fichiers ici !
The second one is in french : it says that “/dev/sdb2 is mounted, and it won’t make a file system there !”.
Do you know what I did wrong ?
Thank you in advance.
Just unmount the device via: umount /dev/sdb before trying to set the label.
regards,
jweck
Same problem as Mani.
I used lilo to update the MBR, that made the USB drive actually boot into syslinux, but syslinux is failing I believe.
SYSLINUX 3.11 Debian …
Could not find kernel image: linux
boot:
Thanks,
Mike
Mani and Mika, a bit of Googling turned up this and this.
They both say something similar,
So I guess you could just try that. Please, if it works, leave another comment here so I can add it to my Troubleshooting section.
Does anyone know if this will work well from a 4 GB drive? I’ve vaguely heard that there is some kind of booting limitation that you run into at 4 GB.
Perhaps there is some kind of BIOS-dependant limitation, and will be specific to individual machines, some having BIOS’ being able to deal with it better than others?
In other words, which probably applies?
-All newish x86 computers have good BIOS’ which can handle this
-Virtually all x86 computers are pooched.
-It’s a complete crap shoot.
Can anyone vouch that if I were to buy a 4 GB USB drive, it would boot just as well as a comparable 2 GB USB drive?
Dustin:
I did indeed get ubuntu (not xubuntu but i’m sure it too) to work with my 4 GB PNY atache flash drive. I ran into a few problems people had already run into in this drive. the fat 16 partition needs to be set as bootable – i think i did this in gparted by selecting it and going to manage flags – then clicking boot, i don’t know if I needed to do sudo lilo -M /dev/sdx but i did, the partitions were annoying because once i’d unmount one, the other would mount so i went to system>preferences>removable drives and media and unchecked mount removable drives when hot plugged/inserted. at boot up i do get a long listing of tty and initramf failures similar to Alexandre Lymberopoulos in the ubuntu guide. but it does load up eventually and i thank vincent and everyone else for their contributions
Although I’m hugely grateful for the work that went into making this all work, I see a big disadvantage to this approach. Everything runs alot slower than it needs to, because all the parts of the Operating System get “gunzipped” as it is accessed (due to the transparent compression).
I would rather have no transparent compression and waste more space on the USB drive. I can buy a 4 GB USB drive now for about $60-80. I don’t see the value in painstakingly trying to cram a system into 1 GB anymore. A “stock installation” of Ubuntu (on a regular, non-USB hard drive) only takes 2.5 GB. This would leave a nice 1.5 GB for /home. Why bother “paring it down” anymore? Similarly, Xubuntu takes only 1.5 GB after a stock installation.
Does anyone know of any ready-to-run-from-USB linux distros that do not use transparent compression? I know of Slax, but that uses the KDE desktop, which is quite bloated and slow. I also know of Puppy, but Icewm is quite ugly and too minimalistic.
I’m hoping there is some equivalent of Slax, but uses the XFCE or Gnome desktop, which are neither too minimalistic/ugly, nor too bloated.
Hmm, I think I might have answered my own question: the Slax “Popcorn Edition” has XFCE. But it doesn’t include OpenOffice (and a bunch of other things I’d want), because it’s intent on squeezing itself into a 128 MB USB drive (again, being too frugal with the USB drive space IMHO). I don’t think it has a nice tool for managing packages either, allowing one to install more software.
quote: “Everything runs alot slower than it needs to, because all the parts of the Operating System get “gunzipped” as it is accessed (due to the transparent compression).”
A “toram” or “copy2ram” boot option would both
1. Increase speed and response and
2. Save limited flash write-cycles
It may well be there already, I don’t know.
Just my 2 pennies.
Hi Vincent,
Nice article !!
It is a pitty that Xubuntu has this bug 🙂
I ( your dad ) am going to put PCLinuxOS 2007 to USB-stick and I hope without any problems with BUG(s)
lol :-))
Pappie
In casper script there is already code for copy to ram/disk
==========
if [ “${TORAM}” ]; then
live_dest=”ram”
elif [ “${TODISK}” ]; then
live_dest=”${TODISK}”
fi
if [ “${live_dest}” ]; then
log_begin_msg “Copying live_media to ${live_dest}”
copy_live_to “${livefs_root}” “${live_dest}”
log_end_msg
fi
==================
but in init they are not propagated from kernel command line boot options.
Could try to add (in init)
====================================
toram)
TORAM=yes
;;
todisk)
TODISK=yes
;;
==================================
bye
Mike,
Your problem is caused by wrong configuration of syslinux.cfg !!
Replace all the word linux in your syslinux.cfg with what ever name your distro uses ( e.g.vmlinuz for X/K/ubuntu ).
Good luck,
Rob Tunru
how can i install syslinux and mtools?
i download files from windows because my wireless adapter isnt supported (philips-snu6500 searching..)
i searched google (syslinux) but its confusing for me (compiling and so..)
i always find source files tar.gz
is there an easier way to do this.
i found them..
Syslinux .deb install package link
http://packages.ubuntu.com/cgi-bin/download.pl?arch=i386&file=pool%2Fmain%2Fs%2Fsyslinux%2Fsyslinux_3.11-3ubuntu2_i386.deb&md5sum=c0b9871dec44202d3052e816be2ba37c&arch=i386&type=main
Mtools .deb instal package link
http://packages.ubuntu.com/cgi-bin/download.pl?arch=i386&file=pool%2Fmain%2Fm%2Fmtools%2Fmtools_3.9.9-2.1ubuntu1_i386.deb&md5sum=08d7355821bc33226dd4c416d5b9546f&arch=i386&type=main
for x86
i will try now
its for dapper version but i think there will bw np. 😀
Keep it up! Nice Blog
It seems to have been solved for Gutsy… 😉
Kerem, yes, you can download it from packages.ubuntu.com , but the fact that they’re there means that they are also available through Synaptic, as I said in this post:
I now have PClinuxOS persistant on my USB-stick and even my wireless is working out of the box and I can start the SSH server. Furthermore I can login as root and change my password persistently.
Added applications and they are still there !!.
Remember: whatever distro you have chosen, you should NOT implement persistency on FAT16/FAT32 partion but use ext2 or the like.
Having the root partition set to 760Mb did not cut it for me, the mentioned “modified ubuntu” needs about 830Mb on the /dev/sdx1
Filesystem Size Used Avail Use% Mounted on
/dev/sdc2 2.9G 4.4M 2.7G 1% /media/casper-rw
/dev/sdc1 958M 827M 131M 87% /media/xubuntusb
used the link: CustomFeisty-desktop-i386-II.iso
tip, if u have space in the disk make it larger!.
greets.,
Kees
kaycee, CustomFeisty-desktop-i386-II.iso is the file required to put Ubuntu on your USB drive, for which you would have to follow these instructions that do tell you to use more space. You would have to use the Xubuntu version, xubuntusb.tar.bz2, with this guide.
Hi,
I am a newbee but have managed to load up ubuntu onto my 1Gb USB- But when the grub boots up I choose USB and it says “Could not find kernel image: vmlinuz”
I have checked the file exists and it is in the /install folder.
Can anybody help as I feel close to getting this to run…
Thanks
Slimesub5, you have an entry for your USB drive in Grub? That’s odd. When I want to boot from USB I have to select it in the BIOS (at the beginning, when I have just turned on the computer, it says “Press F11 for boot menu”). Never in Grub.
Also, are you sure you used Feisty? I tried putting Gutsy on my USB drive and then I did get that error.
Does anyone know how this might be accomplished from a windows xp machine?
D-Train!, in theory you could do the same from a WinXP machine by using another partitioning application and by installing syslinux for Windows. However, you could also try to burn a Xubuntu LiveCD and do this from there.
Yooo!
Big thanks from frenchy user, me, after days and days trying lot’s of tuto, without lucky way…
I can use now my old desktop where HD and dvd drive are out !
You known, without manga more than 2 days, I became crazy !
So, simply thanks Vincent for your modified xubuntu source !
yoshhh!
TiScarabee, great that it worked for you, I’m really happy to hear it, thanks! 🙂
I also a newbee and have managed running xubuntu on my 2Gb USB..(used 1.2 GB). I installed Xubuntu just like normaly intalling to hardisk. Next i modified fstab (…delete every thing except proc & usb related) , grub menu.lst. Then i strip down xubuntu using deborphan localepurge synaptic… So i got portable Xubuntu, works on any computer with USB boot able.
Hi,
Thanks for the How-to. I did everything as mentioned in here. But, when I try to boot from the USB stick, I get the following message.
SYSLINUX 3.11 Debian …
wrong keyword in syslinux.cfg
Could not find kernel image: linux
boot:
any suggestions?
I also tried everything mentioned in troubleshooting and all suggestions in comments and still it is not working.
After I tried everything I’m getting the message: can not find kernel image or wrong kernel image, can not find kernel image linux etc…
hello..
does this installation guide would apply on a portable external hard disk (rotating plate)?????
mai, if you connect the external harddisk you can just install Xubuntu on it the normal way (be sure to select it in the installation dialog).
Hi,
Thank you very much for your help on setting up the Usb Boot. The usb drive boots fine on my VIA MINI-ITX board but the problem i am having is when i make changes to the Xubunu it doesnt seem to be saved. Also, when i shutdown the Xubuntu, the shutdown progress bar gets very close to shutdown but yet it freezes. I was wondering if you can give me hints to solve this. When i partition at the begining must i make it RW so that i can make changes to the OS. Please let me know
Regards,
Hi Vincent,
Thanks for you very much for all your hints on setting up the xubuntu on a USB drive. I have just have one question for you. At this point i am working with a VIA mini-itx board that i will use to control a robot. I was hoping to use a usb drive that boots xubuntu. At this point i am able to boot fine but it seems that after i make changes to the os, like install a new tool or such, and then reboot i loose everything i last changed. Everytime, i have to do it all over again. I understand the casper-rw is used for that purpose but it seems to not be working for me. I am sure there is probably a simple solution to this. I was wondering if you can please help me out.
Thanks,
Mussie
Mussie, I really, really need to get working on an updated guide for 8.04 sometime soon. I think the best thing for you to do is wait for that to appear.
Best, Vincent
i am looking for drivers of my pen drive;Thinking xtra nano 2GB pls,tanks
michele
ciao
Hi Michele, you don’t need drivers for a pen drive, if it’s USB it should just be recognised.
New guide
http://www.pendrivelinux.com/2008/05/21/usb-xubuntu-804-persistent-install-from-live-cd/
http://www.pendrivelinux.com/2008/05/21/usb-xubuntu-804-persistent-install-from-linux/
Hello,
i have some questions,
is this for window users?
i’m just looking for a guide of, making a Portable Xubuntu to use on microsoft windows!
Thank you very much!
RAIDENSUB, I’ve created an updated guide myself that is significantly easier.
Parker, this tutorial is meant for users of Xubuntu, though you should be able to do this on Windows. However, this tutorial is now outdated. However, you should be able to create a portable Xubuntu on Windows using Fedora’s tool: https://fedorahosted.org/liveusb-creator/
I haven’t tried that myself, though.