There are lots of questions pertaining this error, and there is a suggested manual fix which works well, but there's no permanent solution. How can i permanently solve this? Im having this issue on a debian wheezy server, using OpenVPN client to connect to an OpenVPN server.
The suggested fix is the one below. Seems like, /dev/net is not automatically created and of course disappears on each reboot.
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
debian wheezy has been out of support since may 2018 (https://www.debian.org/releases/wheezy/), you should not be using it in 2020 any more for production.
Now, with that out of the way, you could add the commands that temporarily fix your issue adding those commands a bash script that you add to your root crontab with the @reboot nickname (man 5 crontab).
So create a bash script somewhere in your file system with something like this:
Save it with 755 permissions and modify the root crontab:
with this content at least
And after rebooting it should have started openvpn successfully.
It happens in Arch/Manjaro as well.
I managed to figure out the problem, apparently a kernel upgrade is simply moving the modules directory, so trying to reach the modules from their known location is unavailable, the current running kernel is still running but I can't seem to
modprobe
(load) any modules which are not already loaded (such astun
required for OpenVPN connections).So for example, the
/lib/modules/
directory had the following directories before the upgrade (I have multiple kernels, notice the 5.16 series):And this is the status after the upgrade:
Trying to load the
tun
modules shows the following message:Which perfectly makes sense as this directory doesn't exist.
So, what is my proposed solution in this case? A restart.
I think that a possible solution is to configure the system to load the
tun
kernel module during startup. In order to do so, list thetun
module name in/etc/modules
file:udev
is the system component thatcreates andmaintains device nodes in/dev
folder according to loaded kernel modules and connected hardware devices. I believe that by loadingtun
kernel module at boot time, the system will create the/dev/net/tun
device node on every startup.I hope it helps.
EDIT: I am a bit outdated. After launching a Debian Wheezy image published in Vagrant Cloud website, I figured out that
udev
in fact handles permissions, ownerships and symlinks regarding already existing device nodes. Device nodes are actually created by the kernel itself and are exposed to userspace through thedevtmpfs
pseudo-filesystem.devtmpfs
filesystem is mounted at initramfs time. The file/usr/share/initramfs-tools/init
, which gets executed oncegrub
extracts initramfs to memory, presents code that mounts adevtmpfs
filesystem into/dev
, falling back to a standardtmpfs
filesystem if unsuccessful.In addition, to have
devtmpfs
filesystem available, Debian Wheezy kernel is shipped withCONFIG_DEVTMPFS=y
enabled.