If you try to install openvpn server to an LXC container, you will get following error:
ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
This is related with the design decision of unprivileged containers which can’t create device nodes.
In order to solve this problem, you should do bind-mount that device node from the host system.
Follow the steps:
- Learn container id from Proxmox Gui (for example 102)
- Connect your proxmox host system from ssh
- Edit
/etc/pve/lxc/102.conf
as root - Append:
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
- Save the file and run
pct stop 102
andpct start 102
commands
Note: If you’re using Openvpn Access Server (for included gui) and you’re using stock Debian9 Proxmox templates, you also need to install net-tools package because start script requires
ifconfig
binary which is not coming with standard install anymore!