Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The thing I'm trying to do:

  1. Make a bootable USB with two partitions (bootable FAT32 and NTFS for data). (DONE)
  2. Install GRUB2 to FAT32 partition. (DONE)
  3. Make FAT32 partition multiboot, with persistent installed Ubuntus.

The last one shouldn't be that hard, but now my head is about to blow... I can't find anywhere step-by-step instructions on how to do persistent installation of Ubuntu on one partition and not in the root directory (in ubuntu12.04 folder for example). At this time I've gathered information from it looks like all internet and here what I've done:

  1. Extracted Ubuntu 12.04 LiveCD ISO into /ubuntu12.04 directory.
  2. Created /ubuntu12.04/casper-rw file using dd and mkfs.ext2 it.
  3. Added menuentry to grub.cfg:

    menuentry "Run Ubuntu 12.04.2 Live" {
        linux   /ubuntu12.04/casper/vmlinuz  file=/ubuntu12.04/preseed/ubuntu.seed boot=casper persistent rw quiet splash --
        initrd  /ubuntu12.04/casper/initrd.lz

But result are always the same:

(initramfs): Unable to find a medium containing a live file system.

Where should I place casper-rw file to make initramfs find it? Or anything to get what I need.

share|improve this question
up vote 2 down vote accepted

For Ubuntu 12.04.2, the kernel is /casper/vmlinuz.efi. Notice the .efi was added in recently.

Also, you don't need to extract the CD files, you can boot directly from the .iso. Here's a template I use for USB multiboot:

menuentry "YOUR TITLE" {
    insmod ntfs
    insmod iso9660
    loopback loop /distros/FILENAME.ISO
    linux (loop)/casper/vmlinuz.efi persistent boot=casper iso-scan/filename="/distros/FILENAME.ISO" noeject noprompt splash toram --
    initrd (loop)/casper/initrd.lz

This way I can keep all distros/versions as their pristine .iso files in a /distros directory inside the NTFS data partition. Grub2 is installed to the MBR, and its /boot files (including the above handwritten /boot/grub/grub.cfg) also in the data partition. Grub2 was installed as:

sudo grub-install --no-floppy --root-directory="/PATH/TO/MOUNTED/USB" "/dev/sdX"
share|improve this answer
This way doesn't looks like persistent... does it save changes after reboot? – MadBrozzeR Jul 27 '13 at 9:41
@MadBrozzeR: just add persistent to the linux line and create the mkfs.ext2'ed casper-rw file in the root of partition. – MestreLion Jul 27 '13 at 13:21
oh, I see... thank you, it's really working. – MadBrozzeR Jul 27 '13 at 16:41
Also after learning initrd.lz archive I found persistet-path parameter, and now I don't have to keep casper-rw in partition root (to have separate filesystems for each distro... don't sure though I really need it). – MadBrozzeR Jul 27 '13 at 16:50
@MadBrozzeR: glad it worked! 3 things to note: It's persistent-path; it may not work if the USB filesystem it resides is NTFS (but worth trying); and the casper file filesystem does not need to be ext2, it can also be ext3 or ext4 (recommended) – MestreLion Jul 31 '13 at 1:58

Manual creation of the boot disk using grub is pretty fragile from my experience. If it is made on a efi system it will not work on bios systems, failing with the error

error:invalid arch independent ELF magic.
grub rescue>

On efi only systems, bios bootoaders may not work. Best is to go for both grub-efi and syslinux just like the automaticaly created live CD.

You might want to do this to

a) prevent a bazilion folders and files from cluttering your pendrive and rendering it unusable for any other purpose


The technique I use is as follows: put grub:

sudo grub-install --removable --root-directory=/path/to/mount /dev/sdx

the --removable seems to be needed or it produces funny install errors on some computers with efi

Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.

this creates a boot and an efi folder. to install syslinux inside the boot folder (unlike the standard live cd):

cd /path/to/mount
sudo syslinux --directory boot/syslinux --install /dev/sdx

extract the ubuntu iso to a folder say ubuntu (/path/to/mount/ubuntu) edit /path/to/mount/boot/grub/grub.cfg to contain:

menuentry "Ubuntu" {
    set gfxpayload=keep
    linux   /ubuntu/casper/vmlinuz.efi  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash live-media-path=/ubuntu/casper --
    initrd  /ubuntu/casper/initrd.lz

then set up the syslinux: copy vesamenu.c32 from the isolinux directory in the iso to /path/to/mount/boot/syslinux/vesamenu.c32 create /path/to/mount/boot/syslinux/slax.cfg to contain:

DEFAULT /boot/syslinux/vesamenu.c32

LABEL Ubuntu
    kernel  /ubuntu/casper/vmlinuz.efi  
    append initrd=/ubuntu/casper/initrd.lz boot=casper live-media-path=/ubuntu/casper quiet splash --
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.