9

I have recently purchased an Edimax EW7811UTC AC WiFi adapter for use with my Raspberry Pi 3b running Raspbian Jessie with Pixel desktop. This WiFi dongle uses the rtl8812au chipset and the driver for this chipset is not included in Raspbian releases. (It is included in distributions like OpenELEC)

Google is absolutely filled with people trying, troubleshooting and failing to get the driver downloaded or installed for chipsets like rtl8812au.

Where do I get the driver for this chipset and how do I install this driver after I've acquired it?

Zimano
  • 469
  • 1
  • 3
  • 20
  • What happens when you connect it? – BantuTech May 30 '17 at 11:01
  • 1
    This question is not a duplicate, as the linked question encounters an error while installing a driver and is about an error in make during installation of the driver both OP and I are talking about. – Zimano Nov 12 '17 at 21:39
  • 1
    @Zimano is correct. This is not a duplicate. – Rob S. Nov 13 '17 at 16:30
  • This is one of the many questions about building the driver from https://github.com/gnab/rtl8812au. In a couple of years the driver (or the Raspbian build environment) will change again, the answers here will stop working and there will be a time for yet another question about it. – Dmitry Grigoryev Jan 08 '20 at 16:56
  • @DmitryGrigoryev I disagree. Not only are Realtek drivers there to stay, the other questions you link are about the Unix-specific build process, regardless of what driver is being installed. Indeed; in a couple of years, everything will change and most answers will stop working at one point or another, I cannot take you seriously in that aspect of your argument. – Zimano Jan 09 '20 at 10:39
  • @Zimano That's exactly why questions and answers should concentrate on specific problems, instead of being yet another "definitive guide", which by the way is 90% the same as the guide already posted in the duplicate question, ignoring inconsequential differences like using sed instead of nano. You asked how to build the rtl8812au driver, and the answer to the duplicate question explains that. If the answer to it doesn't work, it should be updated or another answer should be posted, instead of posting a duplicate question. – Dmitry Grigoryev Jan 09 '20 at 14:25
  • I still disagree, the given answer is not the theme of the question, it is the question OP wrote. The duplicate question's title does not reflect the question being asked as OP is running into an error that has to do with missing kernel headers. OP then answers their own question specifying that indeed they were missing the kernel headers and additionally posts an installation guide. That post should be flagged for being unclear or have its title renamed to reflect the actual error OP encountered, as it has nothing to do with installing wireless drivers, but with compiling on Raspbian. – Zimano Jan 09 '20 at 14:55

2 Answers2

13

"In normal circumstances there is NEVER a need to run rpi-update as it always gets you to the leading edge firmware and kernel and because that may be a testing version it could leave your RPi unbootable". https://www.raspberrypi.org/forums/viewtopic.php?p=916911#p916911 Even the rpi-update documentation now warns "Even on Raspbian you should only use this with a good reason. This gets you the latest bleeding edge kernel/firmware."

The best and easiest way to handle this problem is as following

  1. sudo wget http://downloads.fars-robotics.net/wifi-drivers/install-wifi -O /usr/bin/install-wifi - Downloads the installation file
  2. sudo chmod +x /usr/bin/install-wifi - makes it executable
  3. Installation process
    • sudo install-wifi -c rpi-update - check for driver if rpi-update is run.
    • sudo rpi-update - if a driver is available you can run rpi-update to update firmware.
    • sudo install-wifi -u rpi-update- then update the driver for the new kernel installed by rpi-update.
    • sudo reboot - now reboot to update the kernel with the new wifi driver.
Dougie
  • 5,301
  • 10
  • 19
  • 28
yapws87
  • 319
  • 3
  • 9
10

After hours of reading threads and following guides here and there, the definitive guide that got the driver working was here. Following the steps listed in that post:

$ # install necessary software
$ sudo apt-get update
$ sudo apt-get install bc git

$ # download raspbian kernel sources, takes some minutes
$ sudo wget "https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source" -O /usr/bin/rpi-source
$ sudo chmod 755 /usr/bin/rpi-source
$ rpi-source

$ # download the rtl8812au kernel driver and compile it, takes some minutes
$ git clone "https://github.com/gnab/rtl8812au"
$ cd rtl8812au
$ sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
$ sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile
$ make

$ # copy the driver and use it
$ sudo cp 8812au.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
$ sudo depmod -a
$ sudo modprobe 8812au

$ # check wlan0 interface appeared
$ ifconfig
$ iwconfig

The last comment says #check wlan0 interface appeared but if you still have the RPi on-board WiFi activated, the dongle will appear as wlan1. I recommend that you disable the on-board WiFi chip in order to save power and avoid causing interference if you'll be using a 2.4Ghz band.

These steps worked out flawlessly and soon after and I was connected to an ASUS AC1900 (802.11ac dual-band 5Ghz) router. As of the latest edit to this post I have been using the dongle for about 2 days for about 10 hours a day without problems.


Side note: There are many posts by MrEngman on the Raspberry Pi forums answering questions related to the Realtek WiFi chipset drivers and you'll encounter many 404'd Dropbox links to drivers and install-wifi shell scripts attributed to MrEngman. I didn't follow any of them as the information was too fragmented and he does not seem active anymore. When following any of his tips or hints, be sure to go to his site first and follow the information there; don't go forum diving in old threads. Especially when there's different drivers, kernels and versions at play.

Zimano
  • 469
  • 1
  • 3
  • 20
  • If the 88x2 dongle you are trying to use happens to be an Archer T4U, make the following adjustments to the above scripts: Use wget to download the kernel driver from https://static.tp-link.com/2018/201810/20181018/Archer%20T4U_V3_181018_Linux_beta.zip and change the platform to be CONFIG_PLATFORM_BCM2709. Driver name is 88x2bu instead of 8812au. Everything else should work as written. – svenyonson Jan 30 '19 at 22:18
  • Thanks for this solution, i have a Realtek 8821cu so I had to change the driver (https://github.com/whitebatman2/rtl8821CU) and, VERY IMPORTANT, to edit the file "/lib/udev/rules.d/40-usb_modeswitch.rules" adding a string, because the usb is mounted as storage by default! I paste the string here at the end because readibility in comments is terrible: # Realtek 8821CU Wifi AC USB ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="/usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b" – Ares9323 Jan 22 '21 at 18:28