[systemd-devel] nspawn --ephemeral

Tobias Hunger tobias.hunger at gmail.com
Wed Jun 17 00:34:19 PDT 2015


Hi Johannes,

there is a tmpfiles.d rule in your container that creates that
snapshot if it is not there yet.

I started to create a var/lib/machines directory in the container as
part of the container creation process, which prevents systemd 219
from creating the btrfs snapshot there.

Alternatively you could also remove the /var/lib/machines line from
usr/lib/tmpfiles.d/var.conf inside the container.

Best Regards,
Tobias


On Wed, Jun 17, 2015 at 1:14 AM, Johannes Ernst
<johannes.ernst at gmail.com> wrote:
> Aha! Works in 220. (It’s still in testing in Arch, so I had been on 219)
>
> I’m still unclear why there’s an (empty) /var/lib/machines in the container.
>
>
> On Jun 16, 2015, at 15:22, Lennart Poettering <lennart at poettering.net>
> wrote:
>
> On Tue, 16.06.15 14:53, Johannes Ernst (johannes.ernst at gmail.com) wrote:
>
> I have a root filesystem directory in foo/
>
> I boot with nspawn, and immediately, in the container:
>    systemctl poweroff
>
> This works fine if invoked as:
>    sudo systemd-nspawn --directory foo --boot -n
>
> But if I add --ephemeral (and it is a btrfs filesystem)
>    sudo systemd-nspawn --directory foo --boot -n --ephemeral
> I get:
>    Sending SIGTERM to remaining processes...
>    Sending SIGKILL to remaining processes...
>    Powering off.
>    Container ... has been shut down.
>    Cannot remove subvolume '/home/.../.#foo...', ignoring: Directory not
> empty
>
> btrfs subvolume list reports two new subvolumes:
>    …/.#foo...
>    …/.#foo.../var/lib/machines
>
> Indeed I cannot remove subvol …/.#foo… unless I first remove subvol
> …/.#foo.../var/lib/machines
>
> Further, foo/ does not actually contain /var/lib/machines
> but in the booted container, it actually lists two subvolumes with that
> path:
>    # btrfs subvolume list /
>    ID 351 gen 250192 top level 5 path var/lib/machines
>    ID 371 gen 256382 top level 5 path home/…/.#foo
>    ID 372 gen 256382 top level 371 path var/lib/machines
> On the host, we have the same, but the second one has the prefix i.e.
> home/…/.#foo/var/lib/machines
>
> Hmm …?
>
>
> Do you use systemd v220? only in v220 we support recursively removing
> subvolumes, and there's a tmpfiles snippet that creates
> /var/lib/machines as subvolume.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


More information about the systemd-devel mailing list