systemd-nspawn and /run/resolvconf/resolv.conf

Tom H tomh0665 at
Thu Sep 24 14:18:20 UTC 2015

On Tue, Sep 22, 2015 at 10:19 AM, Ralf Mardorf
<ralf.mardorf at> wrote:
> On Tue, 22 Sep 2015 08:36:27 -0400, Tom H wrote:

> Thank you Tom for taking the time.

You're welcome.

>> So it works when using "-b".
>> But you're right, it doesn't when not using "-b".
>> Ubuntu decided to default to using resolvconf with 12.04. I suspect
>> that it'll take more than "it doesn't work when using systemd-nspawn
>> as a basic chroot process" for this change to be reversed.
> So I don't report it as a bug.

It might be worth reporting it so something like what lxc used to do
(see below; I grepped through the various lxc scripts and didn't find
anything resolv.conf related, so it no longer does this AFAICS).

When systemd-nspawn is used without "-b" it's eseentially a chroot
without having to mount/bind-mount anything before entering the

You need to ensure that a proper resolv.conf exists in a chroot before
switching to it. When installing Gentoo, for example, you "cp -L
/etc/resolv.conf $chroot/etc" before chrooting because the
installation tarball doesn't have a resolv.conf. I'm sure that if you
check the Arch installation scripts, you'll find something similar.

>> Do you have lxc installed? How does it handle resolv.conf as a symlink?
> No. Since I never used it, it's too time consuming to care about
> LinuxContainers now.

I installed lxc and set up a container. I'd forgotten that it starts
up with the systemd-nspawn "-b" by default so a resolv.conf symlink

I haven't used lxc in a while but I remembered as I was setting up my
container that there used to be a routine to detect whether
resolv.conf was a symlink and, if it was, back it up and copy the
host's resolv.conf.

More information about the Ubuntu-devel-discuss mailing list