Hi,
We use LXC (and had used OpenVZ) mainly for openvpn, I got a problem wich a lot of people are encontering with LXC, the error message:
Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Today I had and hard day, with the Ubuntu 12.04 and debian 8 template for LXC,
because OpenVPN refuses to start during the boot, despite the device was there, when you log-in.
After an entire day, I found the problem and a solution.
The problem:
OpenVPN SysV Startup script is called before the Upstart /etc/init/mounted-dev.conf .
The solution I had to use was to write a configuration file in:
Then copy the script I've found on Archlinux website in:
Set the right permission to the script file:
Then, stop\shutdown (don't reboot) and start again the LXC Container, and it will magically work.
I hope, that it will be usefull for someone else, who will arrive here for the same problem.
Regards
-- For future reference the used version of ProxMox is 4.1-1/2f9650d4 --
We use LXC (and had used OpenVZ) mainly for openvpn, I got a problem wich a lot of people are encontering with LXC, the error message:
Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Today I had and hard day, with the Ubuntu 12.04 and debian 8 template for LXC,
because OpenVPN refuses to start during the boot, despite the device was there, when you log-in.
After an entire day, I found the problem and a solution.
The problem:
OpenVPN SysV Startup script is called before the Upstart /etc/init/mounted-dev.conf .
The solution I had to use was to write a configuration file in:
File: /usr/share/lxc/config/common.conf.d/02-openvpn-auto-tun.conf
Code:lxc.hook.autodev = /usr/share/lxc/hooks/openvpn-auto-tun
Then copy the script I've found on Archlinux website in:
File: /usr/share/lxc/hooks/openvpn-auto-tun
Code:#!/bin/bash cd ${LXC_ROOTFS_MOUNT}/dev mkdir net mknod net/tun c 10 200 chmod 0666 net/tun
Set the right permission to the script file:
Code:
chmod 755 /usr/share/lxc/hooks/openvpn-auto-tun
Then, stop\shutdown (don't reboot) and start again the LXC Container, and it will magically work.
I hope, that it will be usefull for someone else, who will arrive here for the same problem.
Regards
-- For future reference the used version of ProxMox is 4.1-1/2f9650d4 --