Install Driver for TP-Link TL-WN823N in Raspberry Pi 2 Model B

Recently I brought TP-Link TL-WN823N wireless USB adapter to connect my Raspberry Pi over wireless network. Mine is Raspberry Pi 2 Model B, so not having built in wireless capability. I chose TP-Link TL-WN823N over Edimax EW-7811Un because of its 300 Mbps speed, both were available on amazon.in with similar price.

It did not get detected out of box when plugged into my laptop running Ubuntu 16.04. The driver available at TP-Link website could not be installed because it was for older version of kernel. However, I could easily find driver over Googling and it worked fine.

Then I tried to make it work on my Raspberry Pi 2 model B. As expected it did not get detected. I searched over Internet for driver installation. I could see many postings around installing driver for Raspberry Pi but most of them were outdated and did not work for me. Finally I could find a way to install driver after searching further and trying many methods.

First, create directory to keep the driver source files in a common place if you don’t have it already.

mkdir drivers && cd drivers

Install Prerequisites

I used latest Raspbian Jessie released on 5th of July 2017. For me it required only to install kernel header files as shown below.

sudo apt-get install raspberrypi-kernel-headers dkms

Get Driver Source

Get the driver source files hosted at github repo https://github.com/Mange/rtl8192eu-linux-driver. The driver source seems like for D-Link DWA-131, which is having same chipset, rtl8192eu, as my TP-Link TL-WN823N v2.

We have to clone realtek-4.4.x branch, which is for Linux kernel 4.4. However it worked for my Raspbian having kernel version 4.9.35.

git clone --branch realtek-4.4.x https://github.com/Mange/rtl8192eu-linux-driver.git

Target Raspberry Pi

By default the building process will target desktop systems. We have to change that, to build the driver for Raspberry Pi.

You will see Makefile within driver source directory you just cloned above. Open it in a text editor. You can find following line:

CONFIG_PLATFORM_I386_PC = y

Change it to:

CONFIG_PLATFORM_I386_PC = n

Then find following line.

CONFIG_PLATFORM_ARM_RPI = n

Change it to:

CONFIG_PLATFORM_ARM_RPI = y

Build and Install Driver from Source

Now we can build and install the driver.

cd rtl8192eu-linux-driver/
sudo dkms add .
sudo dkms install rtl8192eu/1.0

If everything went well, then WiFi adapter should get detected once you restart networking service or reboot Pi.


Comments

49 responses to “Install Driver for TP-Link TL-WN823N in Raspberry Pi 2 Model B”

  1. Laurie Laptop Avatar
    Laurie Laptop

    Thanks for this! I used it to get an old Model B up and running again using a new TP-Link TL-WN823N v2 adapter.

    However, I had to make a small change to the Makefile *BEFORE* running the “sudo dkms add .” command.

    1. Change CONFIG_PLATFORM_I386_PC from y to n
    2. Change CONFIG_PLATFORM_ARM_RPI from n to y

  2. StevePhilips Avatar
    StevePhilips

    When I attempt to compile with ‘sudo dkms install rtl8192eu/1.0’ I recieve the following error:

    Kernel preparation unnecessary for this kernel. Skipping…
    Building module:
    cleaning build area…
    ‘make’ all KVER=4.9.41-v7+…(bad exit status: 2)
    Error! Bad return status for module build on kernel: 4.9.41-v7+ (armv7l)
    Consult /var/lib/dkms/rtl8192eu/1.0/build/make.log for more information.

    My kernal version is: 4.9.41-v7+

    1. Junaid P V Avatar
      Junaid P V

      Please make sure modified Makefile as per above instructions. Regarding lines containing CONFIG_PLATFORM_I386_PC and adding new line “CONFIG_PLATFORM_ARM_RPI = y”

      1. Was this issue resolved i get the same error as StevePhilips?

        1. Andrew Gingrich Avatar
          Andrew Gingrich

          Not sure if you have solved this by now but I was having same problem. I got it work by using

          sudo make clean
          sudo make
          sudo make install
          sudo modprobe -a 8192eu

          after making the changes in the makefile. You also don’t need to add a new line for the ARM_RPI because you can change the existing which is about 5 lines down.

          The name still doesn’t show up when using lsusb but if it use sudo lshw -c network it shows the correct driver.

          See https://github.com/Mange/rtl8192eu-linux-driver

  3. Mike Young Avatar
    Mike Young

    Open the Makefile in text editor. Can you explain…..I lost you just here……
    You need to add…

    “sudo nano rtl8192eu-linux-driver/Makefile”
    This opens the file that you then can edit……

    1. Junaid P V Avatar
      Junaid P V

      I have tried to enhance that section.
      Thank you for the feedback.
      Hope it worked for you.

  4. Having an error building and installing the driver. Could you please assist? Version: raspberrypi 4.9.24+ #993 Wed Apr 26 17:56:54 BST 2017 armv6l GNU/Linux

    1. Junaid P V Avatar
      Junaid P V

      Let me try.
      What error is you getting? Please paste it here.
      Hope you modified Makefile per my above instruction.

  5. It gives an error that the command dkms is not found. I have modified the makefile as per instruction.

    1. Junaid P V Avatar
      Junaid P V

      Please run this command:

      sudo apt-get install dkms

      Then try again.

  6. Bothering again.. installed and rebooted the raspberry but it still shows no wireless interface on the gui

    1. Junaid P V Avatar
      Junaid P V

      Sorry to hear that.
      I may have to try my Pi which I did not touch for last may months.
      Btw, please let me know you get when running following command?:

      sudo lsusb

      1. The following is printed:

        Bus 001 Device 006: ID 046d:c31c Logitech, Inc. Keyboard K120
        Bus 001 Device 005: ID 2357:0109
        Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
        Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
        Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

        1. Junaid P V Avatar
          Junaid P V

          It looks like the second one is your WiFi adapter, but wondering why it is not showing the name. Did it get installed properly?

          Also, what you get if run command?:

          sudo dkms status

          1. It shows that it’s installed:
            rtl8192eu, 1.0, 4.9.59+, armv6l: installed

  7. So are you able to assist?

    1. Junaid P V Avatar
      Junaid P V

      Sorry Daniel, I not sure if I can assist. May be I need to try it again. Hope to do it when get some free time.

  8. I had to also install dkms before I could do the dkms commands.

    1. Yes we have to.
      I updated post to include that.

  9. ayub firdhouzi Avatar
    ayub firdhouzi

    can you tell me how can i find that makefile? i’m newbe here thx
    By default the building process will target desktop systems. We have to change that, to build the driver for Raspberry Pi.

    You will see Makefile within driver source directory you just cloned above. Open it in a text editor. You can find following line:

    1. You can see the “Makefile” at https://github.com/Mange/rtl8192eu-linux-driver .

      May be you are not familiar with Git. With the “git clone” command I put below, all the files from above link will be copied to your computer in folder “rtl8192eu-linux-driver”:

      git clone –branch realtek-4.4.x https://github.com/Mange/rtl8192eu-linux-driver.git

  10. Daniël Avatar
    Daniël

    You saved me a lot of hairs, thank you!

    1. Glad to hear that.
      Are you same Daniel commented earlier?

  11. worked perfectly

    1. Glad to hear that.

  12. Hi there,
    This worked really well for me on my Rpi 3
    Thanks a lot

    1. You are welcome.
      Glad to hear it helped you.

  13. Hi! This hasn’t really worked for me. I was wondering if you could help. First of when I try to install dkms, I run the command and get the errors as followed: Temporary failure resolving ‘raspbian.raspberrypi.org’
    Err:2 http://archive.rasperrypi.org/Debian buster/main armhf raspberrypi kernel-headera armf 1.20210108-1

    I also get more errors. I also can’t clone the git package.

    1. Looks like your Pi not having Internet connection.

  14. As soon as I get to the final install: sudo dkms install rtl8192eu/1.0 an error occurs: “Your kernel headers for kernel 5.4.79-v7+ cannot be found at /lib/modules/5.4.79-v7+/build or /lib/modules/5.4.79-v7+/source.” Any help would be greatly appreciated!

    1. Make sure you installed kernel headers with the command:

      sudo apt-get install raspberrypi-kernel-headers dkms

    2. I just found another repo having latest code: https://github.com/clnhub/rtl8192eu-linux

      Please try this new repo with above instructions.

      1. Giuseppe Avatar
        Giuseppe

        Hi, I just removed the 4.4.x version and tried to install the 5.6.3.1 but it failed. The command

        “sudo dkms install -m rtl8192eu -v 1.0”

        returns

        “user@hostname:/home/pi/drivers/rtl8192eu-linux# sudo dkms install -m rtl8192eu -v 1.0

        Kernel preparation unnecessary for this kernel. Skipping…

        Building module:
        cleaning build area…
        ‘make’ all KVER=5.10.52-v7+…(bad exit status: 2)
        Error! Bad return status for module build on kernel: 5.10.52-v7+ (armv7l)
        Consult /var/lib/dkms/rtl8192eu/1.0/build/make.log for more information.”

        Not sure where the issue is – Just rolled back to 4.4.x 🙁

  15. Giuseppe Avatar
    Giuseppe

    Hi – It worked for me. Any clue why the dongle connectivity green led stopped working (it is always off now)?

    1. Glad to know it worked for you too!
      No idea about LED. Actually I did not use it for years now!

  16. Thanks for this! After researching which Wifi USB sticks are suitable for the RPi3B, I decided on the TP-Link TL-WN823N. This came (of course) as an “EU” version, and therefore did not work “out of the box”. With these instructions (and after deactivating the internal Wifi) it worked immediately. Deployment: “RaspAp”, Raspbian GNU/Linux 10 (buster), Linux raspberrypi 5.10.52-v7+.

    1. Just wondering why you need to use the WiFi adapter on RPi3B as it already has WiFi capability built-in? 🙂

      1. Of course, the Wifi built into the RPi3B is sufficient for “proof of concept” for the RaspAp application. The connection over a short distance without obstacles works. However, the performance is not sufficient for a stable connection from the living room to the kitchen in my flat. With this Wifi adapter, I can easily connect two PCs (in different rooms) and a smartphone to RaspAp.

  17. Hi everyone, I’ve done everything up until; SUDO DKMS INSTALL RT18192eu/1.0, I get the following error….
    Your kernel headers for kernel 5.4.79+ cannot be found at
    /lib/modules/5.4.79+/build or /lib/modules/5.4.79+/source.

    Anyone know a fix for this? Thanks!

    1. You need to install kernel headers and other required stuffs with this command:

      sudo apt-get install raspberrypi-kernel-headers dkms

      1. Hi

        I have the same problem, only for kernel 6.1.31-v7+

        Can you please help?

          1. Well it did help eventually 🙂

            I already tried it before but I guess I had some “leftovers” from previous tries, so after a reboot and some cleaning it worked!

            Thanks a lot

  18. björn Avatar
    björn

    ….and it still works like a charme
    Thank you so much.

  19. Works great, thanks, but the activity LED does not work! Any fix for this? Thanks!

  20. Zitmeister Avatar
    Zitmeister

    Just a quick message to say thanks to Junaid as this is still working and got me out of a jam after others’ suggested methods hadn’t worked for me. Many thanks.

  21. […] There are clearly numerous sources, however they all point back to one main source of knowledge, a blog post from Junaid’s […]

  22. To those who are currently locked out from having no internet,
    You can manually install dkms by downloading it in your other PC and transferring it via USB.

    Download these files and transfer them to your Raspberry PI

    * Raspberry PI Kernel Headers
    https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel-headers_1.20230405-1_armhf.deb

    * Dctrl tools
    https://mirror.fcix.net/raspbian/raspbian/pool/main/d/dctrl-tools/dctrl-tools_2.24-3_armhf.deb

    * DKMS
    http://mirror.pit.teraswitch.com/raspbian/raspbian/pool/main/d/dkms/dkms_2.8.4-3_all.deb

    After that go in your raspberry pi and make sure the .deb files are in the same folder.

    Type this in the terminal on the same directory with the files “sudo dpkg -R –install .”

    Alternatively you can also do the method by Andrew Gingrich

    sudo make clean
    sudo make
    sudo make install
    sudo modprobe -a 8192eu

Leave a Reply

Your email address will not be published. Required fields are marked *