Ubuntu – Unable to boot Ubuntu Live USB Flash Drive with casper-rw persistent partition


So, I've spent the last day going through similar questions, and can confirm first that this is not a duplicate of:

With that out of the way: I've created an Ubuntu 14.04.03 Live USB Flash Drive (32GB) using UNetbootin, as well as the Ubuntu Startup Disk Creator. In both cases, I was able to successfully deploy my Ubuntu ISO (which I've confirmed is intact via md5sum analysis). In both cases, persistence worked successfully (I had to manually enable it when using Ubuntu Startup Disk Creator, but UNetBootin adds the -persistent kernel argument automatically to syslinux.cfg), no problems.

I need to have a persistence file larger than 4GB, as I'm creating a bunch of these flash drives for Field Application Engineers (FAEs), and they need to be able to use them on the road to diagnose installations for custom systems my company currently supports. It's fine if they burn out due to excessive write cycles, and each FAE gets a dozen of them if needed for each trip.

Also, we need to keep the first partition on the disk as a FAT partition in case the FAE needs to drop files onto the disk from Windows, Mac, Linux, etc, as Windows machines refuse to mount FAT partitions on a flash drive unless they are the first and only FAT partition on the disk.

I've tried the steps in the following articles:

The instructions were clear:

  1. Create a Live USB flash drive with Ubuntu, leaving space for an extra partition.
  2. Delete the casper-rw loopback file on the first FAT partition on the flash drive.
  3. Use gparted to create an ext2/ext3/ext4 partition after the FAT partition, and give it a volume lable of casper-rw.

I followed all of the advised steps, but booting fails. When I attempt to boot from my newly-created flash drive, I am directed to a prompt instead of Ubuntu properly booting, though I briefly see the graphical Ubuntu startup screen animation.

dmar: IOMMU: failed to map dmar0
ACPI PCC probe failed.

BusyBox v1.12.1 (Ubuntu 1:21.0-1ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs) _

I've gone through the Ubuntu bug tracker, and it seems that this issue has been observed by numerous others:

And that it has been solved, so I should expect the fix to already be in my Ubuntu 14.04.03 image:

I've also tried updating my kernel boot parameters, by inserting LIVE-MEDIA=/dev/sdd1 (in my case) at boot time by hitting TAB, ie:

kernel /casper/vmlinuz.efi initrd=/casper/initrd.lz file=/cdrom/preseed/ubuntu.seed boot=casper LIVE-MEDIA=/dev/sdd1 -- persistent

This time it at least finds the boot partition and starts attempting to boot the Live USB disk, but seems to fail along the way, with a bunch of "casper" related warnings. I can't seem to save those logs though, so I'm unable to provide them at this time. My current default kernel arguments are:

label ubnentry1
menu label ^Try Ubuntu without installing
kernel /casper/vmlinuz.efi
append initrd=/casper/initrd.lz file=/cdrom/preseed/ubuntu.seed boot=casper  quiet splash -- persistent

How can I go about resolving this issue?

Thank you.

Best Answer

As mentioned in the previous comment, this is related to the bug https://bugs.launchpad.net/ubuntu/+source/casper/+bug/1489855 "the sequence of mounting changed from root partition then persistent partition (15.04) to 1st persistent then root partition (16.04) for whatever reason."

There is a work around recently updated in the thread for the bug, which I will elaborate on below as the other thread doesn't seem to have as much visibility (comes up lower in the google search when I was trying to work it out).

  1. Create partitions casper-rw and OS

  2. Use universal USB installer, etc to set up the OS partition with casper-rw file large enough to be able to make changes - needed for later step to workaround bug (I did it with 2gb, but surely it requires less)

  3. Boot up with the new USB. Open /usr/share/initramfs-tools/scripts/casper with root to edit (sudo). Change the function setup_unionfs() to the following : https://launchpadlibrarian.net/258626969/casper%20function.txt

  4. sudo update-initramfs -u (Had to uninstall cryptsetup to do this)

  5. Copy the generated initrd.img file from /boot to another location.

  6. From another OS, delete the casper-rw file in the USB. Copy the initrd.img back to the live partition and change menu item to use the newly built initrd.img.

The next time you boot up from USB, it should now bootup from the casper-rw partition.

This worked for me for 16.04 after a long frustrating time searching for the solution!

Related Question