10

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.

  • Try using: unetbootin – SudoSURoot Aug 24 '15 at 23:36
  • @SudoSURoot I mentioned that I've used this tool in the post above. – Cloud Aug 25 '15 at 0:20
  • 1
    Are you using a Gigabyte motherboard. They require IOMMU settings in UEFI/BIOS and/or boot parameters to work. ubuntuforums.org/showthread.php?t=2292025 – oldfred Aug 25 '15 at 17:27
  • 1
    I have the same problem and I tried booting on different computers (Intel NUC and Thinkpad). Eventually, I recreated the casper-rw file and labelled the extra partition home-rw. This time, it seems to work well... – vmalep Jan 3 '16 at 11:33
  • 1
    Since 14.04 home-rw only seems to save data in home folders including Desktop, Documents, Downloads, Music, etc. If it is the first persistent partition to boot it will also save desktop background but not wireless password, etc. home-rw is not equivalent to /home in a Full install. – C.S.Cameron Nov 16 '16 at 4:03
8

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!

  • 1
    Please add more details in the fifth step. You say you delete and then boot it ? – userDepth Jun 24 '16 at 11:25
  • @userDepth boot into Windows or another OS (not the new live USB you are creating) and plug in your new USB. Delete the casper-rw file. Then shutdown and boot up from the new usb, it should automatically be saving changes to the casper-rw partition from now on. – yujia21 Aug 30 '16 at 1:48
  • Hi Yu, I have tried this on 16.04 64-bit image and it is not working.. Can you explain what do you mean by Had to uninstall cryptsetup to do this ? – kirtan403 Aug 30 '16 at 11:23
  • Step 4 gave me a couple of warnings.. But i didn't capture those.. And it failed.. I am redoing it to give this another chance – kirtan403 Aug 30 '16 at 11:30
  • No warnings.. Didn't work.. Again stuck at the BusyBox screen.. – kirtan403 Aug 30 '16 at 12:02
4

Updates to Yu Jia's answer... Thanks Yu Jia for pointing to the right direction.

1) Use casper-rw file first to avoid the casper-rw partition issue. 500MB or less is good enough.

2) 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

3) sudo update-initramfs -u (warning from cryptsetup, but can be safely ignored.)

4) Copy the generated "initrd.img.4.4....generic" file from /boot to another location. Rename it to initrd.img.

5) From another OS, delete the casper-rw file in the USB.

6) Copy the initrd.img back to the live partition and change menu item to use the newly built initrd.img. e.g.

label ubnentry1
menu label ^Ubuntu 16.04
kernel /casper/vmlinuz.efi
append initrd=/newly_generated_initrd.img file=/cdrom/preseed/ubuntu.seed boot=casper  quiet splash -- persistent
  • Hmm, your answer is sufficiently similar to Yu Jia's that I think you should suggest an edit to her answer instead of writing your own answer. – edwinksl Aug 31 '16 at 1:17
4

mkusb version 11 classic and version 12 alias mkusb-dus can create a persistent live drive automatically with all current Ubuntu versions and flavours, as well as with Debian Jessie.

mkusb uses a casper-rw partition

mkusb works with some linux distros derived from Ubuntu too. I have not tested with the newest Linux Mint versions, but it works with previous versions because the boot structure is/was similar enough to Ubuntu.

enter image description here

Install mkusb with the following command lines in Ubuntu and flavours of Ubuntu (Kubuntu, Lubuntu ... Xubuntu).

If you run standard Ubuntu, you need an extra instruction to get the repository Universe. (Kubuntu, Lubuntu ... Xubuntu have the repository Universe activated automatically.)

sudo add-apt-repository universe  # only for standard Ubuntu

sudo add-apt-repository ppa:mkusb/ppa  # and press Enter
sudo apt-get update
sudo apt-get install mkusb mkusb-nox usb-pack-efi

See these links,

mkUSB-quick-start-manual.pdf

help.ubuntu.com/community/mkusb

help.ubuntu.com/community/mkusb/persistent

help.ubuntu.com/community/mkusb/install-to-debian

Downloading and using mkusb-installer works with several other linux distros. Use one of the following links (and methods),

help.ubuntu.com/community/mkusb/gui#from_phillw.net

help.ubuntu.com/community/mkusb/gui/tarball

  • 1
    +1 mkusb just has one check box to make usb live disk persistent, ie what you setup in today's session in still there when you reboot. – WinEunuuchs2Unix Jan 23 '18 at 5:09
  • Yep, mkusb works. I tried with Ubuntu 17.10 and did not have much success with www.pendrivelinux.com for more than 4 GB persistent storage (is really needed for getting updates, etc. (at least for temporary storage during the update process)). On a 16 GB USB flash drive the /cow is at about 10.5 GB (casper-rw partition, not file) and currently has 36% usage after an update and other use. – Peter Mortensen Jan 25 '18 at 1:43
2

I did not have any problem creating the pendrive and booting it... Did you create the perndrive as follows?

The process involves 3 steps:

  1. Partitioning the pendrive.
  2. Making a bootable pendrive using Universal USB Installer.
  3. Adding Flags to the UUI partition and Completing the partitioning process.

Step 1:

Open GParted and partition the pendrive as follows-

enter image description here

Unallocated partition is added later in step3, sdc2 is for Ubuntu and sdc3 is for persistence. Since this is an 8GB pendrive, I used 3.32GB as persistent drive but will work with any size. Label this partition as casper-rw.

Step 2:

Insert the pendrive in a Windows Machine. The second drive (ie label-OS) will be detected. Install Ubuntu in this drive using Universal USB Installer.

enter image description here

Set a small persistent file, I used 204MB. The size does not matter since we'll delete it in step 3 anyhow. Press Create.

Step 3:

Insert the pendrive back in an Ubuntu System and alter the partition table as follows-

enter image description here

Now for the final part, Right Click on 2nd partition and select Manage Flags. Check Boot and lba.


Now you have a pendrive whose first partition will be detected in windows and a persistent drive that is larger than 4GB.

enter image description here

enter image description here

  • 2
    Persistent partitions work fine with SDC / Unetbootin 32 bit installs, but not with 64 bit installs for 14.04 and later. 64 bit grub2 / iso, (multiboot type), installs work with persistent casper-rw partitions. – C.S.Cameron Feb 8 '16 at 3:56
2

Your question is related to this bug: https://bugs.launchpad.net/bugs/1489855

An older release of the 14.04 LTS would work.

  • 14.04.2 works
  • 14.04.3 fails
  • 14.04.4 fails

Also:

  • 15.04 works
  • 15.10 fails
2

I just managed to achieve this with a LOT of help from this very helpful set of answers.

For reference, I was setting up a 16 GB Kingston Data Traveller with a custom ISO image that I had previously built using SystemBack.

The OS I am working on is Lubuntu, and my custom ISO had a lot of software package changes (I removed a lot of gumpf and installed some necessary utilities).

I started out by using araghuteja's very useful set of instructions and set up my device with three partitions:

  • 4 GB for the Windows accessible FAT32 partition (/dev/sdc1)
  • 2 GB for the OS (/dev/sdc2)
  • The rest (under 8 GB, but approximately that) as the casper-rw partition (/dev/sdc3)

This unfortunately didn't quite work, as just removing the casper-rw file from the OS partition isn't quite enough.

The real help was from Yu Jia Cheong, and StarBloom where they explain how to reset the GRUB bootloader to 'see' the casper-rw partition.

I did have to make some details that may make Yu Jia's instructions a bit clearer. (Please note, these instructions may not be fully appropriate for default Ubuntu ISO image as I think some of the file locations may be altered by the Systemback configuration).

Specifically - on Part 5, the file generated by

sudo update-initramfs -u

was named initrd.img-4.4.0-47-generic.

So - I copied this file to my 'casper-rw' partition, but then I realised that my GRUB boot menu looked was referencing /casper/initrd.gz (in four places) which resides within /boot/grub on the UUI partition.

So - I renamed my initrd.img-4.4.0-47-generic to initrd.gz, and replaced the file in UUI/boot/grub/casper/ (obviously retaining a copy of the old file just in case!).

Booted up with that particular USB stick and using df -h in the 'machine' root folder I get the following:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G  4.0K   16G   1% /dev
tmpfs           3.2G  1.6M  3.2G   1% /run
/dev/sdb1       2.0G  1.3G  729M  65% /cdrom
/dev/loop0      1.3G  1.3G     0 100% /rofs
/cow            8.2G  118M  7.7G   2% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
tmpfs            16G  4.0K   16G   1% /tmp
none            5.0M     0  5.0M   0% /run/lock
none             16G     0   16G   0% /run/shm
none            100M   16K  100M   1% /run/user
/dev/sdb3       4.0G  4.0K  4.0G   1% /media/silver/DATA
/dev/sdb2       8.2G  118M  7.7G   2% /media/silver/casper-rw

I assume /cow is the casper live partition, and it is showing the correct size.

I find it interesting that I can actually SEE the casper-rw partition as /dev/sdb2 when I'm using the machine - is this correct??

I'm also not convinced about the 3-way partitioning. In Windows(10) I can only see the OS partition, not the Data partition.

Many thanks to all, and I hope my experience helps someone else! (Note - I'm a sufficiently new to Stack Exchange usage that I can't comment - hence my answer is new, rather than a comment on Yu Jia's).

Update

I'm trying this again to create another 'Pen-Machine' and I've realised that the larger your ISO image, the more room you need to create for the casper-rw file when you run the UUInstaller.

My latest ISO image is something like 3.8 GB (it's a customised Ubuntu 16.04) and after three tries I have to create the initial OS partition at 5 GB and use a 1 GB persistence setting in the installer - otherwise you run out of storage when updating the initramfs functions.

Note - I finally resorted to setting the OS partition at 8 GB, just to make sure I had room!

1

It's seems to be the booting process interrupted just after loading the initial RAM disk. This is due to the failure to mount the root file system (filesystem.squashfs). As everything works fine before editing the partition one or more of the following may be the reason for the failure.

  • Change of UUID.
  • Corrupted file(s) (filesystem.squashfs, vmlinuz)
  • Corrupted filesystem

Try:

  • Format the boot partition (with ext3) (now you have three partitions as earlier).
  • Recreate the live system using UNetbootin with the persistence option.
  • Delete the persistence file (so that it uses persistence partition)
1

I have been having a similar problem with the Lubuntu 14.04.3 i386 ISO image and gave up. I then tried the Lubuntu 15.04 AMD64 ISO image (I had earlier given up on 15.04 because of a bug that occurs at bootup, but it turns out to be only a small issue*).

The casper-rw partition works fine with the later system (following the usual instructions), so it seems the problem is nothing to do with process, but to do with a problem specific to some 14.04 ISO images.

I had previously successfully installed a Lubuntu 14.04 system with a casper-rw persistent partition, so I know the original 14.04 did work. So it may be just 14.04.3 that is the problem?

* If you do use 15.04 and come across the problem "Missing parameter in configuration file ..." at boot then type "live" and enter.

protected by Community Feb 20 '17 at 6:40

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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