OpenVPN start up fails- no tun device

I am trying to set up an OpenVPN server on Ubuntu 10.10 64 bit and am using the community guide as reference. I have gone through the guide several times but I am still having an issue. When I attempt to start opevpn I get the following error:

[email protected]:/etc/openvpn# openvpn server.conf
Fri Mar 25 07:47:22 2011 OpenVPN 2.1.0 x86_64-pc-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [MH] [PF_INET6] [eurephia] built on Jul 12 2010
Fri Mar 25 07:47:22 2011 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Mar 25 07:47:22 2011 Diffie-Hellman initialized with 2048 bit key
Fri Mar 25 07:47:22 2011 /usr/bin/openssl-vulnkey -q -b 2048 -m <modulus omitted="">
Fri Mar 25 07:47:23 2011 TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
Fri Mar 25 07:47:23 2011 ROUTE default_gateway=74.207.232.1
Fri Mar 25 07:47:23 2011 Note: Cannot open TUN/TAP dev /dev/net/tun: No such device (errno=19)
Fri Mar 25 07:47:23 2011 Note: Attempting fallback to kernel 2.2 TUN/TAP interface
Fri Mar 25 07:47:23 2011 Cannot allocate TUN/TAP dev dynamically
Fri Mar 25 07:47:23 2011 Exiting</modulus>

To confirm the module cannot be found:

[email protected]:/etc/openvpn# modprobe tun
FATAL: Module tun not found.

How to I install this module or set it up correctly? I have tried a few things I've found googling but nothing has worked thus far.

Thanks!

12 Replies

````
~ # uname -r
2.6.38-x8664-linode17 ~ # zgrep CONFIGTUN /proc/config.gz

CONFIG_TUN is not set

````

I thought the linode kernels had the TUN device built-in, but it appears not to be - do the 32-bit kernels include TUN?

You can:

1) Run your distro kernel with pv-grub

2) Download the linode kernel source and build the module yourself

3) Ask linode to include the TUN driver in their kernel

````
# pwd
/tmp/2.6.35.7-linode29
# grep CONFIGTUN .config CONFIGTUN=y

````

Yep - the 32-bit kernels have the TUN device built-in, while the 64-bit don't. I'd probably file a support ticket on this one, I doubt linode meant it to be this way.

Thanks for the help! I thought that was the case but wasn't 100% sure. I'll open a support ticket for tun to be included in 64 bit kernel.

I'm trying to run OpenVPN on Ubuntu 12.10 with the latest 32bit kernel (3.7.10-linode49) and running into this.

Do they typically not include the tun module, or was it dropped by accident?

This thread is old, and so is the kernel it references :). TUN is compiled into all our modern kernels. "zgrep TUN /proc/config.gz" to see. No need to load it. Just use it. Sometimes dumb scripts expect it to be a module and fail when they can't modprobe it (again, no need to since it's already compiled in).

-Chris

Thanks Chris, after OpenVPN complained about not finding TUN I did a search and found this thread.

Cheers.

I'm experiencing this outcome though as Chris noted it's likely to be a different cause than the original solution indicated. For instance, my kernel hasn't changed and it should have TUN support included. I hate to start a new thread when the issue appears to be the same, no tun device so ..

My openvpn implementation was working well until I rebooted this morning and I'm experiencing this issue.

Mon Mar 18 15:02:22 2013 us=742824 OpenVPN 2.2.1 i686-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Mar 30 2012

Mon Mar 18 15:02:22 2013 us=743036 NOTE: OpenVPN 2.1 requires '–script-security 2' or higher to call user-defined scripts or executables

Mon Mar 18 15:02:22 2013 us=747934 Diffie-Hellman initialized with 1024 bit key

Mon Mar 18 15:02:22 2013 us=748734 TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]

Mon Mar 18 15:02:22 2013 us=748796 Socket Buffers: R=[163840->131072] S=[163840->131072]

Mon Mar 18 15:02:22 2013 us=748938 ROUTE default_gateway=69.164.196.1

Mon Mar 18 15:02:22 2013 us=748989 Note: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)

Mon Mar 18 15:02:22 2013 us=749015 doifconfig, tt->ipv6=0, tt->didifconfigipv6setup=0

Mon Mar 18 15:02:22 2013 us=749060 /sbin/ifconfig 10.8.0.1 pointopoint 10.8.0.2 mtu 1500

SIOCSIFADDR: No such device

: ERROR while getting interface flags: No such device

SIOCSIFDSTADDR: No such device

: ERROR while getting interface flags: No such device

SIOCSIFMTU: No such device

Mon Mar 18 15:02:22 2013 us=765084 Linux ifconfig failed: external program exited with error status: 1

Mon Mar 18 15:02:22 2013 us=765186 Exiting

I looked and /dev/net is missing so presumably any reference to /dev/net/tun is sure to fail. That's where I'm at right now, looking around further though.

Update: kernel reports CONFIG_TUN=y so there's no module to load and I'm seeing "tun: Universal TUN/TAP device driver, 1.6

tun: (C) 1999-2004 Max Krasnyansky <[email protected]>" at boot so I'm at a loss as to why this problem has surfaced after rebooting. Could this be a linode kernel issue or perhaps related to an Ubuntu 12.04 update?

Since you're seeing the TUN/TAP boot message, I'd suggest that it's probably not the kernel but more likely a problem of udev not creating the proper entry in /dev.

jphelps,

I observed the same thing last weekend. I am on Ubuntu 12.04 LTS (32 bit). My OpenVPN TUN server was working fine, until I rebooted to pick up kernel 3.7.10. That was last weekend. The /dev/tun device disappeared. I asked about it in IRC; and someone mentioned the udev possibility. However, I'm not that familiar with it. I think something in the new kernel caused the issue.

How to fix it:

linode:~$ cd /dev
linode:~$ sudo MAKEDEV tun
linode:~$ sudo openvpn --mktun --dev tun0

I thought that doing that and then an openvpn restart would have been enough. But I ended up with a tun1 instead of a tun0. This might have been because I had an existing installation. So I rebooted again, and tun0 came up and worked fine.

I hope this helps.

@fuzzman442:

jphelps,

I observed the same thing last weekend. I am on Ubuntu 12.04 LTS (32 bit). My OpenVPN TUN server was working fine, until I rebooted to pick up kernel 3.7.10. That was last weekend. The /dev/tun device disappeared. I asked about it in IRC; and someone mentioned the udev possibility. However, I'm not that familiar with it. I think something in the new kernel caused the issue.

How to fix it:

linode:~$ cd /dev
linode:~$ sudo MAKEDEV tun
linode:~$ sudo openvpn --mktun --dev tun0

I thought that doing that and then an openvpn restart would have been enough. But I ended up with a tun1 instead of a tun0. This might have been because I had an existing installation. So I rebooted again, and tun0 came up and worked fine.

I hope this helps.
I've tried a few things but your comment has definitely helped me, thanks.

An apt-get update/upgrade cycle showed udev needing updates however doing so didn't help, nor did rebooting.

So I tried MAKEDEV tun though I'm skeptical that does anything meaningful with udev. No help there.

However openvpn --mktun --dev tun0 showed expected output and /etc/init.d/openvpn start immediately afterward worked normally. I rebooted and openvpn had started normally.

I was having the same problem (no /dev/net/tun) after upgrading from Ubuntu 10.04 to 12.04. In my case it was fixed by running

sudo udevadm trigger

There was no need to manually create the /dev entry.

Sorry for posting on a old thread. I just found this thread while trying to solve the same issue.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct