Monday, July 29, 2013

How to manually install the OpenVPN binary

It seems that since the upgrade to Android 4.3 the OpenVPN Installer App is not working for me any more. I get some error saying /system cannot be mounted writeable (rw).
However, it is still possible to install the openvpn binary per hand... and it is not as complicated as it seems! This guide only works on rooted devices and is written for Linux users, however the lower part should also work on Windows and Mac.

At first you need to get the Android Debug Bridge binary and install it on your computer (I just put it into $HOME/bin).
Then download the latest OpenVPN Installer APK - we need to extract the openvpn binary from this package:
wget http://android-openvpn-installer.googlecode.com/files/OpenVPN-Installer-0.2.4.apk
To extract the xbin-binary, you can use FileRoller on Gnome or any other tool. Here is an example of how do it with the terminal only:
unzip OpenVPN-Installer-0.2.4.apk assets/openvpn-2.1.1-static-xbin
mv assets/openvpn-2.1.1-static-xbin openvpn
rm -r assets
Now use adb to push the binary to your phone/tablet's "sdcard" (external storage):
adb push openvpn /sdcard/
The next two commands will open a shell and give us root access on your Android device. Everything you type afterwards happens directly on your device, so be careful!
adb shell
su
Now we need to mount /system as writeable to be able to make changes. Next we copy the binary to its final location and delete it on the sdcard (unfortunately moving is not possible). After we changed the file-permissions so that the binary can be executed, we need to mount /system as read-only again:
mount -o remount rw /system
cp /sdcard/openvpn /system/xbin/
rm /sdcard/openvpn
chmod 755 /system/xbin/openvpn
mount -o remount ro /system
Everything should be done now. Close the connection to your device by typing exit two times and try to use OpenVPN Settings! The installer app will also show you "Binary installed" if everything worked!

22 comments:

  1. if you get a error during connecting that ifconfig cannot be executed.

    before you remount system ro you need to make a symlink for ifconfig to busybox. the openvpn binary seems to want it in /system/xbin but busybox seems for forget the symlink (but managed to do /system/bin/toolbox *shrug*).

    ln -s /system/xbin/busybox ifconfig

    and it works.

    ReplyDelete
  2. Thanks for the howto! It helped me until I found a workaround for the OpenVPN Installer App itself, as it is open-source, here is the fix to make it work on Android 4.3:
    http://code.google.com/p/android-openvpn-installer/issues/detail?id=23

    ReplyDelete
  3. Should you get a error during connecting that ifconfig can't be executed.

    Before you remount system ro you have to make a symlink for ifconfig in order to busybox. the openvpn binary appears to want it in /system/xbin but busybox seems for your investment symlink (but managed to perform /system/bin/toolbox *shrug*.

    See more, Tour2Chernobyl

    ReplyDelete
  4. I used ssh (not ADB) to copy openvpn from pc (Debian+ssh) to smartphone (ssh droid), it is the same and it work! :)

    Thank you for this article, it is very helpful!!!

    ReplyDelete
  5. Props! Great How-To.

    The easiest way to get the 'openvpn' binary is to download the apk by clicking the link you provided and simply rename the file extension to .zip. Most file browsers can handle this natively.

    ReplyDelete
  6. Anyone else having issues with the openvpn binary on android 4.4?

    ReplyDelete
  7. for all you that have problem on android 4.4 use this openvpn installer. off course first uninstall any other version that you may have
    http://android-openvpn-installer.googlecode.com/issues/attachment?aid=230007000&name=android-openvpn-installer-use_su_for_proc_mounts-fixed.patch&token=-BgBqaHCaDMcP7TDvHsJoLw42pk%3A1387359913578

    ReplyDelete
    Replies
    1. sorry this is correct link http://android-openvpn-installer.googlecode.com/issues/attachment?aid=230010000&name=OpenVPNInstaller-debug.apk&token=nSlxvyZmWStEHns82ncwgvrOvkk%3A1387359913579

      Delete
  8. Dear author, thank you very much. Works perfectly on Google Nexus 7 2013 with latest official (rooted) rom. You saved me lot of time. :)

    Joe

    ReplyDelete
  9. Hi,

    nice, articel. I run over and over again trough your tutorial after fresh install android rom or get new phone and even help friends. So great job dude!

    Regards,

    Ivan

    ReplyDelete
  10. on android 5.0.1 it's not working and if i try to launch

    root@hammerhead:/system/xbin # openvpn
    error: only position independent executables (PIE) are supported.

    ReplyDelete
    Replies
    1. did you find a fix for it?

      Delete
    2. getting the same :-/

      Delete
    3. http://forum.xda-developers.com/sprint-galaxy-s5/help/openvpn-binary-lollipop-s5-t3086672#post64696367

      Delete
  11. am using waselpro vpn service for my android device , it's very secured and fast

    http://www.openvpnandroid.com/openvpn-for-android/

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Hello i've a Problem to make a VPN Connection (Android 4.4.4) when the file ip is not located in the folder /sbin. Actually it's in the Folder /system/bin

    The Problem is when i copy the file in the Folder /sbin it would be removed from System after a Reboot. How i can solve this problem?

    ReplyDelete
    Replies
    1. Have solved the problem. Installed another VPN App. This works now :)

      Delete
  14. Hi I really appreciate your all efforts which is specially for the stock.
    well done.


    stock recommendations

    ReplyDelete
  15. Your blog is awesome. You have shared very valuable information to us. Thank you so much for sharing this.

    connect vpn

    ReplyDelete
  16. Follow the links on the first page of results for the search terms you're interested in optimizing for. sell backlinks

    ReplyDelete