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

I am runing on Hyper-V OpenWRT 18.06.1 (openwrt-18.06.1-x86-64-rootfs-ext4) and install openvpn-openssl.
But cant start OpenVPN.

Wed Sep  5 17:12:37 2018 daemon.notice openvpn(xx)[7311]: OpenVPN 2.4.5 x86_64-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
Wed Sep  5 17:12:37 2018 daemon.notice openvpn(xx)[7311]: library versions: OpenSSL 1.0.2p  14 Aug 2018, LZO 2.10
Wed Sep  5 17:12:37 2018 daemon.warn openvpn(xx)[7311]: NOTE: your local LAN uses the extremely common subnet address 192.168.0.x or 192.168.1.x.  Be aware that this might create routing conflicts if you connect to the VPN server from public locations such as internet cafes that use the same subnet.
Wed Sep  5 17:12:37 2018 daemon.notice openvpn(xx)[7311]: Diffie-Hellman initialized with 1024 bit key
Wed Sep  5 17:12:37 2018 daemon.err openvpn(xx)[7311]: ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Wed Sep  5 17:12:37 2018 daemon.notice openvpn(xx)[7311]: Exiting due to fatal error

What is wrong?

OpenVPN conf

config openvpn 'xx'
option port '1194'
option proto 'udp'
option dev 'tun1'
option comp_lzo 'no'
#option compress 'no'
list push 'comp-lzo no'
option ca '/etc/config/xx/ca.crt'
option cert '/etc/config/xx/server.crt'
option key '/etc/config/xx/server.key'
option dh '/etc/config/xx/dh1024.pem'
#option crl_verify '/etc/config/xx/crl.pem'
option mssfix '1420'
option keepalive '10 120'
option verb '3'
option persist_key '1'
option persist_tun '1'
option server '10.8.1.0 255.255.255.0'
option ifconfig_pool_persist '/etc/config/xx/ipp.txt'
option status '/tmp/openvpn-xx-status.log'
option enabled '1'

commands results:

root@OpenWrt-18:~# opkg install kmod-tun
Package kmod-tun (4.14.63-1) installed in root is up to date.

root@OpenWrt-18:~# modprobe tun
root@OpenWrt-18:~# insmod tun
Failed to find the folder holding the modules

root@OpenWrt-18:~# opkg files kmod-tun
Package kmod-tun (4.14.63-1) is installed on root and has the following files:
/lib/modules/4.14.63/tun.ko
/etc/modules.d/30-tun

root@OpenWrt-18:~# rmmod tun
module is not loaded

root@OpenWrt-18:~#  insmod tun
Failed to find the folder holding the modules
opkg list-installed

root@OpenWrt-18:~# opkg list-installed
base-files - 192-r7258-5eb055306f
busybox - 1.28.3-4
dnsmasq - 2.80test3-1
dropbear - 2017.75-5
e2fsprogs - 1.44.1-1
firewall - 2018-07-26-aa8846bb-1
fstools - 2018-04-16-e2436836-1
fwtool - 1
ip-tiny - 4.16.0-4
ip6tables - 1.6.2-1
iptables - 1.6.2-1
jshn - 2018-07-25-c83a84af-1
jsonfilter - 2018-02-04-c7e938d6-1
kernel - 4.14.63-1-67b897e79861d89c01af0fcee8f0f7e6
kmod-button-hotplug - 4.14.63-3
kmod-e1000 - 4.14.63-1
kmod-e1000e - 4.14.63-1
kmod-hwmon-core - 4.14.63-1
kmod-i2c-algo-bit - 4.14.63-1
kmod-i2c-core - 4.14.63-1
kmod-igb - 4.14.63-1
kmod-input-core - 4.14.63-1
kmod-ip6tables - 4.14.63-1
kmod-ipt-conntrack - 4.14.63-1
kmod-ipt-core - 4.14.63-1
kmod-ipt-nat - 4.14.63-1
kmod-ipt-offload - 4.14.63-1
kmod-lib-crc-ccitt - 4.14.63-1
kmod-mii - 4.14.63-1
kmod-nf-conntrack - 4.14.63-1
kmod-nf-conntrack6 - 4.14.63-1
kmod-nf-flow - 4.14.63-1
kmod-nf-ipt - 4.14.63-1
kmod-nf-ipt6 - 4.14.63-1
kmod-nf-nat - 4.14.63-1
kmod-nf-reject - 4.14.63-1
kmod-nf-reject6 - 4.14.63-1
kmod-ppp - 4.14.63-1
kmod-pppoe - 4.14.63-1
kmod-pppox - 4.14.63-1
kmod-pps - 4.14.63-1
kmod-ptp - 4.14.63-1
kmod-r8169 - 4.14.63-1
kmod-slhc - 4.14.63-1
kmod-tun - 4.14.63-1
kmod-udptunnel4 - 4.14.63-1
kmod-udptunnel6 - 4.14.63-1
kmod-wireguard - 4.14.63+0.0.20180718-2
libblkid - 2.32-2
libblobmsg-json - 2018-07-25-c83a84af-1
libc - 1.1.19-1
libcomerr - 1.44.1-1
libext2fs - 1.44.1-1
libf2fs - 1.10.0-1
libgcc - 7.3.0-1
libip4tc - 1.6.2-1
libip6tc - 1.6.2-1
libiwinfo - 2018-07-24-94b1366d-1
libiwinfo-lua - 2018-07-24-94b1366d-1
libjson-c - 0.12.1-1
libjson-script - 2018-07-25-c83a84af-1
liblua - 5.1.5-1
liblucihttp - 2018-05-18-cb119ded-1
liblucihttp-lua - 2018-05-18-cb119ded-1
liblzo - 2.10-1
libmnl - 1.0.4-1
libnl-tiny - 0.1-5
libopenssl - 1.0.2p-1
libpthread - 1.1.19-1
librt - 1.1.19-1
libsmartcols - 2.32-2
libss - 1.44.1-1
libubox - 2018-07-25-c83a84af-1
libubus - 2018-07-26-40e0931e-1
libubus-lua - 2018-07-26-40e0931e-1
libuci - 2018-08-11-4c8b4d6e-1
libuci-lua - 2018-08-11-4c8b4d6e-1
libuclient - 2018-08-03-ae1c656f-1
libuuid - 2.32-2
libxtables - 1.6.2-1
logd - 2018-02-14-128bc35f-2
lua - 5.1.5-1
luci - git-18.228.31946-f64b152-1
luci-app-commands - git-18.247.71242-9541751-1
luci-app-firewall - git-18.228.31946-f64b152-1
luci-app-openvpn - git-18.247.71242-9541751-1
luci-app-wireguard - git-18.247.71242-9541751-1
luci-base - git-18.228.31946-f64b152-1
luci-lib-ip - git-18.228.31946-f64b152-1
luci-lib-jsonc - git-18.228.31946-f64b152-1
luci-lib-nixio - git-18.228.31946-f64b152-1
luci-mod-admin-full - git-18.228.31946-f64b152-1
luci-proto-ipv6 - git-18.228.31946-f64b152-1
luci-proto-ppp - git-18.228.31946-f64b152-1
luci-proto-wireguard - git-18.247.71242-9541751-1
luci-theme-bootstrap - git-18.228.31946-f64b152-1
mkf2fs - 1.10.0-1
mtd - 23
netifd - 2018-07-30-a0a1e52e-1
odhcp6c - 2018-07-14-67ae6a71-14
odhcpd-ipv6only - 1.10-1
openvpn-openssl - 2.4.5-4
openwrt-keyring - 2018-05-18-103a32e9-1
opkg - 2017-12-07-3b417b9f-2
partx-utils - 2.32-2
ppp - 2.4.7-12
ppp-mod-pppoe - 2.4.7-12
procd - 2018-03-28-dfb68f85-1
r8169-firmware - 2017-09-06-a61ac5cf-1
rpcd - 2018-08-16-41333abe-1
rpcd-mod-rrdns - 20170710
ubox - 2018-02-14-128bc35f-2
ubus - 2018-07-26-40e0931e-1
ubusd - 2018-07-26-40e0931e-1
uci - 2018-08-11-4c8b4d6e-1
uclient-fetch - 2018-08-03-ae1c656f-1
uhttpd - 2018-06-26-796d42bc-1
usign - 2015-07-04-ef641914-1
wireguard - 0.0.20180718-2
wireguard-tools - 0.0.20180718-2
zabbix-agentd - 3.2.7-2
zabbix-extra-mac80211 - 3.2.7-2
zabbix-extra-network - 3.2.7-2
zabbix-extra-wifi - 3.2.7-2
zlib - 1.2.11-2

P.S. I am running LEDE Reboot 17.01.4 r3560 (lede-17.01.4-x86-64-rootfs-ext4) on Hyper-V, and have no problems...

command "lsmod" return nothing...

root@OpenWrt-18:~# lsmod
root@OpenWrt-18:~# lsmod

Wireguard not work too.

Wed Sep  5 17:59:42 2018 daemon.notice netifd: wg (13738): RTNETLINK answers: Not supported
Wed Sep  5 17:59:42 2018 daemon.notice netifd: wg (13738): Unable to modify interface: Protocol not supported

Looks like neither insmod nor modprobe can find the directory where the modules are being kept, and no module is being loaded at all. I would start by checking that "/lib/modules/4.14.63/tun.ko" does exists, and all the folders in that path have the correct permissions. You can also try to execute "insmod /lib/modules/4.14.63/tun.ko", and see what happens.

root@OpenWrt-18:~# insmod /lib/modules/4.14.63/tun.ko
Failed to find the folder holding the modules

ls -n /lib/modules/4.14.63
root@OpenWrt-18:~# ls -n /lib/modules/4.14.63
-rw-r--r--    1 0        0             8168 Aug 16 15:51 button-hotplug.ko
-rw-r--r--    1 0        0             2928 Aug 16 15:51 crc-ccitt.ko
-rw-r--r--    1 0        0           133920 Aug 16 15:51 e1000.ko
-rw-r--r--    1 0        0           231536 Aug 16 15:51 e1000e.ko
-rw-r--r--    1 0        0            10096 Aug 16 15:51 i2c-algo-bit.ko
-rw-r--r--    1 0        0            12408 Aug 16 15:51 i2c-dev.ko
-rw-r--r--    1 0        0           206128 Aug 16 15:51 igb.ko
-rw-r--r--    1 0        0            20752 Aug 16 15:51 ip6_tables.ko
-rw-r--r--    1 0        0             3824 Aug 17 00:36 ip6_udp_tunnel.ko
-rw-r--r--    1 0        0             4432 Aug 16 15:51 ip6t_REJECT.ko
-rw-r--r--    1 0        0             4728 Aug 16 15:51 ip6table_filter.ko
-rw-r--r--    1 0        0             4624 Aug 16 15:51 ip6table_mangle.ko
-rw-r--r--    1 0        0            21104 Aug 16 15:51 ip_tables.ko
-rw-r--r--    1 0        0             3728 Aug 16 15:51 ipt_MASQUERADE.ko
-rw-r--r--    1 0        0             4432 Aug 16 15:51 ipt_REJECT.ko
-rw-r--r--    1 0        0             4728 Aug 16 15:51 iptable_filter.ko
-rw-r--r--    1 0        0             4552 Aug 16 15:51 iptable_mangle.ko
-rw-r--r--    1 0        0             4640 Aug 16 15:51 iptable_nat.ko
-rw-r--r--    1 0        0             8984 Aug 16 15:51 mii.ko
-rw-r--r--    1 0        0           111520 Aug 16 15:51 nf_conntrack.ko
-rw-r--r--    1 0        0            13816 Aug 16 15:51 nf_conntrack_ipv4.ko
-rw-r--r--    1 0        0            13640 Aug 16 15:51 nf_conntrack_ipv6.ko
-rw-r--r--    1 0        0             7824 Aug 16 15:51 nf_conntrack_rtcache.ko
-rw-r--r--    1 0        0             4568 Aug 16 15:51 nf_defrag_ipv4.ko
-rw-r--r--    1 0        0            13368 Aug 16 15:51 nf_defrag_ipv6.ko
-rw-r--r--    1 0        0            21720 Aug 16 15:51 nf_flow_table.ko
-rw-r--r--    1 0        0             6728 Aug 16 15:51 nf_flow_table_hw.ko
-rw-r--r--    1 0        0             6824 Aug 16 15:51 nf_log_common.ko
-rw-r--r--    1 0        0             9464 Aug 16 15:51 nf_log_ipv4.ko
-rw-r--r--    1 0        0            13280 Aug 16 15:51 nf_log_ipv6.ko
-rw-r--r--    1 0        0            20272 Aug 16 15:51 nf_nat.ko
-rw-r--r--    1 0        0             8512 Aug 16 15:51 nf_nat_ipv4.ko
-rw-r--r--    1 0        0             4712 Aug 16 15:51 nf_nat_masquerade_ipv4.ko
-rw-r--r--    1 0        0             3304 Aug 16 15:51 nf_nat_redirect.ko
-rw-r--r--    1 0        0             4880 Aug 16 15:51 nf_reject_ipv4.ko
-rw-r--r--    1 0        0             5456 Aug 16 15:51 nf_reject_ipv6.ko
-rw-r--r--    1 0        0            13552 Aug 16 15:51 ppp_async.ko
-rw-r--r--    1 0        0            44088 Aug 16 15:51 ppp_generic.ko
-rw-r--r--    1 0        0            21016 Aug 16 15:51 pppoe.ko
-rw-r--r--    1 0        0             4880 Aug 16 15:51 pppox.ko
-rw-r--r--    1 0        0            14528 Aug 16 15:51 pps_core.ko
-rw-r--r--    1 0        0            20168 Aug 16 15:51 ptp.ko
-rw-r--r--    1 0        0           107056 Aug 16 15:51 r8169.ko
-rw-r--r--    1 0        0             8024 Aug 16 15:51 slhc.ko
-rw-r--r--    1 0        0            41544 Aug 17 00:36 tun.ko
-rw-r--r--    1 0        0             5976 Aug 17 00:36 udp_tunnel.ko
-rw-r--r--    1 0        0           235360 Aug 17 00:36 wireguard.ko
-rw-r--r--    1 0        0            29512 Aug 16 15:51 x_tables.ko
-rw-r--r--    1 0        0             7144 Aug 16 15:51 xt_CT.ko
-rw-r--r--    1 0        0             8344 Aug 16 15:51 xt_FLOWOFFLOAD.ko
-rw-r--r--    1 0        0             3632 Aug 16 15:51 xt_LOG.ko
-rw-r--r--    1 0        0             3824 Aug 16 15:51 xt_REDIRECT.ko
-rw-r--r--    1 0        0             6312 Aug 16 15:51 xt_TCPMSS.ko
-rw-r--r--    1 0        0             2840 Aug 16 15:51 xt_comment.ko
-rw-r--r--    1 0        0             5312 Aug 16 15:51 xt_conntrack.ko
-rw-r--r--    1 0        0             4072 Aug 16 15:51 xt_limit.ko
-rw-r--r--    1 0        0             2904 Aug 16 15:51 xt_mac.ko
-rw-r--r--    1 0        0             3376 Aug 16 15:51 xt_mark.ko
-rw-r--r--    1 0        0             3656 Aug 16 15:51 xt_multiport.ko
-rw-r--r--    1 0        0             5240 Aug 16 15:51 xt_nat.ko
-rw-r--r--    1 0        0             3464 Aug 16 15:51 xt_state.ko
-rw-r--r--    1 0        0             4760 Aug 16 15:51 xt_tcpudp.ko
-rw-r--r--    1 0        0             4816 Aug 16 15:51 xt_time.ko

I wonder why tun and wireguard .ko files have 9 hours later timestamp than all other modules.

Is that the official release?
Or your own build? (and a clean build after make clean?)

Official. I downloaded from there https://downloads.openwrt.org/releases/18.06.1/targets/x86/64/openwrt-18.06.1-x86-64-rootfs-ext4.img.gz

I'm clueless now...

uname -a ?

Perhaps there is a mismatch on the kernel version?

root@OpenWrt-18:~# uname -a
Linux OpenWrt-18 4.14.37 #0 SMP Wed May 2 13:32:07 2018 x86_64 GNU/Linux
2018-09-07_11-37-27

That is not a 18.06.1 build. Much older.
(you have 4.14.37 kernel, so no wonder that 4.14.63 kmods do not work)

I am not a x86 specialist, but I think that there is somehow a mix of different versions in your system.

2 Likes

Thank you! :slight_smile: I found problem, I forgot to change the kernel.
Installed old kernel from trunk, need install that from release.
https://downloads.openwrt.org/releases/18.06.1/targets/x86/64/openwrt-18.06.1-x86-64-vmlinuz

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.