2

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

2 Answers 2

2

/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.

11
  • 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 Commented Feb 18, 2019 at 17:29
  • @Luke what kind of system is that? (please add the info in your question, not in comments) Commented Feb 18, 2019 at 17:36
  • Check system logs (for example dmesg | tail) immediately after loading tun module. Probably it will show some error. Commented Feb 18, 2019 at 17:38
  • dmesg does not show an error Commented Feb 18, 2019 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. Commented Feb 19, 2019 at 15:00
1

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.

1
  • I did that, I got the File descriptor in bad state message, but my process is still failing. Commented Apr 5 at 23:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.