Running systemd based container in LXC
I just stubmled upon your question. I have running systemd containers under Arch. I wrote some notes on the Arch Wiki explaining how to get it working. You do need lxc.autodev
and you also need to mask some services that shouldn't run inside a container.
I do a basic mkarchroot and then make some changes (chroot into the new archroot):
ln -s /dev/null /etc/systemd/system/systemd-udevd.service
ln -s /dev/null /etc/systemd/system/systemd-udevd-control.socket
ln -s /dev/null /etc/systemd/system/systemd-udevd-kernel.socket
ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount
In your container config you need
lxc.autodev = 1
And, if you need to create any device nodes (you probably will), you also need
lxc.hook.autodev = /path/to/script
plus the script file
#!/bin/bash
# LXC Autodev hook.
cd ${LXC_ROOTFS_MOUNT}/dev
mknod .....
The /path/to/script
is a location on the HOST filesystem - for example /etc/lxc/mycontainer-autodev-hook
.