{"id":273,"date":"2016-09-29T15:59:47","date_gmt":"2016-09-29T15:59:47","guid":{"rendered":"http:\/\/perfectionatic.org\/?p=273"},"modified":"2016-09-29T15:59:47","modified_gmt":"2016-09-29T15:59:47","slug":"making-your-own-persistent-usb-bootable-ubuntu-distro-the-easy-way","status":"publish","type":"post","link":"https:\/\/perfectionatic.org\/?p=273","title":{"rendered":"Making your own persistent  USB bootable  Ubuntu Distro: the easy way"},"content":{"rendered":"<p>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&#8230;<\/p>\n<h2>PinguyBuilder to the rescue<\/h2>\n<p>So after a number of false starts. I stumbled upon <a href=\"http:\/\/pinguyos.com\/2015\/09\/pinguy-builder-an-app-to-backupremix-buntu\/\">PinguyBuilder<\/a>. I followed the excellent instructions at <a href=\"https:\/\/www.maketecheasier.com\/pinguy-builder\/\">maketecheasier<\/a>, with the slight modification of checking the PinguyBuilder site for the the latest version. I used the <em>backup<\/em> option to get all the tweaks on home directory, and my none <code>deb<\/code> packages in. My Ubuntu was a derivative the standard Xubuntu 16.04 distro.<\/p>\n<h2>Moving the ISO to the USB<\/h2>\n<p>The generated <code>iso<\/code> file could then be installed <code>usb-creator-gtk<\/code>, or if are working on windows, <a href=\"https:\/\/rufus.akeo.ie\/\">Rufus<\/a>. 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!<\/p>\n<h2>Making the USB persistent<\/h2>\n<p>First I need to create <code>casper-rw<\/code> 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 <a href=\"http:\/\/unix.stackexchange.com\/questions\/122832\/how-to-use-casper-rw-file-for-persistance\">StackExchange post<\/a>:<\/p>\n<p>I created an empty 2GB file<\/p>\n<pre lang=\"bash\">\ndd if=\/dev\/zero of=casper-rw bs=1M count=2048\n<\/pre>\n<p>You can changed <code>count<\/code> to whatever size of persistent storage you want. I then had to format that space into something that Linux would be able to read<\/p>\n<pre lang=\"bash\">\nmkfs.ext4 -F casper-rw\n<\/pre>\n<p>The next step was to change <code>\/boot\/grub\/grub.cfg<\/code> file on the USB to have the following menu-entry at the beginning.<\/p>\n<pre lang=\"bash\">\nmenuentry \"Xubuntu in persistent mode\" {\n    set gfxpayload=keep\n    linux   \/casper\/vmlinuz  file=\/cdrom\/preseed\/custom.seed boot=casper persistent iso-scan\/filename=${iso_path} quiet splash --\n    initrd  \/casper\/initrd.gz\n}\n<\/pre>\n<p>Finally, I modified <code>\/isolinux\/isolinux.cfg<\/code> to include the extra label<\/p>\n<pre lang=\"bash\">\nlabel persistent \n  menu label live - boot the Live System\n  kernel \/casper\/vmlinuz\n  append  file=\/cdrom\/preseed\/custom.seed boot=casper persistent initrd=\/casper\/initrd.gz quiet splash --\n<\/pre>\n<p>et voil\u00e0!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; PinguyBuilder to the rescue So after a number of false starts. I stumbled upon PinguyBuilder. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[76,77,79,78],"class_list":["post-273","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-linux","tag-ubunut","tag-usb","tag-xubuntu"],"_links":{"self":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=273"}],"version-history":[{"count":18,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts\/273\/revisions"}],"predecessor-version":[{"id":291,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts\/273\/revisions\/291"}],"wp:attachment":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}