<div dir="ltr">Hi,<div><br></div><div>I just installed a fresh Ubuntu 14.04 amd64 and tried to start a container with the following configuration:</div><div><br></div><div><div># Common configuration</div><div># Autostart the container after a host reboot</div>
<div>lxc.start.auto = 1</div><div><br></div><div># Default pivot location</div><div>lxc.pivotdir = lxc_putold</div><div><br></div><div># Default mount entries</div><div>lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0</div>
<div>lxc.mount.entry = sysfs sys sysfs defaults 0 0</div><div>lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none bind,optional 0 0</div><div>lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0</div>
<div>lxc.mount.entry = /sys/kernel/security sys/kernel/security none bind,optional 0 0</div><div>lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0</div><div><br></div><div># Default console settings</div>
<div>lxc.devttydir = lxc</div><div>lxc.tty = 4</div><div>lxc.pts = 1024</div><div><br></div><div># Default capabilities</div><div>lxc.cap.drop = sys_module mac_admin mac_override sys_time</div><div><br></div><div># When using LXC with apparmor, the container will be confined by default.</div>
<div># If you wish for it to instead run unconfined, copy the following line</div><div># (uncommented) to the container's configuration file.</div><div>#lxc.aa_profile = unconfined</div><div><br></div><div># To support container nesting on an Ubuntu host while retaining most of</div>
<div># apparmor's added security, use the following two lines instead.</div><div>#lxc.aa_profile = lxc-container-default-with-nesting</div><div>#lxc.hook.mount = /usr/share/lxc/hooks/mountcgroups</div><div><br></div><div>
# Uncomment the following line to autodetect squid-deb-proxy configuration on the</div><div># host and forward it to the guest at start time.</div><div>#lxc.hook.pre-start = /usr/share/lxc/hooks/squid-deb-proxy-client</div>
<div><br></div><div># If you wish to allow mounting block filesystems, then use the following</div><div># line instead, and make sure to grant access to the block device and/or loop</div><div># devices below in lxc.cgroup.devices.allow.</div>
<div>#lxc.aa_profile = lxc-container-default-with-mounting</div><div><br></div><div># Default cgroup limits</div><div>lxc.cgroup.devices.deny = a</div><div>## Allow any mknod (but not using the node)</div><div>lxc.cgroup.devices.allow = c *:* m</div>
<div>lxc.cgroup.devices.allow = b *:* m</div><div>## /dev/null and zero</div><div>lxc.cgroup.devices.allow = c 1:3 rwm</div><div>lxc.cgroup.devices.allow = c 1:5 rwm</div><div>## consoles</div><div>lxc.cgroup.devices.allow = c 5:0 rwm</div>
<div>lxc.cgroup.devices.allow = c 5:1 rwm</div><div>## /dev/{,u}random</div><div>lxc.cgroup.devices.allow = c 1:8 rwm</div><div>lxc.cgroup.devices.allow = c 1:9 rwm</div><div>## /dev/pts/*</div><div>lxc.cgroup.devices.allow = c 5:2 rwm</div>
<div>lxc.cgroup.devices.allow = c 136:* rwm</div><div>## rtc</div><div>lxc.cgroup.devices.allow = c 254:0 rm</div><div>## fuse</div><div>lxc.cgroup.devices.allow = c 10:229 rwm</div><div>## tun</div><div>lxc.cgroup.devices.allow = c 10:200 rwm</div>
<div>## full</div><div>lxc.cgroup.devices.allow = c 1:7 rwm</div><div>## hpet</div><div>lxc.cgroup.devices.allow = c 10:228 rwm</div><div>## kvm</div><div>lxc.cgroup.devices.allow = c 10:232 rwm</div><div>## To use loop devices, copy the following line to the container's</div>
<div>## configuration file (uncommented).</div><div>#lxc.cgroup.devices.allow = b 7:* rwm</div><div><br></div><div># Container specific configuration</div><div>lxc.rootfs = /dev/lxc1/app01-jobs2-prodm</div><div>lxc.mount = /var/lib/lxc/app01-xxx/fstab</div>
<div>lxc.utsname = app01-xxx</div><div>lxc.arch = amd64</div><div><br></div><div># Network configuration</div><div>lxc.network.type = veth</div><div>lxc.network.link = prodf</div><div>lxc.network.flags = up</div><div><a href="http://lxc.network.name">lxc.network.name</a> = front</div>
<div>lxc.network.hwaddr = 00:16:3f:6c:3b:28</div><div>lxc.network.type = veth</div><div>lxc.network.link = prodb</div><div>lxc.network.flags = up</div><div><a href="http://lxc.network.name">lxc.network.name</a> = back</div>
<div>lxc.network.hwaddr = 00:16:3b:c3:8c:a5</div><div><br></div><div>#</div><div>#</div><div># write console output to file</div><div>lxc.console = /var/lib/lxc/app01-xxx/console.out</div><div>#</div><div># restrict CPU time (default=1024)</div>
<div>#lxc.cgroup.cpu.shares = 1024</div><div># restrict IO weight (range 10-1000)</div><div>#lxc.cgroup.blkio.weight = 1000</div><div># limit memory</div><div>lxc.cgroup.memory.limit_in_bytes = 16G</div><div>##lxc.cgroup.memory.soft_limit_in_bytes = 15G</div>
<div># memory + swap limit (20G - 16G = 4G SWAP)</div><div>lxc.cgroup.memory.memsw.limit_in_bytes = 20G</div><div><br></div><div># enable cgroupd inside the container</div><div>lxc.mount.auto = cgroup:mixed</div></div><div>
<br></div><div>but starting the container failrs with:</div><div><br></div><div><div> lxc-start 1398334434.479 ERROR lxc_cgmanager - call to cgmanager_set_value_sync failed: invalid request</div><div> lxc-start 1398334434.479 ERROR lxc_cgmanager - Error setting cgroup memory.memsw.limit_in_bytes limit lxc/app01-jobs2-prodm</div>
<div> lxc-start 1398334434.479 ERROR lxc_cgmanager - Error setting memory.memsw.limit_in_bytes to 20G for app01-xxx</div><div> lxc-start 1398334434.479 ERROR lxc_start - failed to setup the cgroup limits for 'app01-xxx'</div>
<div> lxc-start 1398334434.603 ERROR lxc_start - failed to spawn 'app01-xxx'</div><div> lxc-start 1398334434.603 ERROR lxc_commands - command get_cgroup failed to receive response</div></div><div><br>
</div><div>Is that hack:</div><div><br></div><div><div>cat << EOFlxc > /etc/init/lxc-unpriv-cgroup.conf</div><div>#start on starting systemd-logind and started cgroup-lite</div><div>#</div><div>#script</div><div>
# set +e</div><div>#</div><div># echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy</div><div>#</div><div># for entry in /sys/fs/cgroup/*/cgroup.clone_children; do</div><div># echo 1 > $entry</div><div>
## done</div><div>#</div><div># exit 0</div><div>#end script</div></div><div><br></div><div>still needed?</div><div><br></div><div><br></div></div>