Monday, March 17, 2008

Customised Xubuntu on USB Flash

I spent my holidays doing quite a few things. Making my own USB Flash drive portable Linux setup was one of them. I'm on the customised Xubuntu setup right now, in fact.

I started off with Ubuntu 7.10, already installed on my machine. Then I installed the Ubuntu Customization Kit via Synaptic. Torrenting a copy of Xubuntu 7.10 ISO, and I was ready to get to work. (I wanted to install the Xfce desktop environment with a stock Ubuntu 7.10 image, but in reality, getting that to fit in the space restraints was more work that it was worth.)

I then proceeded to customise the Xubuntu ISO by running UCK. Unfortunately, for Xubuntu, it'll download, which is big, bulky and already has a substitute on Xubuntu. If I had the patience to manually unpack the SquashFS image, chroot to the extracted file system's root and do the work manually, I'd do that instead in future.

After that, I had previously selected the option to customise the image, so the prompt to do that appeared at this point. Picking what I wanted was easy using Synaptic. I wanted to focus on getting some useful work done on the go, so amongst my package choices were:
  • sbcl
  • emacs
  • slime
  • git
  • subversion
  • emacs-w3m
  • build-essential (for basic C and C++ support)
  • vim
  • mzscheme
  • muse-el
  • 7zip
Emacs and vim? It's easier to do quick editing with vim, but I use emacs the rest of the time.

sbcl and mzscheme? I'm mostly learning Common Lisp, but with the release of Paul Graham's arc, the option of playing around with it was just too tempting to pass up.

git and Subversion? I prefer using git, but Subversion is what's used at my uni, so my portable distro wouldn't be worth much without it.

Confusingly conflicting package choices aside, all that stuff was still smaller than, which I never really liked anyway. Extraneous language packs also went away, along with a bunch of other miscellaneous things I never used.

From there, I let UCK do its job and repack the SquashFS tree, and was soon rewarded with a shiny new ISO. I backed that up in case I needed it again. At this point I could have burned it to a CD, but that wasn't what I was after.

Now for the USB Flash drive bit. I followed the instructions at USB Pen Drive Linux, with some adaptations. Since I already had Ubuntu as my desktop OS, I was able to format the Flash drive from my own terminal. Since I only needed the files from the ISO, I could just mount it like this:

$ cd /mnt/
$ sudo mkdir iso
$ sudo mount -o ro,loop -t iso9660 that_xubuntu_image.iso /mnt/iso

That made the ISO's files accessible from /mnt/iso/. The copying of the files was straightforward, and I just ignored any missing files.

One thing that isn't made clear on the USB Pen Drive Linux site is that if the USB Flash device hasn't already been made bootable in some way, you'll need to follow the instructions at the bottom of the page.

And that was it. I can pretty much take my desktop with me now, and any work that I save under this environment will be preserved. Funky, huh?

No comments: