Tuesday, May 12, 2009

MultiBootin With UNetbootin. A Multiboot Flash Drive Tutorial

I have found that it is fairly easy to make a multiboot flash drive using UNetbootin.
A bit of time, moving files and some simple edits to the syslinux.cfg file is all that is needed.

I'm going to give a short tutorial on how to dual boot Mint Linux and Puppy Linux.
This is done on a 1 gig flash drive with only one partition.

Assuming you already have UNetbootin installed insert your flash drive.
Make sure that any data on your flash drive is saved elsewhere as UNetbootin will wipe it all out.

Start UNetbootin and from the drop down list select Puppy Linux.
The only version available should be the 'Latest Live' version. Select it and then choose the proper destination drive for the flash drive.

After it is finished downloading and configuring Puppy it may be a good idea to try it out by rebooting your computer with the flash drive still installed. If your Bios is configured properly to boot from the flash drive you will see Puupy boot up, ask some questions about hardware and screen resolution then boot to it's Desktop. Once you have verified that it works, reboot your computer with the flash drive removed.

Now that you are back in your computer make a folder on the Desktop or anywhere else you prefer and name it something like USB Puppy.
Insert your flash drive, open it, select all the files and copy them over to the new folder you just made. Now delete all the files on the flash drive. It's time for step 2.

Open UNetbootin and select Mint Linux. Choose the flash drive for the destination and start the download. After it is done you will again want to test it to verify it is working.
When you are satisfied that all is working properly boot back into your main system and then insert your flash drive once again.

Open the flash drive to reveal all the files and folders. Now open the first folder you created named USB Puppy. I resize both windows so they are visible side by side for easy transfer.
In the Puppy folder select all the files except those that have duplicate names in the flash drive containing Mint.

These are the file names you do NOT want to transfer over;
vesamenu.c32, ubnpathl.txt, ubnkern, ubninit, ubnfilel.txt, syslinux.cfg, ldlinux.sys

You could also select all then tell the file manager to skip the files that already exist but I don't like taking a chance that a file may get overwritten or corrupted.

Now that you have all the files from the Puppy folder copied to the flash drive it's time to add the Puppy Linux entry into the Mint syslinux.cfg file. It really is painless! :-)

Open the syslinux.cfg file in the Puppy folder with your favorite text editor.
This is what you will see;

default vesamenu.c32
prompt 0
menu title UNetbootin
timeout 100

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit pmedia=cd

label ubnentry0
menu label puppy
kernel /vmlinuz
append initrd=/initrd.gz pmedia=cd


All we want is the last 4 lines of this file (In Bold). Select this portion and copy it.
Now open up the syslinux.cfg file for Mint which looks like this;

default vesamenu.c32
prompt 0
menu title UNetbootin
timeout 100

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/mint.seed boot=casper quiet splash --

label ubnentry0
menu label Start Linux Mint
kernel /casper/vmlinuz
append initrd=/casper/initrd.gz file=/cdrom/preseed/mint.seed boot=casper quiet splash --

label ubnentry1
menu label Start Linux Mint in compatibility mode
kernel /casper/vmlinuz
append initrd=/casper/initrd.gz file=/cdrom/preseed/mint.seed boot=casper xforcevesa ramdisk_size=1048576 root=/dev/ram rw noapic noapci nosplash irqpoll --

label ubnentry2
menu label Memory Test
kernel /isolinux/memtest
append initrd=/ubninit

label ubnentry3
menu label Boot from local drive
kernel /ubnkern
append initrd=/ubninit


Now place your cursor in between the section that starts with label ubnentry1 and label ubnentry2 and paste the entry from Puppy between them. I use the Enter and Delete keys to make this new entry conform to the format of the other entries. Makes editting easier.
Now before we close and save this file we need to correct some of the label entries.

Notice that each new entry starts with label unetbootindefault then continues with label ubnentry0, ubnentry1, etc. until we get to the entry that contains the new Puppy info.
That one says label ubnentry0 but we already have a label ubnentry0 that points to Mint.
So we take the last entry numbered 3 and change it to 4. Then change entry number 2 to number 3. And finally change the label for Puppy from 0 to 2.

The final syslinux.cfg file should look like this;

default vesamenu.c32
prompt 0
menu title UNetbootin
timeout 100

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/mint.seed boot=casper quiet splash --

label ubnentry0
menu label Start Linux Mint
kernel /casper/vmlinuz
append initrd=/casper/initrd.gz file=/cdrom/preseed/mint.seed boot=casper quiet splash --

label ubnentry1
menu label Start Linux Mint in compatibility mode
kernel /casper/vmlinuz
append initrd=/casper/initrd.gz file=/cdrom/preseed/mint.seed boot=casper xforcevesa ramdisk_size=1048576 root=/dev/ram rw noapic noapci nosplash irqpoll --

label ubnentry2
menu label puppy
kernel /vmlinuz
append initrd=/initrd.gz pmedia=cd

label ubnentry3
menu label Memory Test
kernel /isolinux/memtest
append initrd=/ubninit

label ubnentry4
menu label Boot from local drive
kernel /ubnkern
append initrd=/ubninit

Now close and save this new modified syslinux.cfg file.
Close all open folders, reboot your system with your new multi-boot flash drive still inserted and try it out. If you did it right you should now be able to access either Mint or Puppy and use them in 'Live' mode.

Before I go I want to leave you with some ideas, thoughts and tips.
This tutorial is not the only method to create a multi-boot flash drive nor may it be the fastest or easiest. But this is the way I first tried it and with this method I had success.

Not all distros will be multi-bootable in the same manner. If two distros have the same kernel or boot loader name you will have conflicts that will cause it not to work.
One method to get around this would be to either use 2 partitions or put them in seperate folders. I have not tried this nor am I saying these methods will work. I'll leave you to try it and experiment.

Don't feel that you are limited to just these 2 distros or that you can only have 2 distros for a multi-boot flash. Since I first tried this experiment I have also added Clonezilla to the drive giving me the option to boot to one of three distros/software.

Some flash drives may not be compatible with the Bios and will not boot.
I have some 2 Gig flash drives that won't work yet my 1 Gig flash drives from the same manufacturer works. So if it doesn't work the first time try a different flash drive.

I will not hold anyone's hand or walk them through these procedures. Learning computers and new ideas requires the user to try it and possibly fail until they have success. I have found that this works the best when teaching people new ideas or techniques. Call it tough love or whatever. It works!

Finally I need to make a comment on hidden files. Some distros have them, others don't.
Puppy doesn't but Mint does. I could have had you install Puppy then moved Mint over to the flash drive. But in order for Mint to work properly you would need to choose Show Hidden Files from the View button and make sure that you copied these over to the flash drive as well as the main files.

Hope this mini-tutorial helps you into your journey of multi-boot flash drives.

Enjoy!!

TaZMAn

28 comments:

Anonymous said...

That's pretty good for distros that are so different.

How would you do ... say... Ubuntu i386 and Ubuntu x86_64... both of which use the exact same file names and folders?

TaZMAn said...

Using distros that are very different actually made it easier to dual boot.

Because they use different kernel names, all that I needed to do was add in the Puppy syslinux info to the boot menu and it was ready to go.

I haven't had time to work on dual booting similar distros but as I said in the article, I would try using separate folders or even 2 partitions.

I believe syslinux will be able to handle the dual folder scheme but Ubuntu itself may have problems because it's not in the root file system during the boot process.

That leaves dual partitions on the flash drive and that would require using a grub loader rather then syslinux.

Good luck and hope this helps a bit.
Maybe in a few weeks I will have time to try this project and post the results in my blog.

Otto said...

How about placing each distro in its own partition? Looks like syslinux.cfg treats everybody as being in the same partition.

rbaleksandar said...

It's better to use different folder (even partition) for each distribution. The advantages are (you've mentioned the first one):


- no kernel conflicts (most important thing!)
- even for 2-3 systems is really difficult and time-consuming if you want to edit something like removing one of the OSs or replacing it with another one. This is because you've copied all folders from all OSs inside your USB's root folder. For 2 OSs it might be doable, but if you have 4-5 + rescue LiveCDs etc. you will have hundereds of folders. You get the point I hope ;)

Even than problems can occur since not all LiveOSs can be simply extracted and booted.

When partitioning have in mind also that if you want to use the USB stick on a Windows-machine (dunno about MacOS or (open)Solaris), you will find out (as you probably already did) that Windows doesn't support paritioning removable media or even viewing them. If you have 10 partitions on your USB, only the first partition will be shown inside Win-Explorer (if in a distinguishable format (ext-format won't be shown unless you use a third-party driver which is a pain in the a*se)). So all who do multiboot on a multi-partitioned USB stick make the first partition FAT32 (or NTFS) so that it can be used for sharing information between Microsoft-host (the machine where you plug in you USB stick) and *nix-system (the OSs on the USB stick). Hope this information helps you or anyone else who reads this blog.

Your article is helpful indeed but one has to experiment a lot in order to bring two Linuxes on the USB stick - kernel confilcts are a known-issue by many users who do that.

Jeremy said...

Thank you!I"ve been googling all over with no sucsses.

k said...

@rbaleksander:

So how is multi-partition LiveUSB setup done?

Gafassum said...

I've successfuly done it with these three distros:

easy-peasy 1.5, elive 2.0 (latest stable) ans sliTaZ 2.0 by Unetbootin easy-peasy first then copying the rest. No conflicts at the moment all 3 distros in the same partition. I'm planning to see if it's possible to get gentoo into it.

took me some time but finally succeed after a few hours.

Sorry for my bad english.

TaZMAn said...

Hi Gafassum,

Good for you! Thank you for posting your success story here. I'm sure you are proud of your accomplishment and I know how it feels when you get a multiboot flash drive or disk working.

It's a great feeling and a moment of personal victory. As you work with it more you will find it gets easier.

And no need to apologize for your english. Your english is just fine!

Thank you for stopping by and good luck adding in Gentoo. I'm sure you can do it.

Mickeyj4j said...
This comment has been removed by the author.
Mickeyj4j said...

hi i have tried this and its great. what you have mentioned other ways. can you post links to them like multicd http://multicd.tuxfamily.org/#SupportedDistros

i'm going to try it this way next. after i have tested UNetbooting more with other distors.

Branded USB Sticks said...

It is new terminology for me distros, can you explain about this terminology a bit?

TaZMAn said...

Hi Branded,

Do you mean what does the word distro mean?

It's short for distribution.
Examples;

Ubuntu just released a new distribution named Lucid.

Or we can say that Ubuntu released a new distro named Lucid.

Just a short way of saying and typing it.

Hope this clears it up for you.
And thanks for stopping by.

Anonymous said...

There's no need to first install Puppy with unetbootin. Just download the iso, mount it, and then copy 3 files to their own directory, e.g. Puppy: initrd.gz, vmlinuz and the .sfs file. Create your menu entry, and you're done.
I had hoped to find advice on how to multi-boot 2 different flavours of Ubuntu (Ubuntu proper and Ubuntu SE), but alas, no such luck.
But this is a nice tutorial anyway.

rax said...

Linux flash drive can provide a communication channel that is safe from a possibly compromised computer. linux flash drive

rax said...

Linux flash drive can provide a communication channel that is safe from a possibly compromised computer. linux flash drive

Anonymous said...

Very interesting post. This is definitely relevant to my interests.

rax said...

hi,it is useful information. thanx.usb boot drive

g-rant said...

I tried to follow your tutorial but using ophcrack & bt4 instead. However ophcrack has no syslinux.cfg file and its setup is much different than bt4. Could you explain to me how I would accomplish my goal?

Email: grbrysmith@yahoo.com

maxifick said...

Does anyone have a solution how to multiboot the flash drive using separate directories?

I tried the steps described in this article, but I've put all the files for the other distro into a separate dir. Then, in syslinux I prefixed all paths for the other distro with the name of the new dir.

In my case the two distros were Ubuntu 11.04 Natty and Mint 10.

However, if I try to boot Natty from the separate dir, I always get Mint anyway.

Any hints?

Mickeyj4j said...

i must say that since a newer version of unetbooting it no longer works. i used to do similar with unetbooting then they updated adn i coudl no longer dual boot using unetbooting. unetbootin uses syslinux, adn i have found that installing syslinux manually works best when it comes to dual booting.

TaZMAn said...

@Mickeyj4j

What OS are you using Unetbootin on?
I haven't made any multiboots in a while. So my version was the older one. I just downloaded the newest version and will test it in Ubuntu 10.04 when I get a chance.

Thanks for any info you can provide.

Anonymous said...

nice article..
a complete giude for instaling and configuiring UNetbootin is here: http://fossbytes.blogspot.com/2011/09/how-to-use-unetbootin.html

Anonymous said...

is it possible that instead of putting two live distro image into the flash drive, I will put one distro image (say puppy) and ultimate bood cd or system rescue cd

The Path said...

Thank's for this info it made this project so simple i did it while I eat breakfest sunday...

Militaru Dan said...

I can't get to show more than one item in the menu, can you? The rest is done, i'll show you how.

Militaru Dan said...

Sorry i was confusing above i was modifying syslinug.cfg on hdd and testing the flash.
It seems it works now for any simple image, like TaZMAn thought, this simple way:

default menu.c32
prompt 0
menu title UNetbootin
timeout 100

label ubnentry0
menu label abc
kernel /ubnkern
append initrd=/ubninit

label ubnentry1
menu label def
kernel /ubnkern
append initrd=0001/ubninit

after making 0001/ubninit and so on.
A more simple way i think is rename ubninit to ubminit001, ubninit002 as many images you have to load and point to it for every boot item.

It was no need for:

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit

Another (testing) way is do nothing and just press TAB and point to the image you need loaded.

Ade Malsasa Akbar said...

Thank you. I've done successfully Blankon 9 (Indonesian distro) which is not supported by Multibootusb, YUMI, nor Multisystem. I used your tutorial and it is success. I have documented my success here http://malsasa.wordpress.com/2014/11/28/tutorial-membuat-multiboot-blankon-dalam-usb-flash-disk/. Thank you.

Anonymous said...

Thanks for this, easy to follow!
I can recommend this to others.
Now have a multiboot USB with Mint, Debian, and Fedora.