[systemd-devel] systemd-nspawn: starting multiple shells

aleivag aleivag at gmail.com
Sat Jun 23 15:04:29 UTC 2018


short answer, yes, `machinectl login` is only suppported for systemd-init ,
and `machinectl shell` `systemd-run` will try to talk to the container via
dbus, so i dont think you are force to have systemd runing inside the
container (i may be wrong) but you do need to have dbus (and its easy to
just have systemd).  if you dont need it, you can always use nsenter to
access a namespace on your machine

```
nsenter -t <pid> --all /bin/bash
```

where <pid> is the process that is runing on your container

Alvaro Leiva


Alvaro Leiva


On Sat, Jun 23, 2018 at 7:38 AM Nikolaus Rath <nikolaus at rath.org> wrote:

> Hi,
>
> On Sat, 23 Jun 2018, at 15:31, Vito Caputo wrote:
> > On Sat, Jun 23, 2018 at 03:09:04PM +0100, Nikolaus Rath wrote:
> > > How would I go about starting an additional shell in an existing
> > > container? I am starting the container with:
> > >
> > > $ systemd-nspawn -M foo --as-pid2 --register=no
> > >
> > > "foo" is a raw image retrieved with machinectl. If I simply execute the
> > > above command again, I am getting a "Disk image
> > > /var/lib/machines/foo.raw is currently busy." error.
> > >
> > > I've looked into the systemd-nspawn manpage, but couldn't find anything
> > > appropriate.
> > >
> > > What am I missing?
> > >
> > Take a look at the machinectl man page, the "shell" and "login"
> > subcommands in particular.
>
> `man systemd-nspawn` says that when not running an init system in the
> container,
> I should specify `--register=no`. But without that, `machinectl` doesn't do
> anything.  Does this mean I need to run an init system to support multiple
> shells?
>
> Best,
> -Nikolaus
>
> --
> GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
>
>              »Time flies like an arrow, fruit flies like a Banana.«
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180623/6ff89a1b/attachment-0001.html>


More information about the systemd-devel mailing list