[Fire TV General] melclic:
Hello all,

I am trying to run openvpn on the aftv stick (OS 5.2.1.0) that has been rooted. There are reports of successes online (cannot post link apprently)

I performed the following steps:

1) Root the device using kingoroot

2) Installed the openvpn installer manually (could not do it through the GUI), that involved transferring the executable openvpn to /system/xbin

3) Installed BusyBox

4) Pushed my ovpn configuration files to /sdcard/openvpn

5) Installed the openVPN settings apk

6) Logged into abd shell and ran the following command:

# su
# openvpn --iproute /system/xbin/ip --config my_file.ovpn

I had to specify the iproute because openvpn looks for iproute2 in /sbin/ip and not /system/xbin/ip.

Although it connects, the public IP does not change..... FAIL

Here is the log of the command above:

Sat Jul 9 17:52:55 2016 OpenVPN 2.1.1 jc v0.1 i686-pc-linux-gnu [SSL] [LZO2] [EPOLL] built on Aug 7 2015
Sat Jul 9 17:52:55 2016 WARNING: file 'pass.txt' is group or others accessible
Sat Jul 9 17:52:55 2016 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Sat Jul 9 17:52:55 2016 NOTE: --fast-io is disabled since we are not using UDP
Sat Jul 9 17:52:55 2016 LZO compression initialized
Sat Jul 9 17:52:55 2016 Attempting to establish TCP connection with 195.154.235.91:443 [nonblock]
Sat Jul 9 17:52:56 2016 TCP connection established with 195.154.235.91:443
Sat Jul 9 17:52:56 2016 TCPv4_CLIENT link local: [undef]
Sat Jul 9 17:52:56 2016 TCPv4_CLIENT link remote: 195.154.235.91:443
Sat Jul 9 17:52:56 2016 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Sat Jul 9 17:52:57 2016 WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1544', remote='link-mtu 1576'
Sat Jul 9 17:52:57 2016 WARNING: 'tun-mtu' is used inconsistently, local='tun-mtu 1500', remote='tun-mtu 1532'
Sat Jul 9 17:52:57 2016 [TG-OVPN-CA] Peer Connection Initiated with 195.154.235.91:443
Sat Jul 9 17:52:59 2016 TUN/TAP device tun0 opened
Sat Jul 9 17:52:59 2016 /system/xbin/ip link set dev tun0 up mtu 1500
Sat Jul 9 17:52:59 2016 /system/xbin/ip addr add dev tun0 local 10.8.0.14 peer 10.8.0.13
Sat Jul 9 17:52:59 2016 NOTE: unable to redirect default gateway -- Cannot read current default gateway from system
ip: RTNETLINK answers: No such process
Sat Jul 9 17:52:59 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sat Jul 9 17:52:59 2016 Initialization Sequence Completed
^CSat Jul 9 17:53:13 2016 event_wait : Interrupted system call (code=4)
Sat Jul 9 17:53:13 2016 /system/xbin/ip addr del dev tun0 local 10.8.0.14 peer 10.8.0.13
Sat Jul 9 17:53:13 2016 SIGINT[hard,] received, process exiting
iproute /system/xbin/ip --config TorGuard.France.ovpn <
Sat Jul 9 17:53:52 2016 OpenVPN 2.1.1 jc v0.1 i686-pc-linux-gnu [SSL] [LZO2] [EPOLL] built on Aug 7 2015
Sat Jul 9 17:53:52 2016 WARNING: file 'pass.txt' is group or others accessible
Sat Jul 9 17:53:52 2016 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Sat Jul 9 17:53:52 2016 NOTE: --fast-io is disabled since we are not using UDP
Sat Jul 9 17:53:52 2016 LZO compression initialized
Sat Jul 9 17:53:52 2016 Attempting to establish TCP connection with 195.154.235.91:443 [nonblock]
Sat Jul 9 17:53:53 2016 TCP connection established with 195.154.235.91:443
Sat Jul 9 17:53:53 2016 TCPv4_CLIENT link local: [undef]
Sat Jul 9 17:53:53 2016 TCPv4_CLIENT link remote: 195.154.235.91:443
Sat Jul 9 17:53:53 2016 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Sat Jul 9 17:53:54 2016 WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1544', remote='link-mtu 1576'
Sat Jul 9 17:53:54 2016 WARNING: 'tun-mtu' is used inconsistently, local='tun-mtu 1500', remote='tun-mtu 1532'
Sat Jul 9 17:53:54 2016 [TG-OVPN-CA] Peer Connection Initiated with 195.154.235.91:443
Sat Jul 9 17:53:56 2016 TUN/TAP device tun0 opened
Sat Jul 9 17:53:56 2016 /system/xbin/ip link set dev tun0 up mtu 1500
Sat Jul 9 17:53:56 2016 /system/xbin/ip addr add dev tun0 local 10.8.0.14 peer 10.8.0.13
Sat Jul 9 17:53:56 2016 NOTE: unable to redirect default gateway -- Cannot read current default gateway from system
ip: RTNETLINK answers: No such process
Sat Jul 9 17:53:56 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sat Jul 9 17:53:56 2016 Initialization Sequence Completed

It seems that the key in the log are these two lines:

Sat Jul 9 17:53:56 2016 NOTE: unable to redirect default gateway -- Cannot read current default gateway from system
ip: RTNETLINK answers: No such process
Sat Jul 9 17:53:56 2016 ERROR: Linux route add command failed: external program exited with error status: 2

I guess this is a problem with the routing table, however this is the limit of my knowledge.

Although most people suggest using a DDWRT router for this, it seems strange to me that it won't work even on this highly modified version of android.

Any help would be very much appreciated

EDIT: OK I realised the cause of the error came from the fact that I was using a bad openvpn binary when I was installing it (step 2) (sorry no links because of xda policy) manually. It explains why I had to specify the --iproute since it was pointing to it in /sbin when it was in /xbin. The error is because it uses the native ifconfig, and we need it to use the busybox ifconfig

If I extract the correct one (with busybox bin) I get:

error: only position independent executables (PIE) are supported.[\CODE]
Apparently this is a new security feature from google. This means that openvpn needs to be compiled with PIE and the correct paths for the xbin ip and ifconfig.

Any one knows how to do that?