Recently, I was given a laptop on which I couldn’t install any software on the hard drive. Fortunately, this laptop has the ability to boot on USB devices and I happened to have a 8GB USB flash drive (which is, for the records, largely enough to install a Linux Live system on). To add extra complexity, I was required to use a tool (namely a patched version of NTT Docomo’s SEND implementation (that you can find here)) that is provided by Debian packages (.deb) for the SID version of Debian.
To sum up my requirements, I needed:
- bootable system (on a USB flash drive)
- Debian Linux (SID version)
- possibility to store modifications to the system (persistence of the data)
- bootable ISO
- netboot image
- bootable USB image (which is what I’m interested in here)
$ lh_config -b usb-hdd --mirror-bootstrap "http://debian.mymirror.tld/debian"\ -p gnome --packages "nfqueue-bindings-python libnetfilter-queue1 iceweasel radvd sshfs less wireshark vim xterm socat" -d sid --bootappend-live "keyb=fr" $ lh_build
- -b: selects the type of bootable image. USB image, net bootable image, ISO, etc.
- –mirror-bootstrap: points to the debian repository where required packages should be fetched.
- -p: defines a meta-set of packages. In practice, it is more collection of packages for a specific desktop environment. For example, gnome, kde, xfce, etc.
- –packages: lists the extra packages you want to include in your image. Here, I needed some dependencies for NTT Docomo’s SEND implementation.
- -d: defines the distribution name, which influence the version of the packages. Here, sid refers to the bleeding-edge version of Debian.
- Your flash drive must be partionned (you can use gparted if you are not used to partionning) at least in two partitions. The first one is the place you will dd the newly build USB image. The second one is where your persistent data will be stored.
- Anytime you want a live image of the filesystem state in your running USB image, you type live-snapshot. A gzipped cpio archive will be created on your system (the command will tell you where) and you will have to copy it to your second partition.
- Next time you boot, just happen persistent to the kernel parameter (in your ISOLinux prompt), and it will automatically load the archive, thus restoring the filesystem to its saved state.
P.-S.: in case you need more magic, check out Live-Magic. Installing it is as easy as:
$ aptitude install live-magic