[systemd-devel] nspawn --ephemeral

Lennart Poettering lennart at poettering.net
Tue Jun 16 15:22:32 PDT 2015


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


More information about the systemd-devel mailing list