Build libguestfs inside a systemd-nspawn container ================================================== Prerequisite ------------ Because of an audit subsystem incompatibility bug - rhbz#966807[1], turn off auditing by booting the host w/ 'audit=0' on Kernel command line. [NOTE: There's work in progress[2] in upstream Kernel to fix this.] Create container ---------------- On the host, specify an installroot (/srv) and install a minimal Fedora 20 distribution: $ yum -y --releasever=20 --nogpg \ --installroot=/srv/testcontainer \ --disablerepo='*' --enablerepo=fedora \ install systemd passwd yum \ fedora-release vim-minimal Boot into the container, set the password: $ systemd-nspawn -D /srv/testcontainer [. . .] -bash-4.2# passwd Start the container w/ systemd: $ systemd-nspawn -bD /srv/testcontainer [. . .] -bash-4.2# Building Libguestfs ------------------- Inside the minimal Fedora 20 container, install libguestfs dependencies, clone the libguestfs git repository: -bash-4.2# yum-builddep libguestfs -y -bash-4.2# git clone git://github.com/libguestfs/libguestfs.git Build and test libguestfs in the container: -bash-4.2# cd libguestfs -bash-4.2# ./autogen.sh && time make 2>&1 \ | tee /tmp/libguestfs-compile.log -bash-4.2# time make -k check \ LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 2>&1 \ | tee /tmp/libguestfs-test.log Notes ----- Some related details: - If you need to build a container without networking (once all the relevant dependencies are cloned), you can invoke the container with no network devices: $ systemd-nspawn -bD /srv/testcontainer --private-network [. . .] -bash-4.2# - `gdb` and `strace` can be used from the host to the programs running in the container. [1] https://bugzilla.redhat.com/show_bug.cgi?id=966807 [2] https://www.redhat.com/archives/linux-audit/2013-May/msg00065.html