Using recommendations here:<br><a href="http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg06972.html">http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg06972.html</a><br>and updated lxc-archlinux template I have managed to run (almost) unmodified Arch Linux installation in container.<br>
This exposed a couple of problems in systemd.<br>The first one is: systemd goes through /proc/self/mountinfo entries to perform unmount actions on shutdown. when running in container, it contains root filesystem entry, which systemd fails to unmount, resulting in unclean shutdown.<br>
I was able to fix it using simple patch (<a href="http://pastie.org/5380592">http://pastie.org/5380592</a>) which makes systemd ignore root mount when running in container.<br>The second issue is journald reporting journal corruption on every container boot, regardless of clean shutdown. This also happens when I bind-mount hosts journal directory into container.<br>
<br>Here is what lxc config and related files look like:<br><br># cat /var/lib/lxc/lxc0/config <br>lxc.utsname=lxc0<br>lxc.tty=1<br>lxc.pts=1024<br>lxc.rootfs=/var/lib/lxc/lxc0/rootfs<br>lxc.mount=/var/lib/lxc/lxc0/fstab<br>
lxc.cap.drop = sys_module mac_admin mac_override<br>#hooks<br>lxc.hook.mount=/usr/share/lxc/hooks/mount<br>#networking<br>lxc.network.type=veth<br>lxc.network.flags=up<br>lxc.network.link=br0<br><a href="http://lxc.network.name">lxc.network.name</a>=eth0<br>
lxc.network.mtu=1500<br>#cgroups<br>lxc.cgroup.devices.deny = a<br>lxc.cgroup.devices.allow = c *:* m<br>lxc.cgroup.devices.allow = b *:* m<br>lxc.cgroup.devices.allow = c 1:3 rwm<br>lxc.cgroup.devices.allow = c 1:5 rwm<br>
lxc.cgroup.devices.allow = c 1:7 rwm<br>lxc.cgroup.devices.allow = c 1:8 rwm<br>lxc.cgroup.devices.allow = c 1:9 rwm<br>lxc.cgroup.devices.allow = c 1:9 rwm<br>lxc.cgroup.devices.allow = c 4:1 rwm<br>lxc.cgroup.devices.allow = c 5:0 rwm<br>
lxc.cgroup.devices.allow = c 5:1 rwm<br>lxc.cgroup.devices.allow = c 5:2 rwm<br>lxc.cgroup.devices.allow = c 136:* rwm<br><br># cat /usr/share/lxc/hooks/mount<br>#!/bin/sh<br><br>dev_path="/usr/lib/lxc/rootfs/dev"<br>
mkdir -p "${dev_path}/pts"<br>mknod -m 666 "${dev_path}/null" c 1 3<br>mknod -m 666 "${dev_path}/zero" c 1 5<br>mknod -m 666 "${dev_path}/full" c 1 7<br>mknod -m 666 "${dev_path}/random" c 1 8<br>
mknod -m 666 "${dev_path}/urandom" c 1 9<br>mknod -m 666 "${dev_path}/tty" c 5 0<br>mknod -m 600 "${dev_path}/console" c 5 1<br><br># cat /var/lib/lxc/lxc0/fstab <br>none /var/lib/lxc/lxc0/rootfs/dev tmpfs dev 0 0<br>
sysfs sys sysfs ro,defaults 0 0<br>proc proc proc nodev,noexec,nosuid 0 0<br>/proc/sys /var/lib/lxc/lxc0/rootfs/proc/sys none ro,bind 0 0<br><br>host system is also Arch Linux running systemd version 195<br><br>Can anyone provide any insights on how can I find out what causes journal corruption?<br>