After a recent upgrade to Debian Stretch, my OpenVPN server stopped working. Checking the relevant log file, /var/log/openvpn.log, I found the following not-very-helpful error message.
Fri Nov 23 16:46:37 2018 OpenVPN 2.4.0 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jul 18 2017 Fri Nov 23 16:46:37 2018 library versions: OpenSSL 1.0.2l 25 May 2017, LZO 2.08 Fri Nov 23 16:46:37 2018 daemon() failed or unsupported: Resource temporarily unavailable (errno=11) Fri Nov 23 16:46:37 2018 Exiting due to fatal error
Fortunately, someone had already reported this error to Debian and found out that the error is caused by the
LimitNPROC=10
in /lib/systemd/system/openvpn@.service. The LimitNPROC directive in systemd is used to limit the number of forks a service is allowed to make. Removing this limit might not be the best idea, so I would suggest that instead of commenting it out, you find the minimal value that allows OpenVPN to start and work. After some testing, I found that the minimal value that worked for me is
LimitNPROC=27
After editing /lib/systemd/system/openvpn@.service, you need to reload the systemd service files and restart the OpenVPN server process.
$ sudo systemctl daemon-reload $ sudo systemctl restart openvpn@server