Sponsored Link

I was reading How to install Ubuntu Linux from USB Stick posted on this site a while ago, and found it to be quite some work to get Ubuntu working on a USB stick. Besides, having to prepare your USB device, creating a separate partition on it which will be more or less "useless" after the installation, giving up 750MB of space?

There had to be a better way.

Together with a colleague of mine, I decided to figure out whether there could be an easier way to install Ubuntu on a USB device.

I found a way of doing it in a much simpler way... without creating the separate partition to store the LiveCD:

A couple of assumptions to take into account when going through this manual:

(I didn't take screenshots, so I will be explaining a lot about the screens... It looks like a lot of work, but trust me: it is not, and it really is easy:-)

Insert the LiveCD into your computer;

Connect your USB device;

Boot your computer from the liveCD;

Once Ubuntu is started, go to System -- Administration -- Partition Manager
This will open the Partion Editor. Select your USB device and delete all partitions on it. Click Apply and exit Partition Editor;

Double Click the Install Icon. This will start the Installer;

The Welcome Screen is shown. Choose your language and click Forward;

Select your Time Zone and click Forward;

Choose your Keyboard Layout and click Forward;

The partitioner will be started, and you will be given the choice where to install Ubuntu. Choose Guided -- Use entire disk, selecting your USB device (this will most likely be /dev/sdb, don't choose /dev/sdb1!);

The next sceen you will give your username/password information. Provide the required info and hit Forward;

If there is anything to migrate from other installations on your computer (most likely not), do whatever you want, and click Forward;

The next screen is important -- It is titled: "Ready to Install". Be careful here: before clicking on Forward, make sure you click on the "Advanced" Button!This will open a new screen, giving you the option whether and where to install the bootloader. Select your USB device (in my case it was /dev/sdb) to install the bootloader to;
Exit this screen and click on Forward in the "Ready to Install" screen, which will be shown;

The installation will be started now. Just be patient, grab a cup of coffee and come back 15 minutes later, your installation will be more or less finished by then.

So you have finished the installation. However, when you will be restarting your system from USB, you will find out that the partition you just installed Ubuntu to cannot be mounted.
Here comes the trick:

Once the installation is finished, reboot your PC (this is the safest) from your LiveCD, with your USB device connected;

Once started, open up a terminal (Applications -- Accessories -- Terminal);

In the Terminal, type: sudo -i (which will give you root privileges, so be careful from now on!);

Change directories to /media/disk/boot/grub -- This will take you to the "/boot/grub" directory on the USB device;

open menu.lst with vi (make a backup first!)

Go to line 130 (or somewhere in that area).
You will find a line looking like:
## ## End Default options ##
And underneath it you will find three entries pointing to your Ubuntu you just installed:
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd1,0)
kernel /boot/vmlinuz.........
initrd /boot/initrd.......
quiet
(the above 5 lines repeat 3 times with slight differences)

The magic trick is to change (hd1,0) into (hd0,0) for all these three entries.Why? Booting from USB device makes your USB device hd0, in stead of hd1 at time of installation.

Search for the line starting with "# groot=(hd1,0)" and change (hd1,0) to (hd0,0) -- Don't delete the # at te beginning of this line!

Once you did this, you can optionally remove the remaining of the file
(everything underneath ### END DEBIAN AUTOMATIC KERNELS LIST);

Save the file, make sure it is owned by root:ubuntu (chgrp ubuntu menu.* will do)

Edit device.map (in the same directory) and change the mapping of hd0 to /dev/sdb.

Reboot your machine, from USB, choose the Ubuntu installation from the Boot Loader and you are one happy person.

It works well as a stand alone Ubuntu desktop , however it is best to slim it down using either Gnome or KDE Desktop to save unecessary download updates. When Using the Ubuntu live CD ISO installer, mine was 8.04, do not tick any boxes for the transfer of other drives settings/ documents, it will then be independent of any computer system. It will update or upgrade as normal Ubuntu desktop albeit of course a little slower than a the normal hard drive installation.” To ease wear on the USB key in Terminal and avoid unnecessary writes ,edit the your /etc/fstab file , sudo gedit /etc/fstab edit the swap file by deleting it and type in the following :
tmpfs /tmp tmpfs nosuid,nodev 0 0″
Make a backup copy of the original fstab first to remind you what was there to begin with!
“tmpfs , otherwise known as as a RAM disc , should if you have enough RAM be able to do without swap entirely,which neatly sidesteps this problem .” Thanks to Linux Format Jan 09 page 42 for this helpful tweak to installing USB.
As an UBIE, it works out of the box, if you reduce the screen
resolution to the minimum then it loads on laptops no problems.
You may need to tweak your BIOS to allow a USB drive to boot.If you have problems with a particular PC, Google that OEM to see how other users have produced a work round for your PC.
I’m taking my Ubuntu USB with all systems go, to Santiago,Falkland Islands, New Zealand and Singapore for 6weeks. it will be a breeze to send anything via the net with this system!

Thank you Arnoud Roth, brilliant, I have tried 6 or 7 Distros but the permanent file partition did not always work and often crashed and had left creating USB distro for three months. This one works, it is a slimmed version of the hard CD drive ISO, using synaptic Package Manager to permanently remove unwanted packages. Regards Bill Cressey

Just to let you know I used these instructions to install eeebuntu (NBR) on a usb hard drive attached to an Aspire One. It just worked, straight out of the box. Didn’t even need the magic tricks from steps 7 to 12 at the end. I’ve changed the boot order to boot off the USB disk first. So now, if I have the USB disk plugged in, it gives me a menu to boot either eeebuntu or the standard linpus; if I don’t have it plugged in, it just boots normally. Great!

Same as martin benson, i installed easy peasy (eeebuntu) on a packerd bell easynote PB47R01086. Its based on ubuntu 8.10 (other than what was used in this tutorial) and doesnt use the root reference. It just has a UUID=r2329jf92-4f42f-g35gr-34tg5-4g4324ffdg name for the harddisk.

Dude! you are a freakin genius. I’ve been trying to figure this out for two days. I’ve tried evrybody on the internets hairbrained ideas. I knew I just needed to edit the grub config files. I just couldnt figure out exactly how. Now I can run Ubuntu 9.04 on my work laptop and bypass all their encryption, monitoring and protection bs, without changing one bit on the hard drive. Thanks

well tried on 2 keys a 16Gb and a 4Gb kinsgston traveller , 16G crashes in the setup (same on 2 diff keys of the same 16Gb model ) but is flawless on the 4Gb , not even a grub mod needed , setup was done with jaunty and intrepid

I installed Kubuntu Jaunty yesterday on a 320GB USB HD. In accordance with suggestions from other guides found on-line, before starting I physically removed the internal HD, in order not to risk anything on the existing Windows XP (that I can’t touch).

I just followed the normal installation steps as per your guide but in step 9 I deviated from your suggestion and selected manual partition (the disk was seen as /dev/sda). I partitioned in the following way:

This tutorial looks good, but it is not working for me, there’s no menu.lst file in the /grub/boot directory. Actually there’s no file menu.* there. Possibly because of this, the disk I formatted following this tutorial failed to boot.

Another thing I note is that line 11 on the second part will only work if there’s a single hdd beyond the usb disk.

Thanks! I have been searching for this information all day now. My computer is not running like it should and I need to figure out how to fix it quickly. I have bookmarked your post so others can find it to on reddit.

My internal hdd has been spoilt, and before I get new one I decided to install my ubuntu 9.10 on my toshiba 400gb external usb hdd. So, i have many information on that and diceded to make one additional ext4 partition and one swap partition(also there is main ntfs part of hdd). I have installed ubuntu like you are saying with one exception, I did it on the second free partition with ext4 file system. After rebooting it does not loads, while bios supports usb booting. so I am following next steps until i need to open menu.lst file and there is a problem, there is no such file at all. not in the cd and not on the hdd. what should I do? I am looking for solution for several days and nothing helps. please sugest something that might work?

If it has any minning(i do not know exactly) I have AMD triple-core proccesor.

I successfully installed Ubuntu 9.10 to my usb flash drive cd without changing anything afterwards by disconnecting my hard disk drive before booting from the live cd and starting the installation. I did manually made partitions in different sizes for boot, root, swap and home because my usb flash drive isn’t very large (16 GB). After the installation finished I just reconnected my HD drive. But, of course if you don’t want or can’t open/close your computer’s case and manually handle HD connections, this an excellent and simple tutorial.

The new versions of ubuntu uses the new GRUB2. you will not find menu.lst. GRUB2 changed everything around. i tried many fixes on the internet and none of them worked for my usb hdd..Tho..Pclinuxos worked the first time..go figure…Perhaps it can be added to the install progams so the installer will know its a usb hdd and configure it correctly…time will tell..very good info in usb hdd installs..works on older versions..thanks..

The author of this article doesnt understand squashfs and that the startdisk maker USB is far more efficient than what is otherwise known as a full-install. THe author doesnt understand that full installs also limit the USB to that particular machine and its hardware, and is not designed to load anywhere on any machine. dont do full installs on USB. He doesnt understand theres reasons for the other method and its 4 GB persistence.

“…is not designed to load anywhere on any machine…”
I have never seen an ubuntu system fail to boot to a fully working system after moving it from one machine to another. Perhaps I’m just lucky in that respect. I have however seen how much longer a “persistant live CD” usb install takes to boot.

Thanks but I’ll risk the problems you describe. I promise not to cry if it breaks and I have to pull out my spare “persistant live CD” version I also have.

I am new to Linux and have tried various version over the years, starting with Red Hat about 10 years ago, but never bothered with it until now.

As someone who just wants a system that works without the use the terminal I am finding Ubuntu 12.04 excellent and I could not have done it without this easy to follow guide. My thanks to the author!

While Safron does have a point about a full installation limiting it to the particular machine, many might not mind that limitation. I am one! However, for those who want a portable Linux system, I guess a bootable CD is the way to go, but I have found them too limited.
Thanks again for this guide…EXCELLENT!
Regards,
Jim

I tried this and could not find menu.lst or the device file…
My friend has a russian windows computer and we need an alternate boot in english.
The persistent live usb runns very slow with added software.
We have a 32 bit emty live usb for other machines.

On install..I chose ..other.. and did it on a kingston pre.partitioned 16gb. all reiser 3 parts… / home and swap mt pts.
I got a blank screen on boot…it takes 1.5 hrs to make.
The 2nd time ..I did ext 4 for / mount pt.
I put the boot on sd1 instaed of kingston choice …as I did on first try.
got a grub repair prompt with a no file sys.

If I do this more times..I.m bound to mess up my friend.s win7..

Nice idea about phys removing the internal hdd..but I have a laptop.

Am I dreaming that it will boot faster this way.?
Why cant ubuntu have the booter and stuff for the live usb integrated..seems easy on paper

ps…terminals are not fun.
I type sudo su
nautalis
Then I can search and edit my files..if they existed.
I tried editing grub.cfg..but to no avail.

If you can help…I.d appreciate it.
I would like this article to be updated for 12.04

Someone posted about an atom…Pls make sure you have the bits 32 64 version to match your processor.