Making your own persistent USB bootable Ubuntu Distro: the easy way
I had a recent Ubuntu install with customizations that I wanted to be able to put it on a USB, boot into it on another machine and be able to modify its contents by, installing new packages, editing files, etc…
PinguyBuilder to the rescue
So after a number of false starts. I stumbled upon PinguyBuilder. I followed the excellent instructions at maketecheasier, with the slight modification of checking the PinguyBuilder site for the the latest version. I used the backup option to get all the tweaks on home directory, and my none deb
packages in. My Ubuntu was a derivative the standard Xubuntu 16.04 distro.
Moving the ISO to the USB
The generated iso
file could then be installed usb-creator-gtk
, or if are working on windows, Rufus. At this point I could nicely boot using my USB stick. I could not, however, write anything persistently on the USB. If I create some file, and then reboot, it would be gone!
Making the USB persistent
First I need to create casper-rw
file that would be identified by boot-loader as space to write on. I was happy with 2GB, so this what I did by adopting the instructions on StackExchange post:
I created an empty 2GB file
dd if=/dev/zero of=casper-rw bs=1M count=2048
You can changed count
to whatever size of persistent storage you want. I then had to format that space into something that Linux would be able to read
mkfs.ext4 -F casper-rw
The next step was to change /boot/grub/grub.cfg
file on the USB to have the following menu-entry at the beginning.
menuentry "Xubuntu in persistent mode" { set gfxpayload=keep linux /casper/vmlinuz file=/cdrom/preseed/custom.seed boot=casper persistent iso-scan/filename=${iso_path} quiet splash -- initrd /casper/initrd.gz }
Finally, I modified /isolinux/isolinux.cfg
to include the extra label
label persistent menu label live - boot the Live System kernel /casper/vmlinuz append file=/cdrom/preseed/custom.seed boot=casper persistent initrd=/casper/initrd.gz quiet splash --
et voilĂ !