I have already tried the procedure described in (Drivers for dwa-171 wifi usb dongle) on several RPi's without success. Each attempt fails at the end of the process with "ERROR: could not insert '8812au': Exec format error".

My Linux kernel version is:

Linux raspberrypi 3.18.8+ #763 PREEMPT Sat Feb 28 18:24:36 GMT 2015 armv6l GNU/Linux

readelf -h on the module gives:

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          991408 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         37
  Section header string table index: 34

modinfo gives:

filename:       /home/pi/rtl8812au/8812au.ko
version:        v4.2.2_7502.20130517
author:         Realtek Semiconductor Corp.
description:    Realtek Wireless Lan Driver
license:        GPL
srcversion:     3424792CB6F8055CE7AE336

The last line in dmesg says:

8812au: disagrees about version of symbol module_layout

Any help to get this working would be greatly appreciated.


I know I'm a little late to the party but since I bought Edimax EW-7811USC to connect the WiFi dongle to an existing antenna, I needed the 8812au.ko driver to get it working.

The procedure described in Drivers for DWA-171 WiFi dongle is for an older RPI (if you use Raspberry PI 2), so you compile for the wrong kernel, that's why you get

ERROR: could not insert '8812au': Exec format error.

By modifying the said procedure for the Raspberry PI 2 you can get the dongle to work:

  1. If you formatted the MicroSD card with the fresh version of Raspbian, don't forget to expand the file system and reboot:

    sudo raspi-config

  2. Update the firmware to the newest version available:

    sudo rpi-update sudo reboot

  3. Update and install dependencies:

    sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade sudo apt-get install build-essential bc libncurses5-dev

  4. Clone raspberry linux kernel (only the newest code so less space is consumed and it's a lot faster!):

    sudo git clone --depth=1 http://github.com/raspberrypi/linux rpi-kernel

  5. Create kernel configuration file and recompile (by using -j4 mark it compiles in little less than 2 hours!!!):

    cd rpi-kernel KERNEL=kernel7 sudo make bcm2709_defconfig sudo make -j4

  6. Build modules and headers:

    sudo make modules_install sudo make modules_prepare sudo make headers_install

  7. Install and reboot:

    sudo make zinstall clean sudo reboot

  8. Get driver sources (from gnab's modified version):

    sudo git clone --depth=1 https://github.com/gnab/rtl8812au cd rtl8812au

  9. Modify the Makefile so that the drivers are compiled for the RPI (sudo nano Makefile):


  10. Compile and install:

    sudo make -j4 sudo make install

  11. Load the driver so you can use it right away without rebooting:

    sudo insmod 8812au.ko

By entering ifconfig the wlan0 item should now be listed.


I recently stumbled upon similar problems when I was trying to find a driver for my Edimax EW-7811UTC which uses the same chipset as the D-Link DWA-171. I had to realize that while OpenELEC for instance does come with a driver for the Edimax EW-7811UTC out of the box, Raspbian doesn’t.

I found a small tool called rpi-source that is able to install the kernel sources used to build the kernel on your Raspbian image. It's supposed to work for Raspberry Pis 1 and 2 and kernels starting from version 3.10.37.

I've tested following procedure to compile and install the rtl8812au driver on a Raspberry Pi 2 Model B running Raspbian in different versions:

  • Raspbian Jessie release 2016-05-27 using kernel version 4.4.11-v7+
  • Raspbian Jessie release 2016-09-23 using kernel version 4.4.21-v7+
# 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

# 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
# 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

I also created an Ansible role called raspbian-rtl8812au you can use to automate the driver setup in an Ansible playbook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.