Home

Debian/Ubuntu Tips & Tricks

Debuntu.org: .deb packages, Unix/Linux Tutorials and Articles.

User login

Get Firefox


Tips


How-to: Installing Ubuntu Linux on a usb pendrive

This tutorial will show how-to install Ubuntu on a usb stick. Even though this tutorial uses Ubuntu as its base distribution, you could virtually use any type of Linux liveCD distribution.

Being able to run Linux out of a usb bar is a great way to enjoy the live CD experience (being able to use Linux on any computer you might get by) and the big advantage of being easier to carry around than a CD.

1. Requirements

In order to reproduce this tutorial, you will need a few items such as:

  • a ubuntu liveCD
  • a usb bar of at least 1G
  • a running Linux operating system

Now that you have all this, it is time to prepare you USB bar do host the Ubuntu liveCD files.

2. Setting up the USB disk

2.1. Finding the device

In the first place, you need to plug your usb drive and check under which device it is associated. To find out the device, run:

$ sudo fdisk -l

On my system, the device appears as being /dev/sdb, I will therefore use /dev/sdb as a reference for this tutorial, please replace it accordingly to your system (might be sda, sdc ...).
Once you found your device, you are going to create the partitions.

Using the wrong device name might destroy your system partition, please double check

2.2. Making the partitions

Make sure every of your already mounted partition are unmounted:

$sudo umount /dev/sdb1

and then launch fdisk, a tool to edit partition under linux:

sudo fdisk /dev/sdb

We are going delete all the partition and then create 2 new partition: one fat partition of 750M which will host the files from the live CD iso, and the rest on another partition.

At fdisk prompt type d x where x is the partition number (you can simply type d if you only have one partition), then:

  • n to create a new partition
  • p to make it primary
  • 1 so it is the first primary partition
  • Accept the default or type 1 to start from the first cylinder
  • +750M to make it 750 Meg big
  • a to toggle the partition active for boot
  • 1 to choose the 1 partition
  • t to change the partition type
  • 6 to set it to FAT16

Now we have out first partition set up, let's create the second one:

  • n to create yet again a new partition
  • p to make it primary
  • 2 to be the second partition
  • Accept the default by typing Enter
  • Accept the default to make your partition as big as possible
  • Finally, type w to write the change to your usb pendrive

Partitions are now created, let's format them.

2.3. Formatting the partitions

The first partition is going to be formated as a FAT filesystem of size 16 and we are going to attribute it the label "liveusb".

$ sudo mkfs.vfat -F 16 -n liveusb /dev/sdb1

The second partition is going to be of type ext2 with a blocksize of 4096 bytes and the label casper-rw. Mind that it has to be labeled as casper-rw otherwise the tutorial won't work!.

$ sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2

At this stage, our usb pendrive is ready to host the liveCD image. Now, let's copy the files to the usb bar.


Hi, its a very basic

Hi,

its a very basic question from a newbie like me.
while performing "step 2.3 formatting", I get following problm -

my usb is mounted as /dev/sdc1 and now I have added two partition on it as said. but while formatting which device should I use. I am confused because in the article it says sdb1 and sdb2 which might be the partition in the USB for author. for me its /dev/sdc1p1 and /dev/sdc1p2. when I try to format by this name my host can not identify this and gives error like no such device.

please help soon

thanks


How to install Ubuntu onto a 1GB USB Pendrive from a live DVD?

Hi All,
I have a little problem! I would like to install Ubuntu onto a 1GB USB pendrive. However, the only guide I can find shows you how to do this using a Live CD. I have tried this but the live CD does not seem to have the ability to use wireless networking, which is the only way I have of connecting to the internet.

The live DVD comes with many more features, as you'd expect, but I am unable to install to my 1GB pendrive because the pendrive soon runs out of free space.

Can anyone help me? Is there a way of getting a live CD with wireless networking on it OR is there a way of only installing some of the live DVD onto the pendrive?

Thanks,

Phil
(ps. I'm a bit of a Linux beginner so please keep technical speak to a minimum!)


customizing livecd

Hi,
I guess this tutorial will help you to add wireless support:
Customizing Ubuntu Live CD
Debuntu


Why bother?

I swear the more I see these "tutorials" the more I feel like they are written by newbs to impress newbs.

I'm thinking that if a person really knew what they were doing, which is implied via the creation of a tutorial, and really wanted to make it easy for others, which is also implied, and really didn't care about looking smart over being smart, again implied they'd write a simple app batch script installer or whatever.

In fact it's silly that canonical doesn't offer a usb reinstalled image or installer for usb. Some machines don't even have cdroms you know.

Ubuntu: Linux for People ...who are assumed to already know Linux.


overly critical

A script would have been a good thing but you are unfairly critical and are baselessly ascribing motives to the author of this page. The author has solved a problem and documented the solution but is not claiming to be an expert or to have come up with the ultimate solution.

Your criticism of the author for not providing a image is particularly out of line. Not everyone has the means to post such a large image and the image would only be useful for a particular version and flavor of ubuntu where these directions will probably work for many different versions with little or no modification.

Here are some tips for documenting system management work in a way that is very nearly an executable script and can be usually trivially be converted to a script: http://www.freelabs.com/~whitis/linux/captains-log/
This gives directions which are human readable and can be cut and pasted into a shell or turned into a script by prepending "#!/bin/bash" to the beginning of the file (and sometimes adding options to supress interactivity).

These instructions can be made into a script fairly easily.
- Create a file starting with #!/bin/bash
- Copy all the sample instructions from the document to a script
- automate fdisk
- automate the syslinux.cfg edits using diff, perl, sed, or cat and a bash "here document" (for diff or cat).
- substitute variables for the hardcoded device names
- optionally add getopt parsing to allow changing device names without editing the script
- the cp command should probably use a wildcard instead of naming explicit directories, this should work on
more versions.

What these instuctions don't tell you is that live distributions like this can be installed on a flash drive in at least two different ways. One is a copy of the CD with a few edits. That is what is done here. This has the advantage of being smaller (and thus fitting on smaller flash drives) and still can be used easily to install to a hard drive. It has the disadvantages, however, that it will be slower, require more memory for ramdisks, and is hard to modify. Another method, is to run ubuntu and choose install to hard disk but specify the USB drive as the target. This requires a larger flash drive but is faster, requires less memory, and is easier to modify. If you intend to use the USB drive as a working system rather than a tool for installing systems, this is likely a much better method as it is easier to modify and faster.

These directions also say you need a working linux system; it should have been pointed out that the live CD itself would suffice nicely for that purpose.


You might want to use: fdisk -l

You might want to use:
$ sudo fdisk -l

This will output the different partition you have, then pick up the right one.
Debuntu


linux off USB

hi guys

i am trying to get around a problem for the last one month. since i am not a computer expert most of the answers what i get is not sufficient. as somebody put it giving a link and asking to read manual is not helping me at all. i will summurise the issue and will ask you the perticular things i want to know.

i have got a sony vio laptop which doesnt support USB boot.i have got an external USb HDD on which i want to put any of the linux distro preferably ubuntu. i tried with fedora and ubuntu but did not work. some of the forums opined that you can get around this problem with installing GRUB on MBR. when i restart grub menu never comes up.

can any one help me with this issue please.i would be happy if u tell me with making a bootable CD to tackle it so that i can boot from my USB HDD.

thanks


there is one solution for

there is one solution for this that is very simple. there is a program called wubi which u can get at the following link. (http://www.download.com/Wubi/3000-2094_4-10702316.html?tag=lst-0-1)
all u got to do is download this and install it into which drive u want. it will download and install ubuntu for you or u can download ubuntu cd iso from this link (http://releases.ubuntu.com/feisty/ubuntu-7.04-alternate-i386.iso) and put in the same folder as the wubi installer and it will be faster. it is about 696 mb download.
the instructions on how to ( http://www.download.com/8301-2007_4-9723017-12.html?tag=blog.1) just make sure you put it on the external hard drive. and for size its up to you how much space u want it to use up to 30 gb which is plenty. the new version 7 don't have drivers for radeon below 9500 so u may have problems with some things if u have that. one other way is to go on ubuntu website and order a free cd from them and u can use that to install it on the external hard drive also


Persistent Partition

Hello all,
Fantastic site, wish I had found it long ago!
I have followed the tutorial and it works well, one small problem that I wonder if anyone can shed some light upon.
When I boot up and select the persistent option, for the first couple of boots it works very well, on subsequent boots I get an error saying my session only lasted for 10 seconds, then I cannot log into my partition.
If I also remember correctly I think it also says something about an Xserver (though I could be wrong).
I have tried a couple of USB sticks now and they all have the same error.
If anyone could help I would be very grateful
Thank you.
Nic

In life, sometimes you are the lamp post and sometimes the dog


Persistent .ICEauthority

I have reformatted and tried several times to get Mint 2.2 to work. After the first session and a successful boot I also get that same error. "Unable to lock ICEauthority file. I wonder if you have managed to find a way to correct it?


custom settings and ~/.xsession-errors

The reason this usually happens might be due to some preferences files in your home dir.
Did you by any chance copy some user settings (~/.* files) from another install to your usb stick?
You might also find hints in the ~/.xsession-errors file
Hope this helps.
Debuntu


Thank you

Hello chantra
Thank you for your response I will take a look and see if i can spot anything.
Not wishing to sound dull, if I cannot log into my persistent area will I find the files by looking on the Casper RW partition?
Nic

In life, sometimes you are the lamp post and sometimes the dog


Yep, it should be on your

Yep, it should be on your casper-rw.
that partition should have a /home folder, look into there.
Also, if you can't start a X session, you might want to type Ctrl-Alt-F1 and logging from the virtual console.
Debuntu


RE:

Ok I tried to install to a brand new USB stick, all went well for a few boots, then the error came up once more.
I tried to Ctrl+Alt+F1 and logging in that way.
I cannot remember what the entire error is, something about ICE. not being able to do something.
I also looked of for the /~x server file but could not find it, when logging in I saw it, something about /tmp/.xo-lock needing to be removed.
Think i am going to leave it for a while now.
Thank you very much for your help

In life, sometimes you are the lamp post and sometimes the dog


Same Login Problem

I'm wondering of you solved this problem because I'm getting the same login prompt asking me for login id and password, then session ends within 10 sec.

I can run my fantastic pen drive Ubuntu like a live CD, but not in persistent mode. My knowledge of Linux has not evolved to the point that I can troubleshoot this one on my own!

Anyone out there have a solution?

John


Works!

Works great, many thanks for your How-to.


Easier way

I've been using Puppy Linux (www.puppyos.com) off a usb for years now. Boot off the live CD then there is a nice little 'wizard' that installs on the drive for you! For those not sure about booting off a liveCD, I was very wary at first, try VirtualBox (www.virtualbox.org) to run a linux distro from within your XP! You will begin to enjoy it very quickly. It is a great way to find which one you like best. Personally I found Ubuntu way to cumbersome.


Very Cool

Very cool. I've bookmarked for future reference. BTW, good chance this will make COTD on TekTag.com.


I get Boot Error at boot up

Using a card reader with a 1Gb SD in it. Maybe it's not comp. ?


How about from a Windoze machine?

I want Ubuntu on a stick, but I don't have a working Linux box. Can you get me there from Windoze?


You could try

You could try www.pendrivelinux.com

They have step by step procedures from windows XP. Though u may have to use the Live CD first. But you dont need to have it installed though.


From windows

I'm not much of a windows user, but I know that syslinux is available for windows.
1. You should be able to achieve this by formating the usb bar as described above, but for the ext2 partition.
2. Mount the CD/ISO with whichever utility under windows (winImage...)
3. Use syslinux.exe to make the first partition of your usb bar bootable
4. The casper-rw might be created after a first boot from the usb key in normal mode.

I believe this is roughly how you might be able to achieve the same thing from windows.
Debuntu


only if you spell it right.

no one likes it when you spell it windoze. you sound like a dumbass and its not cool. its w-i-n-d-o-w-s, just do it right.
its also MS not M$ and not OMG WROST CMOPNY EVA!


Get a Life....

WINDOZ is a M$ product... get a LIFE !


./

Exactly what I was thinking.


sorry bud, but you're the

sorry bud, but you're the azz for pointing out that windoze isn't spelled windoze...

MSFT == Software From Satan™


Please stop this silly

Please stop this silly war.
There is no point in arguing about this and this is off topic.
cheers
Debuntu


You know, I bet if I googled

You know, I bet if I googled "Ubuntu from a flash key \ pen drive \ anything else you want to call it" it would probably come up as the first result... but Im lazy.

Anybody want to spill the beans or a link?


thank you, bill

thank you, bill gates.

windoze still sucks.


New to Linux, Ubuntu..etc.

I am brand new to any Linux use. I wanted to try it since I've heard so much about it. BUT, now that my very first experience with it is some person mouthing off about "WINDOZE SUCKS" I am totally turning away form this.

Bye


All the "WinDoze" talk does

All the "WinDoze" talk does is make the Linux crowd sound like children, this does not help the Linux cause. If you want Linux to kick Microsoft's ass in the marketplace, acting like kids won't get the job done.

Terry,

Ignore the kids, and Give Ubuntu a shot, the truth is in some way's it's well behind Windows, in Gui-polish I'd say it's more on par with Win95 rather than XP, but it is getting better all the time and in many areas it's far superior to XP or Vista. And unlike Vista it's engineered for the user rather than against him.

If you don't understand that statement, please Google +Vista +security +kernel and read about the design philosophy that went into Vista. This is the main reason XP is the end of the Microsoft road for me.

All the best.


Easy there

Do you know where that phrase came from? I have been using it since the mid 90's (as in my C:\WINDOZE system directory!). I first came across it in a Microsoft developers forum, when the new version of Windows was being finalized (presumably 95). The devs used the phrase 'Now Windoze sucks less' quite frequently then.

It need not be a big deal - but it can be hard to change the usage after more than 10 years... :)


Dude, Please dont let one

Dude,

Please dont let one asshole that is on an ego trip scare you away from linux. I finally got into it about a year ago and havent looked back since. Ubuntu was the first distro i tried and loved it. If you're the type that likes to tinker to get everything perfect then it may be something to try for you, otherwise you may not like it. Throw in a live cd or goto pendrivelinux.com and try it out on a flash drive. Just my 2 cents for you.


Please, grew up!

If only for a comment your crying out loud, maybe it's better for you to go back to play with your legos.


What a loser some people are - crying over the use of windoze!

The tosser who carried on about someone spelling Windoze is just that - a tosser!

They then post a final gramatically incorrect statement anyhow as a childish departing remark.

Windoze is a take on the windows OS as well on the 'doze' part, meaning slow and anyone who's used windoze knows, it's a huge bit of bloatware.

Others have correctly pointed out that such stupid posts having a go at someone only highlights linux and it's cohorts as a bunch of anal retentive white-coated people.

I for one have only dabbled with linux over the years, I started with slackware and redhat etc but never really bothered with it too much because of the general lack of beginner support.

In the last few weeks I've discovered ubuntu and the amount of decent support that allows for noobs/beginners is a wonderful contrast to what's generally been the support (or lack of) for linux.
Helping people who really don't have a clue is the only way the ground swell is going to rise up enough to seriousy challenge MS - otherwise linux will die just the way other technologically great things have when the masses cannot use them simply.

It's nice to see people being able to post simple questions and not be told stupid stuff like 'you should read the manual' etc.

Giving people proper answers will create happy converts who will in turn help others starting out - and before too long, you have a chain reaction going.

I remember when windoze 3.11 was out. On bbs's etc there was no such thing as a stupid question. If a stupid question got asked then a sensible answer was forthcoming. This is how windoze people treated each other - the linux community have been guilty of be-littling new comers in the past but it's nice to see that attitude changing. (I don't consider telling someone to read the manual as an appropriate response).

After many years on the fringe looking in, I'm really looking forward to getting stuck into what looks to be a great OS (although I do love OpenVMS) and let's just hope we see less and less of the likes of the person who cried over someone using the term 'windoze' - the linux community can certainly do without such pettyness.

:-)


.\ > m$

The height of folly is to not use something because someone else misused it. The people with a bad taste in their mouths from others slagging off 'you know who' are equally retarded. Linux is a great OS, windows is a great OS ö - there, we all hapy now????

Just use either of em and 'walk placidly amidst the noise 'n haste'