Tag Archives: supermin appliance

A 685K Fedora appliance

Using supermin appliances we can make some very small to download Fedora appliances. These ones are under 700K (yes, that’s “K” not “M”).

For Fedora 15, use this link:
http://koji.fedoraproject.org/koji/taskinfo?taskID=3421870

For Fedora 16, use this link:
http://koji.fedoraproject.org/koji/taskinfo?taskID=3421867

For Rawhide, use this link:
http://koji.fedoraproject.org/koji/taskinfo?taskID=3421803

You will need ~600 MB free space in /var/lib since that is where the real appliance gets built. Just install the RPM and run sudo boot-a-fedora-appliance. Then read that script and the README file.

Upstream source:
http://git.annexia.org/?p=a-fedora-appliance.git;a=summary

Leave a comment

Filed under Uncategorized

Tip: Creating throwaway appliances with febootstrap

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:

2 Comments

Filed under Uncategorized

An explanation of supermin appliances

I wrote an explanation of supermin appliances.

2 Comments

Filed under Uncategorized

Supermin appliance – now in febootstrap

Q: Can you fit a bootable Fedora distribution into 100 kilobytes?
A: You bet!*
* by cheating … read on.

Take an ordinary Fedora appliance as made by febootstrap or appliance-creator. The appliance image is big because it contains copies of programs (/bin/bash) and libraries (/lib/libc.so), the kernel and kernel modules. It needs to, to make it self-contained.

But a technique we’ve been using for a few months in libguestfs is to say: we’re booting this appliance on a Fedora host. Let’s strip out all those programs and libraries from the appliance, and we’ll add them back from the host just before we launch it.

I called such appliances “supermin appliances”, and now I’ve ported the functionality from libguestfs into febootstrap so everyone can use it.

A supermin appliance is really small:

-rw-rw-r-- 1 rjones rjones 14K 2009-10-22 12:43 hostfiles.txt
-rw-rw-r-- 1 rjones rjones 87K 2009-10-22 12:43 supermin.img

yet it’s fully bootable, given the right sort of host:

It’s really easy to use the new febootstrap to make your own super-small supermin appliances.

We’ll start with this small shell script to make a supermin appliance:

#!/bin/sh -
distro=rawhide
febootstrap -i bash -i coreutils $distro fedora
febootstrap-minimize fedora
cat > init <<EOF
#!/bin/sh
echo Starting /init script ...
PATH=/sbin:/usr/sbin:$PATH
touch /etc/fstab
mount -t proc /proc /proc
mount -t sysfs /sys /sys
exec bash -i
EOF
febootstrap-install fedora init /init 0755 root.root
rm init
# Create the supermin appliance.
febootstrap-to-supermin fedora supermin.img hostfiles.txt
# Create the ordinary appliance just for comparison.
febootstrap-to-initramfs fedora > ordinary.img

You will need to use febootstrap >= 2.5, and set the distro variable so it exactly matches your base Fedora system (eg. set distro=fedora-11).

The script below can be used to boot the appliance, and it’s what I used to get the screenshot above.

#!/bin/sh -
time febootstrap-supermin-helper \
    supermin.img hostfiles.txt kernel initrd
qemu-system-x86_64 -m 1024 -kernel kernel -initrd initrd

4 Comments

Filed under Uncategorized