I'm using lxc to have a ubuntu 16.04 development environment on my 18.04 laptop. When I do a parallel build (
ninja -j) on the container my computer becomes unresponsive and never recovers. I have to restart it when this happens. I know this is vague, I am suspicious this has something to do with memory usage or some other resource that when building on the host is better managed. If I remember to do
-j 4 (gnu compilers) it does not lock up.
I've setup lxc in the simplest way where I have to run it as root. It does not have access to network devices and I "mount" folders on it using the config file to share repos with it. Below is my config file:
# Distribution configuration lxc.include = /usr/share/lxc/config/common.conf # For Ubuntu 16.04 lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0 lxc.mount.entry = /sys/kernel/security sys/kernel/security none bind,optional 0 0 lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0 lxc.mount.entry = mqueue dev/mqueue mqueue rw,relatime,create=dir,optional 0 0 lxc.arch = linux64 # Container specific configuration lxc.rootfs.path = dir:/var/lib/lxc/u2/rootfs lxc.uts.name = u2 # Network configuration lxc.net.0.type = none lxc.net.0.flags = down # Share Display for gui applications lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file # Share folders lxc.mount.entry = /home/tyler/workspace /var/lib/lxc/u2/rootfs/home/ubuntu/workspace none bind 0 0
My question has two parts, how can I isolate what is causing the lockup, and how can I configure my LXC container to keep it from locking up my computer when doing parallel builds?