This is an update to a previous posting, but using the new febootstrap 3.x cross-distro toolchain to make building supermin appliances even simpler.
Firstly we create a supermin appliance containing a few packages and their dependencies. Note that I’m not minimizing this appliance so it’s a bit bigger (3.1MB!) than the ones we would generate in reality:
$ mkdir supermin.d $ febootstrap --names 'bash' 'coreutils' -o supermin.d febootstrap: warning: some host files are unreadable by non-root febootstrap: warning: get your distro to fix these files: /sbin/unix_update /usr/libexec/pt_chown /usr/sbin/build-locale-archive /usr/sbin/glibc_post_upgrade.x86_64 /usr/sbin/tzdata-update $ ls -lh supermin.d/ total 3.1M -rw-rw-r--. 1 rjones rjones 2.7M Dec 10 18:23 base.img -rw-rw-r--. 1 rjones rjones 462K Dec 10 18:23 hostfiles
The purpose of these two files is explained in the febootstrap documentation.
This won’t boot without a /init script, and we can easily provide one:
$ cat init #!/bin/bash - echo Welcome to my world bash -i $ chmod +x init $ echo init | cpio -o -H newc --quiet > supermin.d/init.img
The 3 files in supermin.d/ are a supermin appliance, and could be packaged up in a Fedora, Debian or Ubuntu package.
When you actually want to come and launch this appliance, you use febootstrap-supermin-helper to reconstruct the appliance:
$ febootstrap-supermin-helper -f ext2 supermin.d x86_64 \ kernel initrd root
(Note that “kernel”, “initrd” and “root” are output files in that command)
You’d usually arrange for those files to be cached, since febootstrap-supermin-helper takes a few seconds to run (8 seconds on my laptop) and by caching it you can get reconstruction time down to a fraction of a second.
Now to boot, run qemu or qemu-kvm like this:
$ qemu-kvm -kernel kernel -initrd initrd -hda root
After a few seconds you’ll get to the shell:
Can we use it create fedora minimal live iso images?
No. This technique only works in very narrow conditions. This is not a general purpose appliance building technique.