Hi Emmanuel,

fai-cloud-images is rather a work in progress for Vagrant Images,
you> should look at debian-vm-templates for the working stuff.

OK, but my plan is to merge the config_space of fai-cloud-images into
our existing FAI config space to create custom VM images that match our
existing bare-metal and production VM images.
As a side effect this could serve as a CI setup for our FAI configs
which is a constant source of regression in our infrastructure management.

After the initial debootstrap further package installations fail
because DNS resolution does not work inside the chroot, eg.:
[..]
We are not using systemd-resolved in our setup and I cannot easily
test it at the moment.

vmdeboostrap has the unfornate choice of using systemd-networkd as
the default, when everything else is still us ifupdown, and I don't a
lot about about DNS resolution is supposed to take place.

fai-cloud-images can produce working VM images if I run it inside a
standard debian/stretch64 vagrant image (with systemd-resolved).
I assume that also applies to fai-cloud-images.

systemd-resolved runs a local DNS server on the private IP 127.0.0.53
(you can test it with `host www.debian.org 127.0.0.53`).
I assume that the debootstrapped system uses the parent hosts
systemd-resolved when available.

I added a small patch to vagrant-setup that copies the hosts resolv.conf
into the image. This fixes the issue for me and should work whether or
not systemd-resolved is used.

Kind regards

        Christopher
diff --git a/helpers/vagrant-setup b/helpers/vagrant-setup
index 2754d41..4cd906f 100755
--- a/helpers/vagrant-setup
+++ b/helpers/vagrant-setup
@@ -19,6 +19,9 @@ fi
 
 set -x
 
+mkdir -p $fs/run/systemd/resolve
+cp /etc/resolv.conf $fs/run/systemd/resolve/resolv.conf
+
 #######################################################################
 # upgrade Debian images as the LXC template does not do it.
 #######################################################################
@@ -90,6 +93,7 @@ echo 'PasswordAuthentication no' >> $fs/etc/ssh/sshd_config
 #######################################################################
 chroot $fs apt-get clean
 rm -f $fs/usr/sbin/policy-rc.d
+rm -vf $fs/run/*
 
 # make sure /etc/machine-id is generated on next book
 # /etc/machine-id needs to be unique so multiple systemd-networkd dhcp clients

Reply via email to