Package: lxc
Version: 1:2.0.7-2
Severity: important
Tags: patch
Dear Maintainer,
I am using LXC on stretch, running a number of stretch containers.
When running around 15 containers, systemd starts to fail, both on the host
and inside containers:
# journalctl -f
Failed to get journal fd: Too many open files
# systemctl stop nginx
Failed to allocate directory watch: Too many open files
The problem seems to be that systemd uses inotify quite a lot, and the limit
on inotify listeners is very low by default:
# sysctl fs.inotify.max_user_instances
fs.inotify.max_user_instances = 128
Increasing this value indeed solves the problem. The issue was described
in this blog post:
https://kdecherf.com/blog/2015/09/12/systemd-and-the-fd-exhaustion/
Attached is a patch for lxc that configures this sysctl setting to a higher
value. I don't know if this is the "Debian way" or if some other solution
is preferred.
-- System Information:
Debian Release: 9.0
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64
(x86_64)
Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages lxc depends on:
ii init-system-helpers 1.47
ii libapparmor1 2.11.0-3
ii libc6 2.24-9
ii libcap2 1:2.25-1
ii libgnutls30 3.5.8-5
ii liblxc1 1:2.0.7-2
ii libseccomp2 2.3.1-2.1
ii libselinux1 2.6-3+b1
ii lsb-base 9.20161125
ii python3-lxc 1:2.0.7-2
pn python3:any <none>
Versions of packages lxc recommends:
pn bridge-utils <none>
ii debootstrap 1.0.89
ii dirmngr 2.1.18-6
pn dnsmasq-base <none>
ii gnupg 2.1.18-6
ii iptables 1.6.0+snapshot20161117-6
pn libpam-cgfs <none>
pn lxcfs <none>
ii openssl 1.1.0e-1
ii rsync 3.1.2-1
pn uidmap <none>
Versions of packages lxc suggests:
pn apparmor <none>
pn btrfs-tools <none>
ii lvm2 2.02.168-2
-- no debconf information