It is now possible to build libguestfs from the source tarballs on Debian and Ubuntu (into .deb packages which can be installed and managed by apt/aptitude). You will need libguestfs ≥ 1.11.6.
It’s not exactly obvious how, so this guide describes how to do it.
You’ll first need to install febootstrap 3.3, which you can either build from source in a similar way, or simpler you can install the binary package from here.
You will also need pretty recent Debian/Ubuntu. Suggested source repositories are here. In particular kernel ≥ 2.6.36 is absolutely required on the host. Earlier kernel versions than this won’t work.
Debian and Ubuntu do not supply /sbin/insmod.static. For the suggested workaround, read this.
You will also need to install several packages, but the first time you run the debuild command, it should tell you exactly what you are missing.
Grab the libguestfs source tarball ≥ 1.11.6 from the website, and unpack it:
$ zcat libguestfs-1.11.6.tar.gz | tar xf -
$ cd libguestfs-1.11.6
You can now run debuild with the right collection of options to build. The first time you do this, it will probably tell you that you need to install a bunch of build-time dependencies.
$ debuild -i -us -uc -b 2>&1 | tee /tmp/log
If it doesn’t work you’ll need to go back over the log file.
Once that works, in the parent directory (ie. above the build directory) you should find several .deb files:
$ cd ..
$ ls -l
$ ls -l
total 5280
-rw-r--r-- 1 rjones rjones 347640 May 12 14:27 guestfish_1.11.6-1_amd64.deb
-rw-r--r-- 1 rjones rjones 181368 May 12 14:27 guestmount_1.11.6-1_amd64.deb
-rw-r--r-- 1 rjones rjones 941416 May 12 14:27 libguestfs0_1.11.6-1_amd64.deb
-rw-r--r-- 1 rjones rjones 1235918 May 12 14:27 libguestfs0-dbg_1.11.6-1_amd64.deb
drwxr-xr-x 38 rjones rjones 4096 May 12 14:27 libguestfs-1.11.6
-rw-r--r-- 1 rjones rjones 561346 May 12 14:28 libguestfs_1.11.6-1_amd64.build
-rw-r--r-- 1 rjones rjones 3637 May 12 14:27 libguestfs_1.11.6-1_amd64.changes
-rw-r--r-- 1 rjones rjones 408490 May 12 14:27 libguestfs-dev_1.11.6-1_amd64.deb
-rw-r--r-- 1 rjones rjones 364450 May 12 14:27 libguestfs-doc_1.11.6-1_all.deb
-rw-r--r-- 1 rjones rjones 454984 May 12 14:27 libguestfs-perl_1.11.6-1_amd64.deb
-rw-r--r-- 1 rjones rjones 578720 May 12 14:27 libguestfs-tools_1.11.6-1_amd64.deb
-rw-r--r-- 1 rjones rjones 262584 May 12 14:27 python-guestfs_1.11.6-1_amd64.deb
You can just install these using dpkg -i or however you would normally install .deb packages.
Finally make sure everything is working by running libguestfs-test-tool.