HOWTO: Ubuntu Install From USB - Works For Other Linux Too!
Author: SmellyGeekBoy | Date: May 17, 2008
Because of the rise of small ‘netbook’ laptops like the Asus Eee, which don’t come with any kind of CD/DVD drive, it’s quite handy to have good, clear instructions on installing Linux from a USB stick. Even if you do have an optical drive, why bother burning a CD every time? It’s so wasteful.
So I worked out a really easy way to transfer the contents of ther Ubuntu LiveCD to my USB stick and set it bootable, and I thought I’d document the process here in case it can help anyone else.
This method also works with Edubuntu, Kubuntu and Xubuntu, as well as most other Ubuntu-based distros and even some other distributions too (basically, as long as the CD uses isolinux as the bootloader, which 99% of them do). It won’t hurt to give it a try, and I’m happy to help anyone out who wants to give it a go.
These instructions assume that you’re using a Windows machine to prepare the USB flash drive, as there are plenty of guides out there on how to do this from within Linux itself. Also, the latest version of Ubuntu comes with a USB stick creation tool right on the LiveCD, so if you have another machine with a CD drive you can boot into that and give it a go.
-
Preparing the files and USB flash drive
- First up, we need to format the USB stick in Windows - go into My Computer, right-click on the USB drive, and then click Format. When prompted, select FAT32 as the file system. Don’t use NTFS - it won’t work!
- Download and install 7-zip. It’s free and extremely useful, for this and anything else you might need to do with compressed files. It’s also open source, just like Linux, so that has to be a good thing. Get the latest stable version to be on the safe side - not the beta.
- Download Syslinux, which is the bootloader we will be using to make the stick bootable. Just get the latest version in zip format, and extract it to the Desktop - right-click, select 7-zip, then extract to syslinux-7.1.1 (or whatever) and then rename that folder to “syslinux”.
- Open a command prompt (on the Start Menu under Accessories, or run “cmd”) and cd to the syslinux folder:
- cd Desktop/syslinux/win32
- Run this command to install the syslinux bootlader to the thumbdrive:
- syslinux -ma f: (where f: is the letter of your USB thumbstick)
- Now we need to extract the Ubuntu ISO - Right click on the ISO file, and select 7-zip/extract to ubuntu-8.04…
The preparation is done! You should now have syslinux installed on your USB thumb drive, and a folder called Ubuntu-8.04-somethingorother on your Windows desktop. Now it’s time ot create our bootable Ubuntu LiveUSB Stick!
-
Putting it all together
- Drag all of the files you just extracted from the ISO into the empty USB drive.
- Move everything from the isolinux folder into the root of the drive. So, if your USB thumbdrive’s letter is F, as in our earlier example, move all the files from F:\isolinux\ into F:\
- Rename the isolinux.cfg file to syslinux.cfg
- Eject the drive, insert into the computer you wish to install Ubuntu onto, and boot! Shazam!
-
You may need to configure your BIOS to boot from USB, or at least go in there and change the boot order to try external drives first. It’s quite a simple process, but varies depending on your motherboard manufacturer, and so I can’t really go into it here.
Most modern computers will let you press F12 during the very first boot screen to select a temporary boot device - you should only need this once so that could be sufficient.
-
[Update]
This has now been tested with Zenwalk and gOS (see my gOS Gadgets introduction here) and works flawlessly. However, for an even easier method I can highly recommend UNetbootin, which fully automates the process under Linux or Windows. If you are using the method above and running into problems, why not give it a try!
Also, for some reason this doesn’t seem to work with Ubuntu Server. I am looking into it!




I didn’t try the instructions, but I wanted to point out that the BIOS boot menu might not be accessible by pressing F12. I have to press F8 on mine.
It’s F8 on mine too…
Strange. F8 is generally for the Windows boot menu after the BIOS POST stuff, the one that lets you choose Safe Mode etc.
I checked on both my laptops and they’re both F12… They’re running variations on the PhoenixBIOS theme, though. Anyways, there’s a good guide to booting from USB here - section 6 covers BIOS settings according to BIOS manufacturer. If yours doesn’t have a Temporary Boot Device option or you can’t find it, just set it up as per the instructions there.
i have just tried this with the server iso and it hasn’t booted. does it only work with the live cd? please email me at the above address if not i will check back here every now and then. thanks
I only tried it with the Live CD, but I don’t see any reason why it wouldn’t work with the server version - the boot process is exactly the same. Some things to try if it doesn’t work:
- Make sure the hidden file ldlinux.sys appears in the root of the flash drive after you install syslinux.
- Make sure your BIOS is set to boot from USB. Depending on BIOS, you might need to enable legacy USB support, and it may be recognised as a ZIP drive, floppy drive, or HDD.
- Make sure you’re using FAT32 as the file system - also, if your flash drive is over 4GB you might run into problems.
Without any real details on which point in the boot process it’s failing, I can’t really go into any more detail than that.
Great writeup; I have a few questions about setting it up a bit differently.
I would like to install Hardy TO the USB flash drive.I would like to be able to boot the OS with the drive from a couple machines and have it save all of the data. To make it more complicated I would still like the option to install Ubuntu to that computer if I wish. Does the LiveCD version allow you to treat it as a saveable mobile OS while allowing the same easy install wizard? Install wizard capabilities is not mandatory as long as I can just boot the OS from the drive.
Lastly, how could you have the Ubuntu files be loaded from a subfolder so that the root of the drive could still be used for file storage without clutter? I would love for the drive to have a folder called “Ubuntu” and then all my personal files and folders right on the root of the drive (plus the boot files if they MUST be there too.)
This is a pretty interesting question and something I’m interested in, although I’ve never actually tried it.
In theory, the easiest way to install to the drive would be to boot up from the CD as usual, insert the flash drive, and then just select it as the destination during the install process. Although I don’t think this method will let you use the drive as an installer afterwards.
You can even partition the drive during the install process to create a partition for all your data and keep it seperate from the system data. AFAIK it won’t install to a FAT partition however, so it won’t be accessible under Windows.
Here’s a great guide on a ‘persistent’ install, which I think is exactly what you need. Persistence keeps the basic format of the Live CD, but allows your files and settings to be saved for future boots.
You are the man. I have seen that term kicked around but didn’t know what it meant. I didn’t even think about partitioning the flash drive. I think that and the persistent install would be perfect for me. Then I can still store data on it without clutter and use it with ReadyBoost in Vista.
By the way, for viewing and using Linux partitions from Windows (XP or Vista) check out the Ext2 Installable File System for Windows at http://www.fs-driver.org . Works seamlessly just the way you would expect it to.
Alas, it looks like the persistent install won’t let you do system updates. No matter, I still have a LiveCD for installs, I think I’ll just do a full install to the flash drive since I only really want it as an actual OS. The partitioning was a great idea though. Cheers!
No problem
@rickatnight11: Installing a full-blown Ubuntu OS to your flash drive is heavy duty work. It could be done from an actual Live CD, or a different partition on your flash drive. You could try a persistent install, but I’ve had some difficulty with that. Either way though, booting a full Ubuntu OS is heavy wear and tear on your flash drive. I personally use Slax which is optimized for portable use, which I installed from the UNetbootin installer. You can read more about how I did it here.
A much easier way of doing this is to use UNetbootin and install the Ubuntu Live CD, which I wrote about here. Basically, it makes your flash drive behave like a live CD for Ubuntu, from which you can either install to the hard drive or just run Ubuntu. It won’t save your changes, but it will do the same thing as what was described in this article.
If you are looking for a portable Linux OS to put on your flash drive and have changes saved, check out my Linux on a Stick series.
Great howto, would it be possible to do this from within a linux distro ? do not think it would be too much of a problem.
MrG
Yep, it’s easy enough to do. You can use the isostick.sh script - instructions here.
I tried this but when I run the command syslinux -ma h: nothing appears on my thumbdrive, i already formated it to FAT32…Any ideas? :[
There should be a file on there called ldlinux.sys. It’s hidden so you might not see it without enabling Tools / Folder Options / View / Show Hidden Files And Folders in Windows Explorer.
Hope that helps!
I can get everything on the usb drive, but when i try to boot from it, i hit F12 and choose USB Zip and it says it cannot find the boot kernel linux. What do i do?
You got the bootloader installed OK, it just can’t see the files. Did you rename the isolinux.cfg to syslinux.cfg? Are you definitely using FAT32 as opposed to FAT?
If all else fails, you could try my original guide.
USB Zip is not right; a flash drive is USB-HDD.
why can’t it see the files? i am definitely using FAT32 and i changed isolinux.cfg to syslinux.cfg…i really want to try out linux on my computer, and i don’t want to have to use a cd to do so.
This is what happens when I follow your instructions…
NOTE: syslinux is in C:\syslinux
USB drive is j:
C:\syslinux\win32>syslinux -ma j:
Accessing physical drive: Acceso denegado.
Did not successfully update the MBR; continuing…
MBR is the Master Boot Record, sounds like it could be a hardware issue, or maybe the USB drive is “locked” (some of the flash/pen drives have a switch on the side to make them read-only). Otherwise I am stuck for ideas but I will think about it!
Great guide, thanks a lot for the painless noiseless ultra fast installation
Glad it worked for someone. As is usually the case with these things, I only generally hear from people when it goes wrong
hey, thanks for your guide, it worked fine and I booted off the USB stick.
however, when I try to uninstall packages it prompts me for the administrator password, which I never set-up (there was no installation..). I have no idea what this password could be.. I tried leaving it blank and putting in “root” but those didn’t work.
Any help?
Ubuntu comes by default with no root password set. The live CD is a special case, that also has a user automatically log in so you never need to set the default user password. On a normal install you would just type your user password into the prompt that pops up (it’s just a graphical sudo) but since you haven’t touched the user password you don’t know what it is.
It’s actually a fairly interesting problem, and one that you’re not going to be able to fix easily. The easiest way to get a root password set up is to boot another system into linux, then access the USB drive (access it as a drive, not boot from it) From there you could replace the /etc/passwd and /etc/shadow files with files from a computer that has passwords already set up that you know.
everything worked for me following the instructions. Thanks, very cool.
Hi, thanks for this guide, it seems simple enough, but I ran into a problem right away in the beginning.
Running the syslinux -ma H: command gives me the following:
“Reading boot sector: The parameter is incorrect.”
I admit, I’m being mischievious by trying this on my iPod. It just sounds handy to have Ubuntu running on my 80GB iPod as well as having all my music in it to play in my car.
And yes, it’s been formatted as FAT32, yet it still has all the music and files to run the iPod as an MP3 player.
I’d appreciate the help.
Thanks!
- Ehsun
The most likely cause would be because the partition on the iPod doesn’t have a boot sector. A quick Google doesn’t really turn up anything similar to what you’re trying to achieve, except a failed attempt on a Mac a few years back.
So good luck - I’ll be interested to hear how you get on!
Also, is there a way to save files from the Live session onto the USB?
Look at my comments about ‘persistent mode’ above. Another way would be to save them to a seperate partition - not the virtual partition that is created as part of the LiveCD boot process.
hello
this worked perfectly but i now have a problem. my 4gb usb thumb drive shows up as having only 705mb. when i try formatting it again in windows it shows the drive as having only 705mb.
thank you
Thanks man it worked great. You should have ads so i can click for thank you.
Didn’t work for me as the BIOS options in my old laptop don’t allow for booting from a thumb drive. In fact, the BIOS settings have no reference whatsoever to USB devices or support.
I’ll try the DVD and see if it still works and, if not, maybe I can update the BIOS or install from some kind of networked drive.
Why not just use unetbootin? Sucky name, great app!
Works in both Windows and Linux.
Check out step two here:
http://ubuntu-eee.com/index.php5?title=Get_Ubuntu_Eee
Sounds good to me. I wrote this guide a long time ago and thanks to the advent of ‘Netbooks’, without optical drives, a lot of better solutions have popped up in the meantime. So I’m always open to recommendations!
Hopefully I’ll be in the market for a new netbook myself soon as my old Thinkpad struggles with a lot of the things I need it for. I’m liking the look of the Acer Aspire One or the MSI Wind at the minute, but that Dell E looks quite tempting too… The Eee 901 is a really nice little machine as well.
Completely off topic, sorry!
For Ubuntu it’s much easier to use WUBI
As a previous commenter mentioned, you’ll probably want to go the Ubuntu Eee method if you’re buying an Eee PC. unebootin works perfectly, and the Eee v. of Ubuntu (Xubuntu, Kubuntu etc) comes w/ all the drivers and a smaller footprint (fewer apps).
Check UbuntuWeblogs.org, I would be happy to aggregated your Ubuntu category there.
- Tiago
When I use the command “syslinux -ma e:” Nothing happens at all. Any one know why its not working for me? Thanks.
Many, many thanks. I had this rolling in about 10 minutes and I ain’t that saavy.
Cheers
This is just my opinion but you should refine this article and give a bit more instruction. For a good hour or so I couldnt figure out why your directions did not work, and then I decided to try and install 7 zip, and it worked, a simple one liner such as ‘install the 7 zip program’ would have done wonders. I did not see anywhere where it said or hinted at installing that program. After that it was mostly smooth and useful to know all of this. However I recommend that someone else should proofread your instructions so that people who are new to linux or do not use it on a regular basis will understand a little easier. Also your 7-zip link is broken.
Thanks for the heads up. I have fixed the broken link. I think that getting someone else to proofread my instructions would be a good idea - I was following them myself as I wrote them down, but that doesn’t necessarily mean that someone else would understand them!
That said, judging by the comments on here, it has worked OK for a lot of people.
I think there’s a script called isotostick.sh which does all the dirty work for you in just a minute.
Thanks, work perfectly.
But when I boot, the system stop in the shell and I don’t know how I start the installer
If it’s stopping where I think it is, I think you just need to hit enter.
What size of USB thumb drive do you need for this setup? I am currently using Vista, which does not offer disk formatting in anything but NTFS (I hate that part of Vista). Are there any tools out there that will allow me to format the thumb drive in FAT format? (i.e. if I need to redo the steps later).
Thanks for the article.
There is 700MB of data so I recommend at least 1GB, but not over 4GB as some BIOSes have problems getting them to boot properly.
To format USB drives I can highly recommend the HP USB Disk Storage Format Tool. I haven’t actually tried it in Vista but it *should* work.
Since this says that it works for other linux installations (in the title) can anybody tell me how to use this for a suse install?
I tried this with the server version. I gets into the installer, and tries to mount a real CD. There doesn’t seem to be a way around easily. I may try a shell to mount the USB filesystem to /cdrom if I can find it.
I tried, this workin perfectly but im unable to save changes on system. Any1 have idea 2 make this work as USB os rather live USB?
You need to look at my comments above about “persistent” mode!
Hallo everybody,
WARNING !!
mini laptops like ACER ASPIRE ONE, ASUS and so on, just don’t have the power to mount and maintain USB sticks over 1Gb.
These devices are low power devices which means low electricity, so if you have to install something from USB just be sure to use USB not bigger that 1Gb.
Hope this helps !
Have fun !
Ciao
What about being able to have multiple arch’s and then have a boot menu to choose which version of installer to boot.
For example I deal with a mix of i386 systems and AMD64 systems. What if I want to put both installers on the jump drive and have the drive display a menu asking which arch that I wish to install. Then it would kick start the install from the arch’s subfolder.
I don’t think that categorizes as a persistent install but could be wrong. If anyone of you have setup an multi-arch usb install stick I would love to hear your suggestions. If it is documented that’s even better, post the link.
I have never heard of this being done before, however it would simply be a case of having two different kernels set up, pointing to the two different sets of packages. Technically it would be relatively easy, but I couldn’t tell you how to do it off the top of my head. I will have a look into it though.