Error inside a LXC container: bash: fork: retry: No child processes

LXC Logo
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

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:

DefaultTasksMax=infinity

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 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s