copy image and files
mkdir -p images
cp ~/.vagrant.d/boxes/${TARGETIMAGE}/0/libvirt/* images/
cd images
init
apt-get install -qqy lvm2
modprobe nbd
attach
qemu-nbd -c /dev/nbd0 `pwd`/box.img
vgscan
vgchange -ay
mount /dev/mapper/vagrant--vg-root /mnt
bind
binds="/dev /dev/pts /proc /sys /run"
for d in $binds; do
mkdir -p /mnt${d}
mount --bind ${d} /mnt${d}
done
work
chroot /mnt bash
# blah blah blah
exit
unbind and detach
cd /
for d in $(mount | awk '/\/mnt/{print $3}' | sort -r); do
umount $d
done
vgchange -an vagrant-vg
qemu-nbd -d /dev/nbd0