Image source: wikipedia.org
I’ve started to migrate all my OpenVZ Containers to the LXC container virtualisation. This is because of several reasons which I don’t want to write down in this post. This time I just want to give you a fix for a problem which has bumped up for several containers after their migration on my system.
The error in summary
This error is not a problem of LXC. SystemD is causing this and it’s causing this for a good reason. SystemD wants to protect your system that one or multiple processes are able to spawn other processes without limitation. Now, if you use LXC you will get of course a enormous amount of processes which are started by your container. The container itself is a process on your host system. And this is where the problems of the limitation begins.
The fix is rather easy and doesn’t even require a restart of your system or of your containers. As root open the file /etc/systemd/system.conf and enable / set the following value:
after you’ve done this, simply let the SystemD reload itself:
root@system:~# systemctl daemon-reload
That’s it. Your containers should now run as expected without the bash: fork error.
Have fun with your containers 🙂