My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
LoadingTheTunModule  
How to load the tun kernel module.
Updated Jul 28, 2009 by wmeal...@gmail.com

Introduction

Recent ROMS released by the community have the tun module already enabled.

To find the tun.ko module..

su

cd /
find -iname tun.ko
/system/modules/somethingelse/something/tun.ko

This directory is the location of the tun kernel module. A plan later is to have the software search for the tun kernel module and download it for the rom that is missing.

insmod /system/modules/somethingelse/something/tun.ko
Comment by blue...@gmail.com, May 24, 2010

Where should I save the tun.ko file downloaded from this site if I am unable to find it?

Comment by mszym...@gmail.com, Jun 13, 2010

Ummm. This is not a wiki or set of instructions. Guys, you need to put together a step by step guide for tun or remove this page. All this current page manages to do is anoy people with the lack of detail.

Comment by unvi...@gmail.com, Jul 1, 2010

http://forum.xda-developers.com/showthread.php?t=698099

tun.ko for EVO

Agree that there should be a little more explanation on this page. We've added alot more 'nix noobs to the picture with android.

Comment by mgof...@gmail.com, Jul 6, 2010

I keep getting an invalid module format error attempting to insmod the tun.ko downloaded from here. doing a find doesn't show it exists anywhere else. i've tried doing a cp from the sdcard, as well as using adb push on a remounted /, as well as using Root Explorer to put the file in place.

Comment by eddie.mora@ottoinstrument.com, Jul 22, 2010

I was able to put the tun.ko into /system/bin, but when I tried to execute "insmod /system/bin/tun.ko" I get "failed (Exec format error).

This is on a rooted Droid X (stock ROM, only rooted).

If I try to run VPNC as it is, it will crash as soon as I click connect.

Comment by trogdor3...@gmail.com, Jul 26, 2010

I am also experiencing the same thing on my Droid X. Is there even a tun.ko compiled for our kernel?

Comment by eddie.mora@ottoinstrument.com, Jul 30, 2010

http://forum.xda-developers.com/showthread.php?t=740030

tun.ko for Droid X

Haven't tried it, but thought to post in case someone else would like to try before I do (out on business at the moment).

Comment by mikebut...@gmail.com, Jul 30, 2010

I've almost got this working on a droidx, copy the tun.ko from the site eddie posted to the sd. Then do the commands:

mount -o rw,remount -t yaffs2 /dev/block/mddblock3 /system cp /sdcard/tun.ko /system/lib/modules/ busybox mknod /dev/net/tun char 10 200 ln -s /dev/tun /dev/net/tun insmod /system/lib/modules/tun.ko

If I launch via the gui, I see it connect to my pix successfully, but it reports failure still. It never builds the tun interface or modifies routing. I can ifconfig tun0 up and see the interface. Running the vpnc-script with vpnc seems to show that it's not finding busybox, or not using it, though busybox is in the path and shows all the commands it complains about. Is it looking for somewhere particular from the droidx busybox placement as /system/bin/busybox?

S7.0 run interface setup script

[2010-07-30 20:57:01]
uname: not found basename: not found grep: not found which: not found grep: not found which: not found grep: not found which: not found : permission denied Invalid argument Invalid argument sed: not found Invalid argument Invalid argument Invalid argument Invalid argument expr: not found -lt: unexpected operatorInvalid argument Invalid argument Invalid argument Invalid argument backing up dns and resolve.conf dirname: not found /data/data/org.codeandroid.vpnc_frontend/files/vpnc-script: cannot create /dns1.txt: read-only file system dirname: not found /data/data/org.codeandroid.vpnc_frontend/files/vpnc-script: cannot create /dns2.txt: read-only file system dirname: not found cp: /etc/resolv.conf: No such file or directory expr: not found expr: not found vpnc-script ran to completion

Need to figure out why it's not liking busybox - any ideas? Suppose I need a more automatic on-boot way of loading the modules as well, not sure about android if/how it loads modules at boot.

Comment by mikebut...@gmail.com, Jul 30, 2010

Ok, vpnc works fully now, just need the gui.

Found out the root instructions for droid doesn't fully setup busybox - get-a-robot-vpnc needs symlinks from busybox. Can be installed with the following:

cd /system/bin

busybox --install .

Note the period after the --install, absolutely required. I can then manually launch it via the vpnc_frontend vpnc-script file, get a tun0 interface, ip, and can http to my internal servers. Terrific! I have to manually kill the pid of vpnc after to disconnect, and toggle wifi to replace the dns resolver settings for networking to function again, otherwise doesn't resolve dns names.

Now just need the gui to do it's thing, it still fails. Any way to run the gui in debug mode to log what is broken? Need some help debugging the application itself now.

Comment by eddie.mora@ottoinstrument.com, Aug 3, 2010

Mike, I've done the commands you mention, though I did get an error on the: busybox mknod /dev/net/tun char 10 200 ln -s /dev/tun /dev/net/tun

Is there something that I'm missing? I did not use the .config file mentioned in the link to where the tun.ko file is - was I supposed too? seems it's only for reference.

Also, how do you run vpnc from outside the gui? Not sure I understand this.

Regards

Comment by eddie.mora@ottoinstrument.com, Aug 3, 2010

This is what I get when trying to run vpnc via the script:

uname: not found basename: not found grep: not found which: not found grep: not found which: not found grep: not found which: not found readlink: not found uname: not found basename: not found grep: not found which: not found grep: not found which: not found grep: not found which: not found : permission denied sed: not found Invalid argument Invalid argument Invalid argument Invalid argument expr: not found -lt: unexpected operatorInvalid argument Invalid argument backing up dns and resolve.conf dirname: not found ./vpnc-script: cannot create /dns1.txt: read-only file system dirname: not found ./vpnc-script: cannot create /dns2.txt: read-only file system dirname: not found cp: /etc/resolv.conf: No such file or directory expr: not found vpnc-script ran to completion VPNC started in background (pid: 2192)...

Any thoughts?

Comment by mikebut...@gmail.com, Aug 9, 2010

Sorry Eddie, it mangled the post, and i got annoyed I couldn't fix it.

They're two separate commands, "busybox mknod /dev/net/tun char 10 200" and "ln -s /dev/tun /dev/net/tun insmod /system/lib/modules/tun.ko".

I got those errors as there technically isn't a /etc directory, but it seemed to write the same files fine in vpnc directory and android resolves off the dns servers. All the barking from debug, it'll still connect and build the tun0 interface, getting an ip and setting the dns/gateway correctly. Verify with ifconfig if it builds the tun0 interface. I have to kill the pid of vpnc manually to kill the vpn.

Also that might seem to indicate you don't have that script:

/data/data/org.codeandroid.vpnc_frontend/files/vpnc-script

I seem to remember vpn client having put it there without any other intervention, just make sure it is there and there's no white space in your cut and paste misinterpreting.

The vpn client gui bit just seemed wonky, but the cli works just dandy otherwise. Unfortunately typing a command line arg is a pita on the X, so I just haven't bothered hoping one of the dev's would notice this and/or try on a droid x themselves. :)

I couldn't figure out how to debug the app itself, not sure how the whole android ecosystem works with the apk's, otherwise I'd start stracing it to see what's being stupid with the X. Don't know if you can run the apk's in debug or anything actually helpful, so any advice here and I'd be happy to help.

Google doesn't do any kind of email reply notifications, so email direct, mikebutash not at gmail com if you still have issues with it.

Comment by davis.brian@gmail.com, Aug 12, 2010

I got it to work on my Droid X however I have to run the insmod /system/lib/modules/tun.ko command after every reboot. Any suggestions on getting it to keep the settings after the reboot.

Comment by msno...@gmail.com, Sep 24, 2010

I get an error on ln -s /dev/tun /dev/net/tun insmod /system/lib/modules/tun.ko

link failed files exists.

Any ideas?

Thanks in advance M

Comment by zahi...@gmail.com, Oct 1, 2010

Davis, you have to put the command inside a startup script. e.g. init.rc. Look for lines with insmod commands. I have put the command to the end of /etc/init.d/99complete. Now it loads the tun.ko module automatically after each reboot.

Comment by zahi...@gmail.com, Oct 2, 2010

msnow28, I had to do it the opposite way. ln -s /dev/net/tun /dev/tun

Then run the insmod command

Regads

Comment by MR.FLI8...@gmail.com, Nov 12, 2010
Comment by simon.lo...@gmail.com, Dec 22, 2010

Dear all,

I have a Samsung Galaxy S running Eclair 2.1 (2.2 is not and won't be available for my Product Code, because Samsung simply omitted it; I digress).

The tun0.ko module from the main page won't install (as expected):-

  1. insmod tun.ko
insmod: can't insert 'tun.ko': invalid module format

Is there a way to build the kernel module for 2.1 on the Samsung?

Best regards, S.

Comment by simon.lo...@gmail.com, Dec 22, 2010

Hmm, why does mknod work on Andoird? Something has to be able to do it. # mknod /dev/net/tun char 10 200 mknod: /dev/net/tun: No such file or directory

Comment by simon.lo...@gmail.com, Dec 22, 2010

PS. this is not a wiki, but really a list of comments. And frankly, I am now lost.

Comment by simon.lo...@gmail.com, Dec 22, 2010

/me coughs : Sorry, my mistake: # cd /dev/net ash: cd: can't cd to /dev/net

;)

Comment by simon.lo...@gmail.com, Dec 22, 2010

For some reason there is already a tun driver on my Andoird install. Looks like Voodoo - Thanks:) /lib/modules # strings tun.ko | more :0@K &list->lock include/net/netns/generic.h <3>RTNL: assertion failed at %s (%d) drivers/net/tun.c tun%d tap%d <6>tun: %s, %s Universal TUN/TAP device driver <6>tun: %s (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> <3>tun: Can't register pernet ops <3>tun: Can't register misc device %d alias=char-major-10-200 license=GPL author=(C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> description=Universal TUN/TAP device driver depends= vermagic=2.6.29 mod_unload ARMv7 GCC: (crosstool-NG-1.8.1-voodoo) 4.3.4 GCC: (crosstool-NG-1.8.1-voodoo) 4.3.4 this_module

Still does not work.

Comment by simon.lo...@gmail.com, Dec 22, 2010

Problem solved: /sdcard/modules # insmod ./tun.ko /sdcard/modules # lsmod | grep tun tun 11036 0 - Live 0xbf1da000

I used the one from http://perso.curio.be/android/tun.ko for the Voodoo kernel

Comment by simon.lo...@gmail.com, Dec 22, 2010

I managed to connect to the remote site, but got this error:

server requested domain, but none set (use "Domain ..." in config or --domain

Easy to solve: Just added the windows Active Directory domain to it eg: /data/data/org.codeandroid.vpnc_frontend/files # /data/data/org.codeandroid.vpnc frontend/files/vpnc --script /data/data/org.codeandroid.vpnc_frontend/files/vpn c-script --no-detach --domain bigclogswindowsdomain

And now: / # ifconfig tun0 tun0: ip 10.254.98.18 mask 255.255.255.255 flags point-to-point running multicast?

Fabulous.

One side note. Android does not like the /etc/resolv.conf and the busybox nslookup does not seem to read it either. Also, sadly, my version of busybox (which is pretty recent) does not have an ssh binary included. Next step to hunt this down.

Comment by Mateu.S...@gmail.com, Jan 12, 2011

Hi

I'm using a Nexus One Rooted and when I try insmod tun.ko I get:

# insmod tun.ko insmod tun.ko insmod: init_module 'tun.ko' failed (Exec format error)

Anyone can help me?

Thanks

Comment by thasa...@gmail.com, Jan 19, 2011

I placed it in /system/lib/modules and never had to do insmod. This was try in Galaxy Tab and Vibrant S

Comment by emad...@gmail.com, Mar 17, 2011

Am i the only Budist monk in Las Vegas or what? I dont want to break into Googles bank accounts, i just want a vpn to read my mail. Can someone point at the starting point or a a step by step guide?

Comment by hopla...@gmx.de, Mar 24, 2011

Is there any chance to get a "tun.ko" for Android 2.3.3 to use your great app?! today i flash my Desire HD with Coredroid 4.6 ... looking great ... but no tun.ko-support :-(

Comment by ChiTriG...@gmail.com, May 11, 2011

Amen emad. I installed the VPN Connections apk. I configured the connection. I did the insmod for the tun.ko file and it said it already exists (probably from an another attempt with a different VPN client). What do I do now to connect to the VPN? Is it just a matter of enabling the check mark in the VPN Connection? Is that why people are asking for the GUI to verify the connection, et al? Sorry, I'm technical but this is flying way above my head.

Comment by jefba...@gmail.com, Jun 3, 2011

Running CM7.1 Nightlies on my Supersonic, I installed the .99 VPNC, turned on VPN, created the config, and connected just fine. Try to pick a ROM that has tun.ko already built in

Comment by ntaho...@gmail.com, Jun 28, 2011

Force close on Galaxy mini 2.3.4

Comment by rbmat...@gmail.com, Jul 5, 2011

I tried installing tun.ko on a rooted Gingerbread DroidX but I got the "device or resource busy" error. Looks like it's time to install a custom ROM :(

Comment by simon.lo...@gmail.com, Jul 7, 2011

This project is not really active. It never made it past beta. Functionality is missing: e.g Domain is missing from the GUI. Neither is this is not a wiki.


Sign in to add a comment
Powered by Google Project Hosting