Recently, I bought a USB3 WiFi adapter with the RTL8812BU chip (Supports Linux).
I have spent 5 hours so far trying to install the Linux driver for the chip on my Raspberry Pi 4.
Apparently, I am not able to do this on my own so I hope that you guys can help me.

Here is what I have done so far:

Install build tools:

sudo apt install build-essential bc git wget libssl-dev bison flex dkms

Get kernel source code

cd /usr/src
sudo git clone --depth 1 https://github.com/raspberrypi/linux.git
sudo ln -s linux $(uname -r)
sudo ln -s /usr/src/linux /lib/modules/$(uname -r)/build

Prepare linux build headers

cd linux
sudo wget -O Module.symvers https://raw.githubusercontent.com/raspberrypi/firmware/master/extra/Module7l.symvers
sudo make bcm2711_defconfig
sudo make prepare
sudo make modules_prepare

Install Driver

sudo git clone https://github.com/cilynx/rtl88x2bu.git
cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo nano Makefile

Change 2 lines to this:

sudo ARCH=arm dkms build -m rtl88x2bu -v ${VER}                             
sudo dkms install -m rtl88x2bu -v ${VER}
sudo modprobe 88x2bu

The problem
When I run the last command sudo modprobe 88x2bu I get this error message:

modprobe: ERROR: could not insert '88x2bu': Exec format error

So I guess that the Makefile setting CONFIG_PLATFORM_ARM_RPI is not compatible with Raspberry Pi 4 but only earlier models.

Can I modify the Makefile and add a new platform type that allows the driver to be built for Raspberry Pi 4? Or how do I approach this issue?

I have seen other RealTek drivers that supports Raspberry Pi 4 through a variable in the Makefile named CONFIG_PLATFORM_ARM64_RPI. I am a programmer myself (not a linux programmer though) but I simply don't know what I want the Makefile code to do when CONFIG_PLATFORM_ARM64_RPI is set to y.

Example of a RealTek driver that supports Raspberry Pi 4 (These does not work with my wifi adaptor however so just fyi):

Official driver attempt
I also have the official drivers available to me from this link:

But in the ./driver folder after unpacking the tar file, I look in the Makefile and here i dont find any RPI options under CONFIGURATION_PLATFORM_*

I tried to add a new line

and ran the install.sh script but it fails (of course because the Makefile does not handle the new CONFIG_PLATFORM_ARM64_RPI line).

and dmesg shows this error message:
[ 542.113848] 88x2bu: disagrees about version of symbol module_layout

More information
Here is some more information about my setup.

Result of uname -smr:
Linux 4.19.115-v7l+ armv7l

I hope that you can help me with tips on how to proceed with this issue!
Hopefully the answer will also help other people in the future.

EDIT 2020-05-31:
I have also tried to use

sudo make modules

to build Module.symvers instead of getting it with wget.
That did not help.

And I tried to upgrade my kernel to 5.4.42-v7l+ with

sudo rpi-update
sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/local/bin/rpi-source && sudo chmod +x /usr/local/bin/rpi-source && /usr/local/bin/rpi-source -q --tag-update
sudo rpi-source

However, after upgrading it fails in an earlier step so I have rolled back the upgrade.

  • The Pi4 has built in WiFi hardware. May 27 '20 at 16:30
  • Yes, it does. But I have some issues with that. First, I am using an aluminium case which lowers the internal WiFi signal. Second I am using USB3 devices and USB3 and the internal 2.4Ghz WiFi interferes with each other so the internal WiFi does not work when a USB3 device is plugged in. So I bought a more powerful USB3 WiFi adapter to overcome those challenges. I just need to make it work on Pi4 :-) And before you suggest that I use 5Ghz WiFi, I just want to mention that it is not an option either. Range is way too short on that for my needs.
    – Stefan R.
    May 27 '20 at 17:46
  • In my case, I got a "target not found" for arch/arm/kernel/ on my Manjaro ARM version. I set ARCH=arm64 in the Makefile to solve the issue. Remember to update the Makefile in /usr/src/rtl88x2bu-${VER} with rsync.
    – RobotMan
    Dec 7 '20 at 20:12

Finally I had a breakthrough!

Instead of using modprobe and dkms it was enough to follow these steps:

sudo git clone https://github.com/EntropicEffect/rtl8822bu.git 
cd rtl8822bu
sudo nano Makefile

Update lines 100 and 101 to this and save the file:

sudo make
sudo make install
sudo reboot

After reboot i did iwconfig and now I see 2 Wireless USB adapters.
And a quick speed test with speedtest-cli makes me very happy:

Ping: 7.414 ms
Download: 133.61 Mbit/s
Upload: 153.04 Mbit/s
  • 1
    Helped me a lot, thank you! Jun 12 '20 at 13:26
  • Even though EntropicEffect/rtl8822bu is no longer maintained, these instructions worked like a charm! 3x better WiFi speeds with TP-Link T4U v3 compared to built-in RPi4 WiFi. Jan 25 at 3:59
  • Didn't work for me on RPi CM4 using 64-bit OS until I ran as ARCH=arm64 make && make install
    – jacobq
    Apr 30 at 17:19
git clone https://github.com/cilynx/rtl88x2bu.git
cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo dkms build -m rtl88x2bu -v ${VER}
sudo dkms install -m rtl88x2bu -v ${VER}
sudo modprobe 88x2bu 

Remember to reboot.
Source: https://forums.linuxmint.com/viewtopic.php?t=306627

My speed: 140 Mb/s u:78Mb/s at this ac1300 wifi

My speed at cable Cu, clasic wired UTP connector> D:288mb/s U: 165Mb/s

Country: Romania :)

sdd 512 WD, +12 Gb Ram ddr3, microprocesor old: 2x3000 Mhz

capt scree 3>> http://pix.toile-libre.org/upload/original/1602088226.png

cs4 .. http://pix.toile-libre.org/upload/original/1602088532.png

cs5 .. http://pix.toile-libre.org/upload/original/1602088581.png

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.