Robert's Virtual Networkingeast82.com

dual boot flash driveCreate a dual boot Linux pen drive

Thanks to Eric Locke and Ryan Weaver for their help.

 What you'll need

EXPLANATION:
The U904p.exe contains files you'll need to automate the creation of a bootable thumb drive running Ubuntu 9.04 Desktop. This is straight forward and pretty simple.

As stated above, 7-Zip is used to unpack our Slax distro. We then add these unpacked files (Most of them, anyway) to the thumb drive manually and tinker with the Ubuntu syslinux.cfg file (Well sort of) to get Slax recognized by the boot menu.

Both Ubuntu and Slax will be persistent installs, meaning changes to configuration and new files are saved and carried with you. How cool is that!?
 

Let's Get Ubuntu 9.04 Desktop installed:

  1. Insert your USB thumb drive to your PC, ensuring there’s only one partition formatted with FAT32. Note the drive letter assigned by Windows.
  2. Double-click and run the U904p.exe. This will extract the needed files. A U904p folder will be created in your working directory. This should be done on your Windows hard drive, for example the Desktop.
  3. Copy or move the ubuntu-9.04-desktop-i386.iso into the newly created U904p folder.
  4. Double click the U904p.bat file and follow the onscreen instructions. Must be run as Administrator if running Vista and UAC is enabled
  5. Boot a computer using your Ubuntu bootable USB drive. Voila!

EXPLANATION:
The U904p.bat file Unpacks the Ubuntu ISO and writes it to your USB drive. It also copies the casper, makeboot.bat and the text.cfg files to the drive.

Casper stores your persistent changes, makeboot.bat will make the drive bootable and text.cfg provides the proper menu options for Ubuntu to run on your flash drive. The batch script also renames a few files to make things run smoothly ...that is booting from a flash drive vice CD.

It is highly advisable that you remove any other media connected to USB ports and that you turn off User Account Control (UAC) if running Vista. Otherwise you may farkle up the MBR on your HDD or screw up data on another drive.
 

Let's install our Slax distro:

  1. Unpack the Slax ISO on your Windows hard drive. You should have two directories, “slax” and “boot” within the “slax-6.1.1” parent directory. Your parent directory may be labeled differently depending upon the options you selected when unpacking the ISO.
  2. Go to the boot folder and cut the initrd.gz and vmlinuz files and paste them to the slax folder.
  3. Copy or move the slax directory to the root of your USB drive.
  4. Go back to the boot folder and open the slax.cfg file in notepad. Locate the below text and change it from (Changes highlighted):
LABEL xconf
MENU LABEL Slax Graphics mode (KDE)
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.gz ramdisk_size=6666
root=/dev/ram0 rw autoexec=xconf;telinit~4 changes=/slax/

TO:

LABEL slax
MENU LABEL Run ^Slax Persistently
KERNEL /slax/vmlinuz
APPEND initrd=/slax/initrd.gz ramdisk_size=6666
root=/dev/ram0 rw autoexec=xconf;telinit~4 changes=/slax/

Copy the changed text to the clipboard.

  1. From your USB drive open the /syslinux/text.cfg file in notepad and paste the contents from the clipboard into a location to your liking. You may also want to remove or comment out any unwanted entries, pre-pending them with a “#” symbol. My final text.cfg file looked like this:
default live

label live
  menu label
  Run ^Ubuntu Persistently
  kernel /casper/vmlinuz
  append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.gz quiet splash --

LABEL slax
  MENU LABEL
  Run ^Slax Persistently
  KERNEL /slax/vmlinuz
  APPEND initrd=/slax/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;telinit~4 changes=/slax/

label memtest menu label Test ^memory kernel /install/mt86plus

##########################################################

#label live-install
# menu label ^Install Ubuntu
# kernel /casper/vmlinuz
# append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.gz quiet splash --

#label check
# menu label ^Check CD for defects
# kernel /casper/vmlinuz
# append noprompt boot=casper integrity-check initrd=/casper/initrd.gz quiet splash --

#label hd
# menu label ^Boot from first hard disk
# localboot 0x80

EXPLANATION:
First, thanks to Eric for helping me sort out the Slax install!
 
Since Ubuntu is the install that provides our menu options, this is what we want to edit. Normally we'd locate and edit the “syslinux.cfg” file to point to other distros (In our case Slax). However, with Ubuntu the /syslinux/syslinux.cfg file uses “includes” and so is built dynamically from the contents of other text files.

Drilling down we find that the /syslinux/text.cfg is the file that gives us our menu options, so that is the one we edit. With Slax, the /boot/syslinux/syslinux.cfg file points to the /boot/slax.cfg and so this is the one we get our entry pointing to the Slax vmlinuz and initrd.gz files.

Originally I left the vmlinuz and initrd.gz in the boot directory, created a slax directory on the USB drive and dumped the two directories in there …so, I had the following structure: E:\slax\slax and E:\slax\boot with the Ubuntu /syslinux/text.cfg containing the proper entries pointing to the Slax vmlinuz and initrd.gz files. Slax would fail to prcoperly load. By moving things around Slax eventually worked.

The bottom line is this – After Ubuntu is installed, subsequent distros can be added by copying them to your USB drive, editing the entries in the added distro’s menu to correctly point to the vmlinuz and initrd.gz files, using syslinux.cfg as your starting point and copying the editions to the /syslinux/text.cfg file.

The lesson learned here is this. Each distro has its idiosyncrasies concerning paths, file locations, file names, directories, etc. and so you may have to use Google and/or tinker with files to find your answers. Hopefully this document will serve as a good starting point.

./Robert