[systemd-devel] systemd-nspawn v237 - cannot start two containers with same directory

Lennart Poettering lennart at poettering.net
Mon Sep 10 19:51:04 UTC 2018


On Do, 26.07.18 20:13, patlollamahipal at yahoo.co.in (patlollamahipal at yahoo.co.in) wrote:

> Hi All, I am using systemd 237. I am trying to start two containers
> using systemd-nspawn with same root directory. First one starts but
> the second one throws the Error "Directory Tree /a/b/c/ is currently
> busy."  In version 239 man pages, it's mentioned implicitly, that it
> can be used so.  v239 man pageNote that running
> two systemd-nspawn containers from the same directory tree will not
> make processes in them see each other. The PID namespace separation
> of the two containers is complete and the containers will share very
> few runtime objects except for the underlying file
> system. Usemachinectl(1)'s login or shell commands to request an
> additional login session in a running container.
> 
> Can you please let me know if this is still valid for systemd
> version 237 ? If it is possible to start two containers from the
> same directory, what could be the reason for the error for second
> container. Thank You Regards Mahipal

Linux systems are generally not ready to be booted twice from the same
writable /var. i.e. each instance will assume it is the only
concurrent writer to /var, and if another instance modifies it behind
its back it's going to be very confused.

That said, you should be able to get this to work, if you make all
instances read-only, i.e. use npsawn's --read-only.

Morevoer, you can use set the env var SYSTEMD_NSPAWN_LOCK to "0" to
turn off the automatic locking. If you do you are on your own though,
and the image might break in the case mentioned above.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list