ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
markengel
OpenVpn Newbie
Posts: 4
Joined: Sat Nov 18, 2017 2:47 pm

ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Post by markengel » Sat Nov 18, 2017 3:03 pm

Hi,

I'm running OpenVPN by the PIVPN setup on a VPS. Also having a add-blocker running on the same server (Pi-hole)
Made some clients for my phones, tablet, pc and raspberry Pi.
Using the gui for windows, OpenVPN connect for android, everything works fine. No problems so far....

Now i try to connect the Raspberry Pi and it will not connect.

Installed:
sudo apt-get install network-manager-openvpn-gnome
sudo apt-get update && sudo apt-get install openvpn

I use this command: openvpn --config test.ovpn

this is what happens:

pi@nextcloudpi:~/Downloads $ openvpn --config test.ovpn
Sat Nov 18 15:41:42 2017 OpenVPN 2.4.0 arm-unknown-linux-gnueabihf [SSL (OpenSSL )] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jul 18 2017
Sat Nov 18 15:41:42 2017 library versions: OpenSSL 1.0.2l 25 May 2017, LZO 2.08
Enter Private Key Password: ***********
Sat Nov 18 15:41:46 2017 WARNING: this configuration may cache passwords in memo ry -- use the auth-nocache option to prevent this
Sat Nov 18 15:41:46 2017 TCP/UDP: Preserving recently used remote address: [AF_I NET]162.252.xxx.xxx:1194
Sat Nov 18 15:41:46 2017 UDP link local: (not bound)
Sat Nov 18 15:41:46 2017 UDP link remote: [AF_INET]162.252.xxx.xxx:1194
Sat Nov 18 15:41:48 2017 [server_xxxxxxxxxxxx] Peer Connection Initiated wit h [AF_INET]162.252.xxx.xxx:1194
Sat Nov 18 15:41:49 2017 ERROR: Cannot ioctl TUNSETIFF tun: Operation not permit ted (errno=1)
Sat Nov 18 15:41:49 2017 Exiting due to fatal error


Anyone know what this mean?

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Post by TinCanTech » Sat Nov 18, 2017 4:48 pm

Try:

Code: Select all

$ sudo openvpn --config test.ovpn

markengel
OpenVpn Newbie
Posts: 4
Joined: Sat Nov 18, 2017 2:47 pm

Re: ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Post by markengel » Sat Nov 18, 2017 7:50 pm

well...., it did something! Thnx
Mayby a bit stupid :)

now i see another error

pi@nextcloudpi:~/Downloads $ sudo openvpn --config test.ovpn
Sat Nov 18 20:41:31 2017 OpenVPN 2.4.0 arm-unknown-linux-gnueabihf [SSL (OpenSSL )] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jul 18 2017
Sat Nov 18 20:41:31 2017 library versions: OpenSSL 1.0.2l 25 May 2017, LZO 2.08
Enter Private Key Password: ********
Sat Nov 18 20:41:38 2017 WARNING: this configuration may cache passwords in memo ry -- use the auth-nocache option to prevent this
Sat Nov 18 20:41:38 2017 TCP/UDP: Preserving recently used remote address: [AF_I NET]162.252.xxx.xxx:1194
Sat Nov 18 20:41:38 2017 UDP link local: (not bound)
Sat Nov 18 20:41:38 2017 UDP link remote: [AF_INET]162.252.xxx.xxx:1194
Sat Nov 18 20:41:41 2017 [server_FqKy59HTcYmYceje] Peer Connection Initiated wit h [AF_INET]162.252.xxx.xxx:1194
Sat Nov 18 20:41:42 2017 TUN/TAP device tun1 opened
Sat Nov 18 20:41:42 2017 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Sat Nov 18 20:41:42 2017 /sbin/ip link set dev tun1 up mtu 1500
Sat Nov 18 20:41:42 2017 /sbin/ip addr add dev tun1 10.8.0.6/24 broadcast 10.8.0 .255
RTNETLINK answers: File exists
Sat Nov 18 20:41:42 2017 ERROR: Linux route add command failed: external program exited with error status: 2
RTNETLINK answers: File exists
Sat Nov 18 20:41:42 2017 ERROR: Linux route add command failed: external program exited with error status: 2
RTNETLINK answers: File exists
Sat Nov 18 20:41:42 2017 ERROR: Linux route add command failed: external program exited with error status: 2
RTNETLINK answers: File exists
Sat Nov 18 20:41:42 2017 ERROR: Linux route add command failed: external program exited with error status: 2
RTNETLINK answers: File exists
Sat Nov 18 20:41:42 2017 ERROR: Linux route add command failed: external program exited with error status: 2
RTNETLINK answers: File exists
Sat Nov 18 20:41:42 2017 ERROR: Linux route add command failed: external program exited with error status: 2
Sat Nov 18 20:41:42 2017 Initialization Sequence Completed

And how can i see if it works or not works?

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Post by TinCanTech » Sat Nov 18, 2017 9:56 pm

markengel wrote:
Sat Nov 18, 2017 7:50 pm
Sat Nov 18 20:41:42 2017 /sbin/ip addr add dev tun1 10.8.0.6/24 broadcast 10.8.0 .255
RTNETLINK answers: File exists
Sat Nov 18 20:41:42 2017 ERROR: Linux route add command failed: external program exited with error status: 2
You can only run the same config once .. if you want to start it again make sure you stopped it first ..

Perhaps you need to start here:
https://openvpn.net/index.php/open-sour ... howto.html

markengel
OpenVpn Newbie
Posts: 4
Joined: Sat Nov 18, 2017 2:47 pm

Re: ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Post by markengel » Sat Nov 18, 2017 10:21 pm

Dont know how that happens. After a reboot it's doing the same thing. I dont think its running automaticly after a reboot. I test it with the server.
Is it possible it means something else?

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Post by TinCanTech » Sat Nov 18, 2017 10:42 pm


markengel
OpenVpn Newbie
Posts: 4
Joined: Sat Nov 18, 2017 2:47 pm

Re: ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Post by markengel » Sun Nov 19, 2017 8:14 am

Thnx, i will do.

Post Reply