What is nice about recent Ubuntu distribution is that you can create a bootable USB drive from the downloaded image and run Ubuntu directly from the USB drive without installing it (Live USB). When you’re creating the bootable drive, you often have the choice of data persistence across live session. Without persistence option enable, the files create and packages installed on the file system / will be lost next time you boot into the system using the USB drive. With persistence, these settings will be saved.

Recently I’ve created a bootable drive with persistence enable, but found that my files and packages are lost after reboots. After some research, I found that this is a bug in Ubuntu Live USB creator that for newer computer with UEFI (or EFI). See references below for details of the bug.

Digging deeper I found that for non-UEFI the OS is initialized with syslinux.cfg, persistence is enabled as follows:

...

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

...

For UEFI computers, the system is initialized with Grub, but persistence flag is not set in /boot/grub/grub.cfg. What worked for me is to add the persistence flag to the line that starts with linux as follows:

...
menuentry "Try Ubuntu without installing" {
        set gfxpayload=keep
        linux   /casper/vmlinuz.efi  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash -- persistent
        initrd  /casper/initrd.lz
}
...

Although I was able to persist my settings, I was a bit disappointed with the performance of the system after the setting is enabled. I think I’ll explore other alternatives of portable Linux with better performance.

The version of Ubuntu is 13.10 64-bit version.

References:

  1. [SOLVED] how to fix bug 1159016 (can’t make 13.10 Live USB persistent)
  2. 64 bit live-USB successfully boots, but without persistence on UEFI pc
  3. Persistent file NOT working for 13.04