OpenVPN TUN/TAP devices

Discussion in 'Troubleshooting' started by Arkantus, Nov 26, 2013.

  1. Arkantus

    Arkantus New Member

    Joined:
    Nov 26, 2013
    Messages:
    1
    Likes Received:
    0
    Hello there !

    Ok I'm struggling with my UDOO to get OpenVPN to work, my current ISP (free.fr) is kinda slowing down youtube and other services (or at least not providing it with enough bandwidth), wherease it work fine when I use a VPN.

    So I've been using the same configuration as my laptop :
    installed OpenVPN from repos, copied my conf file and blablabla...
    But when I try to run it :
    Code:
    sudo openvpn --config /usr/local/etc/openvpn/configfile
    I get
    Code:
    Cannot open TUN/TAP dev /dev/net/tun: No such device (errno=19)
    Attempting fallback to kernel 2.2 TUN/TAP interface
    Cannot open TUN/TPA dev /dev/tun0 No such file or directory (errno=2)
    I tried various solution on the internet most of them tried to create the file and give it the right proprieties but in this case it does not seems to work.

    I tried
    Code:
    modprobe tun (and TUN)
    and get
    Code:
    FATAL: Module tun (TUN) not found
    I quite far from knowlegdable on such matter so I won't jump to conclusions (mostly cause i wouldn't know what conclusions to draw from this)

    Thank you for reading this, and have a nice day !
     
  2. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    I am having the same problem.
    Being far from an expert in Linux it seems that the tun module is not included (in my case, I am running Linaro Ubuntu 12.04 LTS).
    I made the rookie mistake of grabbing a pre-compiled tun module from the Raspberry Pi forums on the presumption they are both running ARM so it shouldn't matter. But it did...

    I haven't gotten it working just yet. Trying some suggestions from this thread now (viewtopic.php?f=17&t=100)
     
  3. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    OK. So I tried to compile the TUN/TAP module myself and failed.
    This is my first attempt at compiling anything, so I dont claim to have done it correctly. In any case, I will explain my steps below and hope someone may be able to guide me.

    - I downloaded the kernel source from http://www.udoo.org/downloads/ (which links me to git https://github.com/UDOOboard/Kernel_Unico)
    - git clone to /usr/src/
    - export ARCH=arm; export SRCARCH=arm
    - make menuconfig (this caused a dependency error and I needed to 'apt-get install libncurses5-dev' to fix it)
    - In the menuconfig I couldnt find TUN/TAP section... so I did a 'make config' instead and accepted all defaults except for the networking features, where I said 'Y' and then it asked me about the TUN module and I said 'Y' again.
    - Then it built the .config file (I think you could just grab the config file from /proc/config.gz too)
    - Edited the config and found the 'tun' line. Changed the =y to =m (I believe this just tells the compiler to compile TUN/TAP as a module rather than build it in to the kernel. As we arent building a new kernel and only making a module this option is needed)
    - make modules
    - make modules_install INSTALL_MOD_PATH=/ (this should install the module in to /lib/modules/.....)

    Here comes the problem... the source I was building from installed the module in to /lib/modules/3.0.35-g76d54f2 whereas `uname -r` gives me 3.0.35 (and therefore my modules are in /lib/modules/3.0.35). This is very odd considering I am building from the source that UDOO have given me, so it should be the _same_, right? well... no... something went wrong somewhere.
    Anyway, I moved the files to /lib/modules/3.0.35 (including tun.ko) in the hopes that it may work anyway and now when I run modprobe tun I get:

    FATAL: Error inserting tun (/lib/modules/3.0.35/kernel/net/tun.ko): Invalid module format

    DMESG says:

    [ 1823.667063] tun: no symbol version for module_layout


    Looking through the source I cannot find 'module_layout'.... so now I am at a loss. I guess the way forward here would be to rebuild the entire kernel using the source I have and try that, but I am hoping I dont need to go down that path.

    Does anyone have any pointers here? Thanks!
     
  4. DaViper

    DaViper New Member

    Joined:
    Jan 8, 2014
    Messages:
    3
    Likes Received:
    0
    try 'openvpn --mktun'
    you don't need to recompile the kernel as it should be included in the kernel. The device just needs creation the first time. that's what the above command does
     
  5. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    Thanks for the reply DaViper, but I wish it were that easy. The problem seems to be that the driver for TUN is not in the kernel nor is it available as a module.

    Code:
    root@udoo:/# openvpn --mktun
    Options error: You must define TUN/TAP device (--dev)
    Use --help for more information.
    root@udoo:/# openvpn --mktun --dev tun0
    Mon Jan 13 21:48:25 2014 Note: Cannot open TUN/TAP dev /dev/net/tun: No such device (errno=19)
    Mon Jan 13 21:48:25 2014 Cannot ioctl TUNSETPERSIST(1) tun0: Bad file descriptor (errno=9)
    Mon Jan 13 21:48:25 2014 Exiting
    TUN module doesn't exist

    Code:
    root@udoo:/# modprobe tun
    FATAL: Could not read '/lib/modules/3.0.35/kernel/net/tun.ko': No such file or directory
    
     
  6. flipsa

    flipsa New Member

    Joined:
    Jan 14, 2014
    Messages:
    17
    Likes Received:
    0
    Ran into a similar problem (the kernel version mismatch) when building modules for something else. Just build the kernel properly (make uImage && make modules_install), not just the modules, and then copy it to /boot and boot from it. After that verify with "uname -r" that the running kernel is now 3.0.35-g76d54f2. Your modules should load fine then.

    Update: I just installed openvpn (after enabling tun support in the kernel) and it works flawlessly. If you still need help, feel free to ask me.
     
  7. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
  8. jack133

    jack133 New Member

    Joined:
    Apr 24, 2014
    Messages:
    3
    Likes Received:
    0
    Hi Everyone,

    I want install openvpn server on my Udoo but I have a problem with the boot sequence.
    I activate the TUN module in make menuconfig and run the commande make -j4 uImage modules. I compile directly on Udoo, it takes about 25min.
    Everything gone fine, the compilation finished well.
    I do a make modules_install and it's OK.
    The problem is where can I find the uImage file ? I have just a zImage file !!
    So I copy the zImage file in the /boot directory, rename it in with uImage name and reboot the Udoo.
    And now the Udoo isn't able to boot, the serial console message is :
    Booting from mmc ...

    4704664 bytes read in 493 ms (9.1 MiB/s)

    Wrong Image Format for bootm command

    ERROR: can't get kernel image!


    So the question is, where can I find the good uImage and how install it ?
    The documentation is very light about it !

    Thank you for your help
     
  9. fetcher

    fetcher Member

    Joined:
    Mar 9, 2014
    Messages:
    166
    Likes Received:
    20
    From the top of the kernel source tree, the compiled uImage should be under arch/arm/boot. This location is printed in make's output when the image is built, but since you're building modules immediately after, that probably scrolled by before you could read it.

    You could also track it down using this very handy command:

    find . -name uImage

    (a period as the first argument means "search under current directory" -- saying / instead would search the entire filesystem instead, though that'd take a while to complete)
     
  10. jack133

    jack133 New Member

    Joined:
    Apr 24, 2014
    Messages:
    3
    Likes Received:
    0
    Hi Fetcher,
    Thank you for your quick help ! Unfortunately I can't work in my UDOO every days ;-).

    In the arch/arm/boot directory, I have files 2 generated :
    Image with a 13,1Mb size and zImage with a 4,7Mb size.
    I don't have uImage file. The size of the zImage file is very similar to the original uImage provide in the SDcard image from UDOO team and it's why I take this file, but it don't work.
    The find command as you show me in your post don't find the uImage file.

    In the other way, the file tun.ko is well generated, so I am in the good way to install openvpn on my UDOO by it lakes a little yet.

    I try to compile only the linux kernel on my Udoo without modules with this command:
    sudo make -j4 uImage

    I have a strange error:
    make: execvp: /home/ubuntu/udoo-dev/Kernel_Unico/scripts/setsecoversion: Permission denied
    CHK include/linux/version.h
    CHK include/generated/utsrelease.h
    make[1]: `include/generated/mach-types.h' is up to date.
    CALL scripts/checksyscalls.sh
    CHK include/generated/compile.h
    SKIPPED include/generated/compile.h
    Kernel: arch/arm/boot/Image is ready
    SHIPPED arch/arm/boot/compressed/lib1funcs.S
    AS arch/arm/boot/compressed/lib1funcs.o
    LD arch/arm/boot/compressed/vmlinux
    OBJCOPY arch/arm/boot/zImage
    Kernel: arch/arm/boot/zImage is ready
    UIMAGE arch/arm/boot/uImage
    "mkimage" command not found - U-Boot images will not be built
    make[1]: *** [arch/arm/boot/uImage] Error 1
    make: *** [uImage] Error 2

    The first line I have a permission error and at the end a message indicate it can't generate the uImage.
    What is the mistake I do ?

    Thank you,
    Stéphane
     
  11. jack133

    jack133 New Member

    Joined:
    Apr 24, 2014
    Messages:
    3
    Likes Received:
    0
    Arfff..... I find the problem in another topic in this forum.
    the uboot-mkimage package was not installed.
    I lose 3 days of search for just a package not installed, for your next SDcard image, Udoo team can be possible to install ALL the packages needed to build a kernel ?
    The linux world is enough difficult to learn like this !!!
    Stéphane
     
  12. fetcher

    fetcher Member

    Joined:
    Mar 9, 2014
    Messages:
    166
    Likes Received:
    20
    I meant to reply to this earlier, but was called away and forgot to.

    On Debian, possibly Ubuntu also, mkimage is in package "u-boot-tools" (yes, punctuated like that)... there is a uboot-mkimage in the apt tree also, but it's marked "transitional package", which I think means the package name has changed or is being changed, and the "transitional" one is provided only for backwards compatibility.

    The zImage file you tried to use at first is missing a header required by u-boot. This is the part mkimage adds.
     

Share This Page