
In the first place we need to mount our ubuntu iso. Depending if you have the .iso file or the CD, there is 2 different ways of mounting it.
People using Ubuntu or any other user-friendly distro, might just have to insert the cd and it will be mounted automatically. If this is not the case:
$ sudo mount /media/cdrom
should mount it.
We will need to create a temporary directory, let say /tmp/ubuntu-livecd and then mount our iso (I will be using a feisty fawn iso).
$ mkdir /tmp/ubuntu-livecd
$ sudo mount -o loop /path/to/feisty-desktop-i386.iso /tmp/ubuntu-livecd
Once the cd image is ready, it is time to mount the newly created usb bar partitions:
Same here, you might be able to get both your partition by simply replugging the usb pendrive, partition might appears as: /media/liveusb and /media/casper-rw. If this is not the case, then you will need to mount them manually:
$ mkdir /tmp/liveusb
$ sudo mount /dev/sdb1 /tmp/liveusb
All the partitions we need are now mounted, let's copy the files.
Let positionned yourself on the CD image directory (in my case: /tmp/ubuntu-livecd , but it might be /media/cdrom , and copy at the root of your usb first partition:
$ cd /tmp/ubuntu-livecd
$ sudo cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /tmp/liveusb/
It might complain about symbolic links not being able to create, you can ignore this.
Now let's go to the first partition of your usb disk and rename isolinux.cfg to syslinux.cfg:
$ cd /tmp/liveusb
$ sudo mv isolinux.cfg syslinux.cfg
change /tmp/liveusb according to your settings
Edit syslinux.cfg so it looks like:
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 300 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
Woof, finally we have our usb disk almost usuable. We have a last thing to do: make the usb bootable.
in order to make our usb disk bootable, we need to install syslinux and mtools:
$ sudo apt-get install syslinux mtools
And finally unmount /dev/sdb1 and make it bootable:
$ cd
$ sudo umount /tmp/liveusb
$ sudo syslinux -f /dev/sdb1
Here we are :D , reboot, set your BIOS to boot from the usb bar and enjoy Ubuntu linux from a pendrive
If you are having trouble booting on the usb bar, this might be due to your MBR being corrupted. In order to fix it up, you can use lilo (I installed lilo on my box only for thid purpose).
$ lilo -M /dev/sdb
will fix the MBR on device /dev/sdb








Hardy Heron ??
I tried to do this.
I followed the instructions with ONE exception.
I set the boot preferences in the BIOS to "removable"
Rebooted and no bootable removable was detected so it took me to GRUB and a normal boot from my hard drive.
The one exception was that the folder "disctree" was not on the CD. I suspect that and maybe some other differences with Hardy is the problem.
Anybody know about disctree?
Thanks,
Walt
Grub error 17
I tried to follow the instructions to install Linux Mint 4 Beta but I got a grub error 17 when I reboot with the USB drive.
All the instructions apply except for this:
$ cd /tmp/ubuntu-livecd
$ sudo cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /tmp/liveusb/
My mint Live CD does not have disctree, dists, install, pics pool preseed, README.diskdefines, ubuntu.ico and install/mt86plus.
I've been trying to install a persistent Mint Live USB for a week now. I would appreciate if someone could let me know how I should adapt the instructions for mint. Thanks!
Wrong device mapping?
It seems to be related to a wrong device mapping.
http://ubuntuforums.org/showthread.php?t=442945
might help you out.
Debuntu
think different
I'm just wondering why someone more smart did not an image of a working bootable pendrive ...after that we just need to download the image and then clone it with available software like Norton Ghost or Power quest partion magic ...I hope it works it will be so easy ..the FAT is a basic file system ..so it should be okay ..
Cant make partition bootable with Syslinux
I have gotten to the very end of the tutorial and when I try to use syslinux to make my partition bootable it does this:
$sudo syslinux -f /dev/sdb1
syslinux: this doesn't look like a valid FAT filesystem
Fdisk tells me its a fat 16 filesystem which syslinux is supposed to support. I am new to all of this so cut me a little slack, but I have run out of ideas on trying to solve it. Any help is greatly appreciated.
No boot sector on USB device
Thank you so much for this tutorial! It is very easy to follow and your copy&paste philosophy serves true here :)
However, I am not able to get this to work for me. I have followed all of the instructions several times and still land in the same place. I set my laptop to boot from USB drive and the cursor blinks in the upper left for a good minute or so, then I receive the following error :
No boot sector on USB device
Here is what I am working with :
pc: dell latitude d810
usb drive: HP USB Digital Drive + 1GB generic (MicroCenter branded) SD card
ubuntu: I am using the liveCD of Gutsy (Ubuntu 7.10) as the source. The CD is known-good as I used to install several instances of Ubuntu on this laptop.
notes:
+ I had previously used the HP Drive Key Boot Utility to set the memory stick to support booting. I deleted all partitions off of the stick while working through the tutorial.
+ I did try the 'lilo -M /dev/sdb' command mentioned in the tutorial. I also tried 'install-mbr /dev/sdb' and 'install-mbr -e1 /dev/sdb' - still no-go.
I have searched the www for instances of this error, but have not found a solution.
Thanks in advance for any help you can provide!
Confused - Need Help
"3.3. Copying the files to the usb bar
Let positionned yourself on the CD image directory (in my case: /tmp/ubuntu-livecd , but it might be /media/cdrom , and copy at the root of your usb first partition:
* the directories: 'casper', 'disctree', 'dists', 'install', 'pics', 'pool', 'preseed', '.disk'
* The content of directory 'isolinux'
* and files 'md5sum.txt', 'README.diskdefines', 'ubuntu.ico'
* as well as files: 'casper/vmlinuz', 'casper/initrd.gz' and 'install/mt86plus'
$ cd /tmp/ubuntu-livecd
$ sudo cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /tmp/liveusb/
It might complain about symbolic links not being able to create, you can ignore this.
Now let's go to the first partition of your usb disk and rename isolinux.cfg to syslinux.cfg:
$ cd /tmp/liveusb
$ sudo mv isolinux.cfg syslinux.cfg
change /tmp/liveusb according to your settings"
I found this and other examples online as to how to get Linux on your USB Flash Drive. Being new to this OS and command language syntax it is difficult to understand some of the instructions given,but much appreciated.
The above copied comments is where I'm having the most difficulty so let me tell you where I'm at on this and perhaps a light will be shown on my path. Thank you.
I currently have a formatted and partitioned 1GB USB Flash Drive at this locale:
Disk /dev/sdb: 1031 MB, 1031274496 bytes
255 heads, 63 sectors/track, 125 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000b88f1
Device Boot Start End Blocks Id System
/dev/sdb1 * 91 125 281137+ 6 FAT16
/dev/sdb2 1 90 722893+ 83 Linux
mounted it appears on my desktop as: casper-rw and linuxmint
I have a Linux Mint 4.0 LiveCD in my cdrom0.
I also have the original .iso file which I d/l'd in my Azureus files sub-folders.
Now, I don't understand all of the "/tmp" things and can't find the file location on LiveCD. I know I'm dull of understanding here, but do want to.
Following your tutorial - upon attempt to install syslinux on my /dev/sdb I got the following response:
sudo syslinux -f /dev/sdb
syslinux: this doesn't look like a valid FAT filesystem
next i tried to install lilo -
sudo lilo -M /dev/sdb
Backup copy of /dev/sdb in /boot/boot.0810
The Master Boot Record of /dev/sdb has been updated.
I'm not sure where I'm at on this adventure. The question in my mind is this,
if the Linux Mint system is on the bootable CD in my cdrom drive, is there not a command or way to just transfer/copy these files onto the correct partition on my flash drive?
Any other directives much appreciated.
Persistent Install Problems
Hi,
Like many people unable to make my installation settings persistent :(.
The following configuration does not work
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
It gives IO error while booting.
However, the following starts LiveCD version (as expected)
LABEL persistent
menu label ^Start Ubuntu in persistent mode
kernel vmlinuz
append file=preseed/ubuntu.seed boot=casper initrd=initrd.gz quiet splash --
LABEL live
so basically removing 'persistent' argument makes it boot from USB.
Anybody found a solution to fix this issue?
++Tx
Anirudh
feisty bug
Feisty had this issue, see https://bugs.launchpad.net/bugs/84591
Maybe you can try the same steps but with gutsy.
Debuntu
Problems....
when i run this line in terminal
$ sudo apt-get install syslinux mtoolsit starts the download but hangs when connecting. it prompts me to run apt-get update (something like that) and when i do it decides to hang again. is there anyway to get syslinux and mtools?
sorry if this sounds noobish....
Sounds link a temporary
Sounds link a temporary broken internet connection, patience should solve this :D
Debuntu
Thanks...
oooook
thanks for clearing that up.
this article is really helpful BTW
Know all about windows, but little about Linux
Operating System not found
Dear Sirs,
I followed the tutorial step by step, and I did everything as it is described, but
when I boot from usb pendrive I get the message: Operating System not found.
I also did the last step of fixing the mbr with lilo but I always get the same message.
Can anybody help me?
Thanks
manolo83
sweet
Thanks so much for this really really helpful tutorial. I was looking around on the web and tried a number of tutorials. All are too complicated or have some errors. This one is simple to follow and it works!! I installed Edubuntu7.04 btw
Persistent is too volatile
I have the usbstick working, the system boots fine, and have both FS mounted (casper-rw and liveusb), but nothig is persistent, I create a new folder on the desktop and when I reboot is gone, I install a package and is gone too at reboot. Is this te way is supposed to be?. I'm using Ubuntu 7.04.
Tanks a lot!
P.D.: the tutorial is VERY good and straightfoward.
A bug in new ubuntu
I can't even get it to boot. Boot Error
But I think that is because of the USB device.
I found this article on the latest bugs for saving sessions.. It think this is why your having problems.
http://xubuntublog.wordpress.com/2007/06/17/ubuntu-feisty-on-your-usb-drive-finally/
??
and copy at the root of your usb first partition
and copy TO the root of your usb first partition??
How?
Just another ambiguous live usb tutorial...
Let positionned (you mean "position") yourself on the CD image directory (in my case: /tmp/ubuntu-livecd , but it might be /media/cdrom , and copy at the root of your usb first partition:
Does this mean highlight all the files in the cd and Edit/copy edit/paste into live usb?
I have no idea what you want me to do here.
I absolutely cannot figure out the /tmp thing so I have to use a liveCD. for the /tmp thing -- where do I move the iso file to. With your dirrections I always get "no such file or dirrectory". Do I put it on my desktop, in the /tmp file, on the other usb drive??
-----------------------------------------------------------
$ cd /tmp/ubuNNNNNNNtu-livecd
$ sudo cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /media/liveusb/
-----------------------------------------------------------
Obviously this code for the /tmp thing too, right? what do I type for the cd iso?
cd /media/cdrom0
?
If so, when it says
/media/cdrom0$
and I type:
sudo mv isolinux.cfg syslinux.cfg
I get:
mv: cannot stat 'isolinux.cfg' : No such file or directory
isolinux is not Adept manager in kubuntu either.
This is the point on every tutorial that falls apart... This is really, really frusterating.
The first half made more sense than most, the second half is worthless, check your spelling too.
......
Hi ComputerBob,
""Does this mean highlight all the files in the cd and Edit/copy edit/paste into live usb?""
This just means cd /tmp/ubuntu-livecd. I am not talking about using a file browser, but the command line, so forget about your kubuntu desktop and use konsole/gnome-terminal/xterm/aterm or whichever you like.
""I absolutely cannot figure out the /tmp""
See 3.1. mounting ubuntu livecd image: "Depending if you have the .iso file or the CD, there is 2 different ways of mounting it."
When you download an image (.iso) you don't HAVE TO burn it to use it, you can simply mount it on your filesystem (i.e. 3.1.2) this is where the /tmp thingy comes into action.
There were a typo, /media/liveusb should read /tmp/liveusb.
""sudo mv isolinux.cfg syslinux.cfg""
By that time, you should be in /tmp/liveusb (the command line is just above).
""isolinux is not Adept manager in kubuntu either.""
Who talked about adept or kubuntu, we are moving a file there, that is not related in any ways to package manager.
""This is the point on every tutorial that falls apart... This is really, really frusterating.
The first half made more sense than most, the second half is worthless""
Maybe you should look back and consider your technical skills as well. A tutorial tries to make things easier, but if there is a typo or any missing bits, you should try to understand what goes on. I tried to make this tutorial a "copy and paste" tutorial.
I like criticism but to be honest, I found yours a bit too harsh.
""check your spelling too""
Sorry, I am not a native english speaker. Talking about that, your does not seem to be the most accurate ;)
Debuntu
Stange problem...
I've tried many Ubuntu versions and I get the same problem: it boots fine for the first time and then when i try to boot again, the boot doesn't complete and it goes to an ash prompt with (initramfs) before the cursor. It also reports a problem with tty... :-(
Can anyone help me?
Try unplug the pendrive and
Try unplug the pendrive and then plug it again, works for me :)
Casper or initrams
I've heard that i some cases it's better to use initrams and not anymore casper, 'cause the second is now obsolete...
Check this too before proceeding.
:)
Needed to change disk geometry
Thought I'd share my experience. Install all went ok but syslinux complained about unknown keywords or something. Turned out that syslinux couldn't work with more than 1024 cylinders in the disk geometry. Before creating your partitions in fdisk, hit x for expert mode, then c for cylinders and change it to 1024 if it's more than that, then hit h for heads and change that to 256. Then proceed with the rest of the installation. (Think this'd only happen on a big flash disk and only if the manufacturer decided to use such a geometry.)
persistent mode
ok, so i have feisty fawn loaded into my usb drive and all is working. But when in persistent mode, the settings dont save and i have to redo everything when i reboot. for instance i set the background image and when i reboot it loaded a clean desktop with none of my settings. Some help would be appreciated.
Help
I fallowed the tutorial and everything went swimmingly. Next i rebooted and chose the persistent boot image. everything loaded up and was going fine until it got to the screen with nothing but the desktop background and the rectangular window that usually shows the launching of a few things, among them nautilus. but at this window nothing happens it appears frozen. i restart the window manager by using the Ctrl+Alt+Backspace shortcut but it inevitably returns to the same place.
i have used Ubuntu on my 2 GB flash drive before using the tutorial at pendrivelinux.com and everything worked fine. but I'm using this tutorial because i wanted to upgrade from Ubuntu 6.10 to 7.04 which pendrivelinux.com has yet to make a tutorial for.
i am sort of new to Linux, I've been using it for 1.5 months.
Problems copying to USB under Ubuntu -- can under Windows
This is really strange. Why does it have so many problems during copying at
and I get errors in /var/log/messages that look like:
Those messages continue for the next four hours until things are finally copied over.
I can boot from the USB stick about 75% of the time. Sometimes my BIOS (and that of someone else's laptop I borrowed) seems to not really find a bootable partition, but most of the time it doesn't have a problem.
When I'm using my booted OS, about 30% of the time I will get wierd errors like the wtmp file not being writable (I'm assuming it was corrupted somehow), or the OS will have a problem finding other files necessary to launch applications. I end up having to use fsck to fix a number of problems -- which continue to occur on successive boots of the OS.
This is the second SanDisk Cruzer Mini 4GB that I've had this issue with. I replaced the first one with one from another store because I thought it might be the USB stick that was causing the problem. But nope, same errors.
I've also tried different USB ports when copying the files. Same problem.
The only thing that seems to work is mounting the Ubuntu CD and the USB stick under Windows XP, and copying the files there. No problems with copying.
Any ideas?
SCSI error
Hi,
There is surely something going on with your usb device.
error code 0x50000
I would not be able to tell you what is going wrong, but the linux kernel is having issues with your device and reset it.
Debuntu
Hmm... Thanks. I've searched
Hmm... Thanks. I've searched Google and found that some other people have had similar problems.
error booting!!
I followed the tutorial exactly except the last step.. I used grub instead of lilo.
Everything works fine.. i got the initial screen, I selected the live cd option.. then the system hung!!
I went on to the terminal and it just showed "Loading...". When I tried returning back to the graphics terminal, i got few error message saying that error reading block from squashfs?.. I am guessing that the new Feisty uses it somehow?
Problem solved
Just for other people to know, if you're having a long-loading time, and then just a cursor blinking without end (at least that's what I was facing)..
First of all check the partitions you've made. I didn't want to create the second partition so I've created one big partition and copied ubuntu onto it.
If you're like me and don't want to create an ext3 partition, just DON'T TRY TO BOOT INTO PERSISTENT mode, USE THE LIVECD mode.
Persitent mode won't work (6.10) if you haven't created the second partition.
Notice that 7.04 beta didn't have this problem...
mount: /dev/sda1: can't read superblock
I get the following message when I try to mount the boot partition:
raksen@desktop:~$ sudo mount /dev/sda1 /tmp/liveusb
mount: /dev/sda1: can't read superblock
When running fdisk I got the following note:
Note: sector size is 2048 (not 512)
My pendrive was formatted under Windows XP as FAT32 (I don't know if this helps...)
Does anyone have an idea about how can I solve this? ;)
thanks for sharing
Hi Vitaly,
Thanks for sharing your tip, this will help out many people :)
Debuntu
Correction
the cp command should to to /tmp/liveusb and not to /media/liveusb
Fault in the copy command
As Hadron has said there is a fault in the copy command.
It shouldn't be
but
btw: Nice tutorial ;)
It works, but...
Hi all,
nice tutorial. I had already managed to boot from the pendrive; but still, the pendrive is mounted as /cdrom and the OS operates pretty much like a Live-CD. That is, I am not able to store anything. How can I solve this?
Thanx
M
This is because the live
This is because the live persistence feature is not working. The same thing happened to me, and many others I suspect.
your installation cdrom couldnt be mounted
when i boot with the usb pendrive it gives me an error that says (your installation cd-rom couldnt be mounted. this probably means that the cd rom was not in the drive. Insert the cdrom and try again.) How do i have my install look at the pendrive when installing instead of the cdrom.
persistent mode
Well, using persistent mode, you should be able to store personnal datas and setting on the casper-rw partition.
Your device is mounted as /cdrom simply because installing a liveUSB is done by using a liveCD distro.
Debuntu
Persistent mode doesn't seem to be working
Thanks for the help. For me, this was the best tutorial on putting Ubuntu on a usb pendrive.
I can't seem to get persistent mode to work. It boots fine in persistent mode, but none of the settings persist. I can't seem to save to the casper-rw partition. When I try to save to the casper-rw parition, it says that the partition can't be found. How can I make sure that partition is set up correctly.
Thanks
What about extlinux way?
Perfect! I just love this tutorial, however I am just wondering if the author can show us how to use extlinux instead?
Should be similar
I believe using extlinux should be pretty similar to using syslinux except that you have to format the filesystem as ext2/3 instead of FAT.
Debuntu
I translate this how-to in my blog
Hi all,
I would like to say a big THANCK YOU for this how-to
I translate this in my blog (http://lpg.alfy.free.fr/?p=270) for french people ;)
Good Job Guy
great idea
cheers Costalfy,
Great idea, this will make it more accessible to the french community :D
Debuntu
after following all
after following all directions, and executing the lilo -M /dev/sdb command to make sure the mbr is fine, I can't seem to boot from the usb drive. my bios is set to boot from the usb drive as a first priority, but it boots right into grub from my hard drive, even though it seems to recognize the usb drive judging by the flashing light. does anyone know any workarounds I could try?
syslinux fails
I'm on Ubuntu 6.10 and when I issue this command:
$ sudo syslinux -f /dev/sdb1
I get the following error:
sh: mcopy: not found
syslinux: failed to create ldlinux.sys
Until this error everything worked fine.
Can you help?
Kind regards,
Thierry
You have to install 'mtools'
You have to install 'mtools' first.
mtools
You need to make sure that you have mtools installed:
apt-get install mtools
As mtools is not installed when installing syslinux, I have edited the article accordingly.
Debuntu
Reconstructor?
Thanks, works great now!
Ever tried using Reconstructor to make a personalized Live-stick?
I think I'll try doing that, now I've got this working.
Thanks again!
Thierry
No need of LILO to install MBR
Hi,
You don't need LILO to install a new MBR. Ubuntu's repositories have a package named mbr. This package has an application called install-mbr that does it for you. :)
Nice article btw.
I tried install-mbr, but it
I tried install-mbr, but it did not work for me.
lilo did, that's why I mentionned lilo -M.
But thanks for letting people know.
Debuntu