Tested with 22.04 and 24.04 Xubuntu
Situation: You want to point Virtualbox or VMWare or whatever to the Live CD ISO and setup a small virtual hard drive (or even USB key) to act as persistence.
There’s a load of stupid complicated guides out there when the process is actually stupidly simple as many of these things are, if a little sneaky.
Step 1: Download the Distribution’s Standard Live CD
Yes, just the normal live CD
https://ubuntu.com/download/desktop
https://xubuntu.org/download/
Step 2: Create Your Virtual Machine (If You’re Going To Use One)
So just create your virtualbox virtual machine, or build your target computer or whatever it is you’re going to run this on.
NB: In virtualbox be sure to tick the “Live CD/DVD” checkbox when you set the CD image (in Settings > Storage), this prevents it from being “ejected”.
For your persistent drive, just make a virtual disk or use a physical USB drive, or internal hard drive, or whatever, if it’s something that you can create a filesystem on, you can use it.
Step 3: Create a Filesystem On Your Persistent Disk
Boot up the target computer/vm using the Live CD, Open the disks utility (or whatever partition editor you like), and do the needful to create an EXT4 partition on that persistent disk, you must call that partition, that is give it the label, “writable” (in 22.04, in older, or possibly other distros, call it “casper-rw”).
Step 4: Test It
Reboot with that livecd again, and this time hit “e” at the grub prompt, the grub prompt editing changed between 22.04 to 24.04,
- If you see “maybe-ubiquity” replace that with “persistent”;
- If you see “quiet splash” replace that with “persistent”
Hit F10 to continue booting.
Note that the “quiet splash” replacement means that you won’t see a splash screen while booting, just a lot of boot messages scrolling by, it’s fine.
You should have a persistent setup now, create a folder on the desktop, reboot again doing that same grub edit, and make sure it comes back.
Step 5: Make It Not Require Grub Edit Each Time
Oh man, this is super kludgey, but hey it works, take your ISO image, make a copy, and now edit that copy in a hex editor (eg hexedit),
* If in step 4 you replaced “maybe-ubiquity”
search for the string “maybe-ubiquity” and replace it with the string “persistent “ (4 spaces, to keep them the same length), it appears a few times in the first part of the iso.
* If in step 4 you replaced “quiet splash”
search for the string “quiet splash” and replace it with the string “persistent “ (2 spaces, to keep them the same length), it appears a few times in the first part of the iso.
Save it, attach it to your VM or burn it or whatever, and then boot that. Job. Done.