[systemd-devel] systemd-nspawn isolation potentially causing issues with distccmon-text

John graysky at archlinux.us
Tue Nov 19 19:00:30 UTC 2019


I made some progress... I modified the script to start the container like this:
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \
  -D "$working_dir" \
  -E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
  --register=yes --as-pid2 --machine=test \
  "${mount_args[@]}" \
  "$@"

Now when the script is called, machinectl can see the container, but I
cannot connect to it:

# systemd-run --pipe -M test /usr/bin/distccmon-text
Failed to create bus connection: Protocol error

# machinectl
MACHINE CLASS     SERVICE        OS   VERSION ADDRESSES
test   container systemd-nspawn arch -       -

1 machines listed.

On Tue, Nov 19, 2019 at 4:14 AM Lennart Poettering
<lennart at poettering.net> wrote:
>
> On Fr, 15.11.19 17:17, John (graysky at archlinux.us) wrote:
>
> > The container is created by one of the Arch Linux build scripts
> > (https://git.archlinux.org/devtools.git/tree/arch-nspawn.in).  I do
> > not believe it runs with its own systemd/dbus.  When I am compiling
> > (https://git.archlinux.org/devtools.git/tree/makechrootpkg.in) in the
> > container, is there a way I can run distccmon-text from within the
> > same container to get it to read the same PID values?
>
> No this doesn't work. PID namespacing is kinda at the core of what a
> container is, making them match in the host and container's view isn't
> really feasible.
>
> (You should be able to run your distcc tool inside the container
> though, with systemd-run --pipe -M <containername> …)
>
> Sorry!
>
> Lennart
>
> --
> Lennart Poettering, Berlin


More information about the systemd-devel mailing list