Debian on Openrc (Failed to get D-Bus connection: Unknown error -1)

Edit: Its much more. The whole init process doesn’t start properly.

When i try to ‘halt’ a Debian Jessie container on an Openrc host (OpenWRT) i get this error:

Failed to talk to init daemon.

Doing ‘systemctl status’ gets:

Failed to get D-Bus connection: Unknown error -1

I already installed ‘systemd, systemd-sysv, dbus’ packages but it doesn’t help.
Dbus doesn’t run when the container gets up.

root@debian:~# ps aux
root 1 0.0 0.4 4380 2404 ? Ss 14:39 0:00 /sbin/init
root 13 0.0 0.5 3616 2864 pts/2 Ss 14:54 0:00 /bin/bash

/sbin/init points to systemd binary.

lxc-start -n debian -F

lxc-start: debian: utils.c: safe_mount: 1707 No such file or directory - Failed to mount /usr/lib/lxc/rootfs/proc/tty onto /usr/lib/lxc/rootfs/proc/sys/net
Failed to mount cgroup at /sys/fs/cgroup/systemd: Operation not permitted

How can i get dbus fixed inside the container to be able to shutdown the container gracefully from outside and get the init process working? It doesn’t even start the nics.

lxc-start --version = 2.1.1
Linux OpenWrt 4.14.43 #0 PREEMPT Fri May 25 18:36:46 2018 i686 GNU/Linux

You need to create the systemd cgroup and mount it I think. Gentoo documents this here:

To use systemd in the container, a recent enough (>=4.6) kernel version with support for cgroup namespaces is needed. Additionally the host needs to have a name=systemd cgroup hierarchy mounted. Doing so does not require running systemd on the host:

mkdir -p /sys/fs/cgroup/systemd
mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd
1 Like

You’re right, it works. Thank you!