1

lsmod -> tun 16587 0 - Live 0xbf0e1000

Openvpn error: Cannot open TUN/TAP dev /dev/net/tun no such file or directory

I tried creating a dummy directory but the error changes to Cannot open TUN/TAP dev /dev/net/tun: Is a directory.

edit: System: ARM Linux 3.10.0

enter image description here

1

/dev/net/tun is character device not file nor directory. Check it with ls command:

ls -lad /dev/net/tun

It shall look like (notice first c):

crw-rw-rw- 1 root root 10, 200 Feb 10 21:38 /dev/net/tun

To fix unload tun module:

rmmod tun

remove /dev/net/tun directory if it exist (directory is marked with d instead of c):

rmdir /dev/net/tun

Reload tun module:

modprobe tun

It shall create character device /dev/net/tun.

|improve this answer|||||
  • I unloaded tun and deleted the /dev/net/tun directory that I created. modprobe tun doesn't work and outputs 'module tun.ko not found'. Instead I loaded the module using insmod. The character device is NOT being created – Luke Feb 18 '19 at 17:29
  • @Luke what kind of system is that? (please add the info in your question, not in comments) – mosvy Feb 18 '19 at 17:36
  • Check system logs (for example dmesg | tail) immediately after loading tun module. Probably it will show some error. – John Doe Feb 18 '19 at 17:38
  • dmesg does not show an error – Luke Feb 18 '19 at 17:58
  • 1
    Check if kernel config has DEVTMPFS enabled. If I am not wrong it is responsible for automatic creation of /dev/net/tun. – John Doe Feb 19 '19 at 15:00
0

This worked for me on Puppy Linux Xenial x64:

https://nordvpn.com/tutorials/ipfire/openvpn/

Note: If the VPN cannot start for you and you are getting this output:

ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)

Then do the following:

mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
cat /dev/net/tun

If you receive the message:

cat: /dev/net/tun: File descriptor in bad state

That means your TUN/TAP device is ready for use.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.