[systemd-devel] nspawn --ephemeral

Johannes Ernst johannes.ernst at gmail.com
Tue Jun 16 14:53:54 PDT 2015


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 …?


Johannes.



More information about the systemd-devel mailing list