# Persistent file NOT working for 13.04

I successfully installed 13.04 (64) on a WD "My Passport" (1 Tb) without any bumps in the road. Works great... So I wanted to stream line it a bit more and try the "LiveUSB" on a 16 Gb thumb drive.

I used 4 different USB installers, last was Unetbootin (including Ubuntu startup). I set the persistent file at 4 Gb to allow for a complete setup. NONE have set the persistent file correctly (that is my guess), as NONE of my changes are saved.

I've read several answers to this problem ALL of which had no relevant info (dead ends) or what was said was already present. Such as edit the syslinux.cfg file for -- persistent.

My GUESS is that it has to do with "Permissions", tried setting up a user as Administrator, it too failed to save. It seems to me that if they are now using SSDD to replace mechanical HDD, then thumbs drives should work for a standard load/install...

Please note have searched the writers sites for "Support" with ZERO results.

I formatted the drive "fat32"

Here are the drive files;

01/17/2013  12:06 PM         1,345,530 ubnkern
04/24/2013  01:10 PM        22,252,127 ubninit
05/06/2013  02:08 PM    <DIR>          .disk
05/06/2013  02:08 PM    <DIR>          EFI
05/06/2013  02:08 PM    <DIR>          boot
05/06/2013  02:08 PM    <DIR>          casper
05/06/2013  02:08 PM    <DIR>          dists
05/06/2013  02:08 PM    <DIR>          install
05/06/2013  02:08 PM    <DIR>          isolinux
05/06/2013  02:08 PM    <DIR>          pics
05/06/2013  02:08 PM    <DIR>          pool
05/06/2013  02:08 PM    <DIR>          preseed
05/06/2013  02:08 PM             1,053 ubnpathl.txt
04/24/2013  02:23 PM               134 autorun.inf
04/24/2013  02:25 PM            18,354 md5sum.txt
04/23/2013  10:10 AM         2,559,512 wubi.exe
05/06/2013  02:11 PM            11,694 ubnfilel.txt
>> 05/06/2013  02:11 PM             1,880 syslinux.cfg
>> 05/06/2013  02:24 PM     4,294,963,200 casper-rw


As you can see, the casper-rw is there.

Also, here is the syslinux.cfg file contents;

default menu.c32
prompt 0
timeout 100

label unetbootindefault
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash -- persistent

label ubnentry0
kernel /ubnkern
append initrd=/ubninit  persistent

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

label ubnentry2
kernel /casper/vmlinuz.efi
append initrd=/casper/initrd.lz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity  quiet splash -- persistent

label ubnentry3
menu label ^Check disc for defects
kernel /casper/vmlinuz.efi
append initrd=/casper/initrd.lz boot=casper integrity-check  quiet splash -- persistent

label ubnentry4
kernel /install/mt86plus
append initrd=/ubninit  persistent

label ubnentry5
menu label ^Boot from first hard disk
kernel /ubnkern
append initrd=/ubninit  persistent

label ubnentry6
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

label ubnentry7
kernel /casper/vmlinuz.efi
append initrd=/casper/initrd.lz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash -- persistent

label ubnentry8
menu label OEM install (for manufacturers)
kernel /casper/vmlinuz.efi
append initrd=/casper/initrd.lz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash oem-config/enable=true -- persistent

label ubnentry9
menu label Check disc for defects
kernel /casper/vmlinuz.efi
append initrd=/casper/initrd.lz boot=casper integrity-check quiet splash -- persistent


Here is an idea I had, should these "casper" references read casper-rw?

Edit #3

Here is the "Grub.cfg" file contents;

if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi

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

linux   /casper/vmlinuz.efi  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash --
initrd  /casper/initrd.lz
}

menuentry "OEM install (for manufacturers)" {
linux   /casper/vmlinuz.efi  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash oem-config/enable=true --
initrd  /casper/initrd.lz
}

menuentry "Check disc for defects" {
linux   /casper/vmlinuz.efi  boot=casper integrity-check quiet splash --
initrd  /casper/initrd.lz
}


Ok, this boots straight to the desktop, no prompts for login (NATCH). I'm thinking GRUB is the problem. Here is the sequence for boot;

2. Select EFI USB
3. Then there are 4 choices from Grub (I believe), they are;
4. Try Ubuntu (without installing)
5. Install Ubuntu
6. OEM Install
7. Check Disc

Natch I am choosing "Try". AND I think that is the real issue. Efforts to create user fail after reboot. Nothing seems to be saved/written to the casper-rw file.

There are 9 items in the syslinux.cfg, Grub shows 4...

-
The casper folder contains the SquashFS filesystem that contains the actual system, initrd (boot files), the kernel, and a couple other metadata files that help make for a smooth installation. The casper-rw file on the root basically is set to "overlay" the filesystem that is loaded from /casper/filesystem.squasfs. This "overlay" applies all changes (deletions, new files, modified files, etc) that occured between the filesystem.squasfs (original) filesystem and the casper-rw filesystem (the persistent filesystem). –  Githlar May 6 '13 at 22:25
Did you use unetbotin to install this version? I'm a bit curious as to a) what these ubn* files are and b) why the syslinux.conf file is on the root. Here's something to check: you may have to modify the grub.cnf that is contained in /boot/grub to also include the persistent option as it may be booting from GRUB somehow (the exact details of when each of them is used escapes me). Alternatively, you can manually add a kernel option at boot time by hitting a button when you see the guy with a keyboard. When the menu pops up hit F6. You should see your persistent in there, if not add it. –  Githlar May 6 '13 at 22:31

If you are on a secure/uefi boot machine, you are possibly experiencing bug 1159016. The uefi machines use grub instead of syslinux, so the workaound until a fix is made is to edit the stick/s /boot/grub/grub.cfg and add the word "persistent" to the kernel lines.

-
Hm, I never considered this possibility. Thanks for the info, I'm getting a UEFI machine soon, so I'll keep this bug on my radar. –  Githlar May 7 '13 at 0:52
hmmm, lemme look at that... –  Robert Blackney May 7 '13 at 0:57
Like I said, STILL a noob, which is the kernel lines? –  Robert Blackney May 7 '13 at 1:00
Is this what to add to? ^ initrd /casper/initrd.lz ^ Adding -- persistent ^ Really appreciate the help... –  Robert Blackney May 7 '13 at 1:03
Doh!! Ok, read the bug, found it, thanx! –  Robert Blackney May 7 '13 at 1:09

This doesn't really fit into the scope of my previous answer, so I'm making a new one.

OK, so you use Unetbootin to create your USB stick. Looking at your syslinux.conf it looks kind of mangled, yet you said you could get into a working Ubuntu.

Well, to get rid of the extra variables added by using Unetbootin, etc. to make a disk, we're going to do the real way of creating a BootUSB.

Since late 2010, Ubuntu has been shipping as what is called a "Hybrid ISO." A hyrid ISO is a hybrid between a HDD image and a CD image. Basically, it's a CD ROM with a 512-btye bootloader at the beginning so that it can be booted as a hard drive as well.

What does this mean for you? This means that you can directly copy the CD image onto the USB drive and have yourself a fully bootable Ubuntu USB drive.

NOTE: Using dd to create a disk will erase everything on it. Back up anything you want to save (and your casper-rw file, since it doesn't exist on the CD)!

Windows:

EDIT: There is actually an easier method to do this, that is much less technical. You could simply download the Win32 Disk Imager, which was made by Ubuntu developers to do the same thing that dd for Windows does, just in a much simpler fashion. It's pretty intuitive. If you opt to go that route, just download it from the link provided and skip to the last section.

Windows doesn't have the native capability to directly copy a file to a hard drive like we need to, so the first thing you need to do is to download dd for Windows (I used version 0.5 for my tests).

To ensure the safety of your HDD, you should rename the file from dd.exe to dd-removable.exe. This will make sure that dd will only work on removable disks.

Moving on, you first need to figure out which drive you are going to be copying the image to.

First, open up a command prompt Ctrl+R, enter "cmd" and press enter.

From here you want to cd into the directory that you saved the dd program under. For me, this was Desktop. For you, this might be Downloads.

cd Desktop


Now, you want DD to give you a list of all the devices

dd --list


This will print out a list of all devices. You're looking for one that says "Removable media." (I believe, my VM test case still shows it as a fixed disk which shouldn't be the case).

Of all the entries that say "Removable media.", you want to find the one that is the same size of your hard drive. This might be a bit difficult as it is in bytes, but the general formula is 1 billion per 1 gigabyte. It's no guarantee, but it should be the last one in the list.

Once you have located which disk number your had drive is, you'll want to go ahead and copy the file to the USB disk! You will run a command similar to this:

dd if=C:\path\to\ubuntu\ISO of=\\?\Harddisk2\Partition0


It's important to note that it is always Partition0, the variable here is which "Harddisk" number to use. In my case, I had one virtual booting hard drive (which should be Harddisk1 by default), and had one USB virtual disk which ended up being Harddisk1.

Linux:

First determine your flash drive's device name:

mount

In the list you should see something that says something such as /media/????-???? each '?' is a number or letter from A-F. If you have more than one of these, the CD to /media and figure out which one has the files from your USB. If it's 0000-FFFF, then look for that entry in the mount command. It should say something like "/dev/sdb1 mounted on /media/0000-FFFF". The important thing to note here is the "/dev/sdb1"

So, if the output you get is "/dev/sdb1", then the drive device is /dev/sdb -- simply remove the number off the end.

Be sure you do your backups as noted above before running the next commands.

sudo umount /dev/sdb1 #unmount your flash drive
sudo dd if=/path/to/ubuntu/iso of=/dev/sdb #write the file to the flash drive


Both:

Once the command completes you should have a bootable Ubuntu without all the extra stuff added by Unetbootin or whatever program. It's a pure Ubuntu disk as if it had been done off a CD-ROM.

Before you put your backed-up files back on, you're going to need to resize the partition by using the Windows Disk Utility (under the Adminitrative Tools->Computer Management in the control panel) or Gparted.

Once you have your functioning disk, you can then edit /boot/grub/menu.cnf and (I believe it is) /isolinux/txt.cfg and append the "persist" option and drop your backed-up casper-rw into the root of the drive.

-
Githlar, please see UbFan1 fix, was the resolution. Thanx for your help, I really DO appreciate it... –  Robert Blackney May 7 '13 at 3:17
Be sure you mark his answer as the chosen answer. –  Githlar May 7 '13 at 7:18

I've made many, many live customizations to Ubuntu, granted it's been a while. I remember the day when you had to set up persistence manually.

• I see you have the persistent kernel option, that's the first step. Just to be safe, you should also add persistent to the other boot entries (other than "Memory Test" and "Boot from first hard disk").
• You should be using a FAT-based file system for your USB disk.
• The file that is persistent has to be named casper-rw and has to exist on the root of the drive

If you have no such casper-rw file, then that's your problem. I will guide you through creating one through the Ubuntu LiveUSB itself.

First thing is, when you boot the LiveUSB and get to the desktop, open a terminal and type

mount -o remount,rw /cdrom #(/cdrom is actually your USB disk when using a USB).


Since FAT-based filesystems can't create sparse files, we're going to have to wait on dd to make a full 4GB file:

dd if=/dev/zero of=/cdrom/casper-rw bs=1M count=4096


This will make a 4 gig (or close enough, not sure if dd uses binary or decimal notation for Megs) file called casper-rw on the root of your drive.

The final step is to make an ext2 filesystem within this file. Fancy!

mkfs.ext2 -F /cdrom/casper-rw


Now, when you reboot you should boot into a working and persistent live USB installation.

EDIT: In response to my below comment, it appears that nothing has changed regarding loading the persistence file. The only caveat is that for it to work it MUST be at the root of a FAT filesystem (that is, the filesystem has to be loaded with the vfat driver. This means FAT16, or FAT32). To my knowledge exFAT will not work.

EDIT 2: Just researched exFAT linux support. Currently, exFAT needs to be mounted using a FUSE extension, and is not supported by the vfat driver, so it will not work.

EDIT 3: OK, so you do have the casper-rw. Intriguing. So, somewhere along the line it is not booting with the persistent option. Now, I know that it used to be when you saw the icon for the guy with a keyboard under him you had to hit a key. Otherwise, it would boot with the "maybe-ubquity" kernel option. However, I'm not sure where the splash scree was getting the rest of its boot flags from (it's written in PostScript for gfxboot. Utterly horrible to try to decipher), if it was at all. So, not pressing any key when it boots up may invalidate changes you've made to grub.cnf or syslinux.conf.

EDIT 4: I'm going through the gfxboot-theme-ubuntu code right now, and it appears that it pulls all of its command lines directly from syslinux.conf -- even if it exists in root. However, which syslinux.conf entry it appends "maybe-uquity" to and executes if no key is pressed is something that I'm still trying to decipher.

-
I'm actually going to verify my answer for 13.04 by having a look at the initrd.lz in 13.04 -- bear with me. –  Githlar May 6 '13 at 21:42
Thanx, I've edited and added information... –  Robert Blackney May 6 '13 at 22:13
Yes, this is; Ubuntu 13.04 64amd Unetbootin used to make 16 Gb LiveUSB thumb (unetbootin-windows-583) –  Robert Blackney May 6 '13 at 22:50
OK, if I remember correctly, Unetbootin puts all of it's configuration on the root. Moving along. Try my suggestion in Edit 3 –  Githlar May 6 '13 at 23:02
Sorry, never see a guy with kybd, Grub to Desktop (Edit #4). Tried F6 at Grub, nothing... –  Robert Blackney May 6 '13 at 23:49

I had this problem with 13.04 just now, and fixed it by editing boot/grub/grub.cfg and adding persistent to the commandline.

I note in your post that you've added that keyword AFTER the --, which may be the problem there, since the -- means 'there are no more kernel options after this point'. You can check the options that your kernel actually booted with by looking at the contents of /proc/cmdline

So instead of "-- persistent", try "persistent --".

One other thing I noticed is that when persistence is working (other than things surviving a reboot), the casper-rw file gets mounted, and shows up as a volume in unity on the left.

-