# Realtek RTL8822BE not working at all.

## enym

I have recently installed Gentoo on my laptop, but my WiFi and Bluetooth isn't working.

My laptop uses the Realtek RTL8822BE chip, which is both responsible for WiFi and Bluetooth.

I tried everything i could find online, but nothing worked.

Running 

```
dmesg | grep 8822
```

 shows me nothing at all.

```

lspci gives me this: 

00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Root Complex

00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 IOMMU

00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge

00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0]

00:01.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0]

00:01.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0][/glsa]

00:01.6 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0]

00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge

00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus A

00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 61)

00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)

00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 0

00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 1

00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 2

00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 3

00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 4

00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 5

00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 6

00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 7

01:00.0 Non-Volatile memory controller: SK hynix BC501 NVMe Solid State Drive 512GB

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)

03:00.0 SD Host controller: O2 Micro, Inc. SD/MMC Card Reader Controller (rev 01)

04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8822BE 802.11a/b/g/n/ac WiFi adapter

05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Picasso (rev c1)

05:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Raven/Raven2/Fenghuang HDMI/DP Audio Controller

05:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor

05:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Raven USB 3.1

05:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Raven USB 3.1

05:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor

05:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller

```

When I boot up the system, it outputs that it tries to load the module but fails.

I tried using genkernel as well, but nothing changes.

Is there anything else I can try to see whats wrong? 

I tried everything i could find online, but nothing worked

All help is appreciated!

----------

## NeddySeagoon

enym,

Welcome to Gentoo.

Can you post all of your dmesg?

Wgetpaste can help.

We need it all as what it does not say but should is as important as what it contains.

----------

## alamahant

Hi

Welcome to Gentoo forums.

Try

```

emerge -av linux-firmware

```

You need this file

```

/lib/firmware/rtlwifi/rtl8822befw.bin

```

----------

## enym

NeddySeagoon, 

this should be it:

https://dpaste.com/3HW2PLS3F

----------

## enym

alamahant,

linux-firmware is installed and this file exists

----------

## NeddySeagoon

enym,

That's it. Thank you.

There is no sign of your WiFi there.

You are running kernel 5.10.76-gentoo-r1 

```
#23 SMP Thu Nov 11 16:48:58 CET 2021
```

That's build  number 23 made today at 16:48:58 in your timezone.

dmesg says that your sound is in a mess.

If you have /prog/config.gz please post wget -c "zcat /prog/config.gz" as that's the configuration of the running kernel.

If that is missing, it's a kernel configuration option, please pastebin /usr/src/linux/.config as thats the next best thing.

----------

## alamahant

What kernel are you using?

Either use 

gentoo-kernel-bin

or

see this

https://linux-hardware.org/index.php?id=pci:10ec-b822-17aa-b023

Maybe these?

```

egrep -i "CONFIG_RTW88|CONFIG_RTW88_8822BE|CONFIG_WLAN|CONFIG_WLAN_VENDOR_REALTEK" /usr/src/linux/.config

CONFIG_WLAN=y

CONFIG_WLAN_VENDOR_REALTEK=y

CONFIG_RTW88=m

CONFIG_RTW88_CORE=m

CONFIG_RTW88_PCI=m

CONFIG_RTW88_8822BE=m

```

----------

## NeddySeagoon

alamahant,

gentoo-kernel-bin is sidestepping the problem.

I suspect we will see quite a few issues in the .config file.

Sidestepping kernels can be a good idea at the outset, as postpones learning about kernels for as long as you want to.

----------

## alamahant

Neddy

yes.you are right.

How about the config i grepped?

----------

## enym

NeddySeagoon,

is this fine too, or does it have to be a pastebin?

https://dpaste.com/AJH2FE92H

----------

## NeddySeagoon

alamahant,

I'm lazy. I'll wait for the actual .config file :)

Modules are a good idea. If the fimware is there it will be found.

If the OP goes the gentoo-kernel-bin route, I suspect it will justwork and DIY kernels will be on the back burner for a while.

----------

## NeddySeagoon

enym,

That woks. I suggest wgetpaste as it's a command line too.

pastebin is a generic name, like Hoover. It was one of the first. 

wgetpaste knows how to wirk withe several pastebin targets.

Your kernel looks OKish. Are you sure that the kernel .config you posted generated the dmesg you posted above?

I would expect your Audio CODECS to be found with that config.

WiFi looks promising from that kernel .config too.

Do you have linux-firmware inslalled?

Missing firmware will stop your WiFi working but the kernel module should load and report firmware loading errors in dmesg.

----------

## enym

NeddySeagoon,

Okay, I didn't know that sites like pastebin are this common.

I think that the kernel .config did, but I also rebooted since posting the dmesg.

Yes I am sure I have linux-firmware. I reinstalled it multiple times before so that shouldn't be the problem here.

Although reinstalling it one more time won't hurt.

So this is my new dmesg (after reinstalling linux-firmware and rebooting again):

http://dpaste.com/2VDBDM5MG

----------

## enym

Also, I don't know if this is important, but this is my 'ip a' output:

```
ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host

       valid_lft forever preferred_lft forever

2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

    link/ether f8:75:a4:d6:19:f5 brd ff:ff:ff:ff:ff:ff

    inet 192.168.178.59/24 brd 192.168.178.255 scope global dynamic noprefixroute enp2s0

       valid_lft 863534sec preferred_lft 755534sec

    inet6 fd00::4896:a68f:8dd5:888c/64 scope global dynamic mngtmpaddr noprefixroute

       valid_lft 7158sec preferred_lft 3558sec

    inet6 fe80::fa75:a4ff:fed6:19f5/64 scope link

       valid_lft forever preferred_lft forever

3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000

    link/sit 0.0.0.0 brd 0.0.0.0

```

----------

## NeddySeagoon

enym,

That's the dmesg from the same kernel as before. They both say 

```
#23 SMP Thu Nov 11 16:48:58 CET 2021
```

in the first line.

This firmware loading error,

```
[    0.563400] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2

[    0.564138] cfg80211: failed to load regulatory.db
```

shoulh not happen with 

```
CONFIG_CFG80211=m
```

as the module can read firmware from /lib/firmware after root is mounted.

Looking at the timestamp on the message and comparing it to 

```
[    2.930406] EXT4-fs (nvme0n1p3): mounted filesystem with ordered data mode. Opts: (null)

[    2.931277] VFS: Mounted root (ext4 filesystem) readonly on device 259:3.
```

We see that the firmware load fails before root is mounted but a module would not try to load firmware at that time.

It follows that the kernel that produced those dmesg outputs was built with 

```
CONFIG_CFG80211=y
```

The conclusion is that you are not running the kernel that belongs to the .config file that you posted. 

Further, the kernel .config posted contains

```
 # NVME Support

#

CONFIG_NVME_CORE=m

CONFIG_BLK_DEV_NVME=m

CONFIG_NVME_MULTIPATH=y

CONFIG_NVME_HWMON=y

CONFIG_NVME_FABRICS=m

CONFIG_NVME_RDMA=m

CONFIG_NVME_FC=m

CONFIG_NVME_TCP=m

CONFIG_NVME_TARGET=m

CONFIG_NVME_TARGET_PASSTHRU=y

CONFIG_NVME_TARGET_LOOP=m

CONFIG_NVME_TARGET_RDMA=m

CONFIG_NVME_TARGET_FC=m

CONFIG_NVME_TARGET_FCLOOP=m

CONFIG_NVME_TARGET_TCP=m

# end of NVME Support
```

so your root filesystem hardware driver is modular.

That requires an initrd to mount the root filesystem, which happens here

```
[    2.930406] EXT4-fs (nvme0n1p3): mounted filesystem with ordered data mode. Opts: (null)
```

but no initrd was ever mounted as a temporary root, to provide the modules to mount the real root.

We need to discover why that's happening. It looks like you have a genkernel .config file but are not booting the resulting kernel.

Was /boot mounted for the kernel install?

Was the bootloader updated to know amount the new kernel?

Is the new kernel not the default kernel in the boot loader?

```
[    4.165879] FAT-fs (nvme0n1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
```

That may or may not be a problem. It may be just that the 'dirty bit' is set because you were forced to power off rather than shutting down properly.

Its worth taking the advice.

----------

## enym

NeddySeagoon,

thank you for this very detailed response.

I did not manually mount /boot, so if it was mounted during the install, it

was done automatically.

I honestly assumed since these things seem to be maditory that it would

happen automatically, but if not, most likely not.

I'm sorry if I did not correctly or fully read the manual, but I think I followed it as closely as

possible.

Is typing 'sudo poweroff' not the right way to turn off the computer? I

assumed it is, because nothing ever complained about it.

And is there something I should specifically do / what would you recommend me

to do? I think it would be worth it to upgrade to a newer kernel version along

the way, but could this result in even more problems? I kind of want to go all

the way if it is necessary to reinstall the kernel etc.

I will look further into it and try it out tomorrow.

----------

## NeddySeagoon

enym,

At the console,

```
 sudo shutdown -h now
```

tidies up and powers off.

```
sudo poweroff
```

is the keyboard equivalent of pulling out the mains plug.

There is no need to be sorry for wanting to learn. 

You learn far more when things go wrong and you fix them than you do when following the manual and it just works.

Before you change anything we need to understand what happened, so it won't happen again.

My explanation above was the first step in that.

Lets look at the timeline of the things that contribute to a built kernel.

The process starts with the .config file.

```
ls -l /usr/src/linux/.config  
```

will show the date and time the .config was last changed.

Everything else must be newer than that.

The kernel binary that goes into /boot is at 

```
ls -l /usr/src/linux/arch/x86/boot/bzImage
```

That mush be newer than the .config

Now look in /boot. It should be empty because /boot is not mounted by default. 

If its not empty, leave it alone for now.

Do 

```
mount /boot
```

and look in boot again 

```
ls -l /boot
```

You should see your 5.10.76-gentoo-r1 kernel there. That's the one being booted.

There should also be a kernel file with the same timestamp as  /usr/src/linux/arch/x86/boot/bzImage. Its a renamed copy of that file. It may well have genkernel in its name.

There should also be a matching genkernel inird.

There may be other things there too.

It would be useful to post the output of 

```
ls -l /boot
```

If that is all as described, the kernel build and install process is good.

That only leaves the grub.cfg file.

Please put 

```
/boot/grub/grub.cfg
```

 onto a pastebin.

There are two things that can happen here.

You did not update grub.cfg to include, your genkernel kernel.

You did update grub.cfg but the new kernel is not the default boot option.

----------

## enym

Here are the outputs of:

```

ls -l /usr/src/linux/.config

        -rw-r--r-- 1 root root 223161 Nov 11 18:50 /usr/src/linux/.config

ls -l /usr/src/linux/arch/x86/boot/bzImage

        -rw-r--r-- 1 root root 9154144 Nov 11 18:57 /usr/src/linux/arch/x86/boot/bzImage

```

/boot was already mounted, so

```

ls -l /boot

        total 53481

        -rwxr-xr-x 1 root root   126446 Nov 11 16:49 config-5.10.76-gentoo-r1

        -rwxr-xr-x 1 root root   126431 Nov 11 00:00 config-5.10.76-gentoo-r1.old

        drwxr-xr-x 3 root root      512 Nov  6 06:33 EFI

        drwxr-xr-x 6 root root     1024 Nov  6 12:17 grub

        -rwxr-xr-x 1 root root 11014812 Nov 11 19:35 initramfs-5.10.76-gentoo-r1-x86_64.img

        -rwxr-xr-x 1 root root  3607699 Nov 11 16:49 System.map-5.10.76-gentoo-r1

        -rwxr-xr-x 1 root root  3598182 Nov 11 00:00 System.map-5.10.76-gentoo-r1.old

        -rwxr-xr-x 1 root root  4795728 Nov 11 18:57 System.map-5.10.76-gentoo-r1-x86_64

        -rwxr-xr-x 1 root root 11185792 Nov 11 16:49 vmlinuz-5.10.76-gentoo-r1

        -rwxr-xr-x 1 root root 11151264 Nov 11 00:00 vmlinuz-5.10.76-gentoo-r1.old

        -rwxr-xr-x 1 root root  9154144 Nov 11 18:57 vmlinuz-5.10.76-gentoo-r1-x86_64

```

And this is my grub.cfg: http://dpaste.com/3WN2WKA5W

I don't think I updated the grub.cfg, so I did it now, this is the new one that generated (I think): http://dpaste.com/2L3ZBVSGC

It works now! I configured the Network with Net-setup from the livecd-tools.

Is there a better way to to it, or should I leave it at that?

Thank you so much for your help!!

Edit:

after rebooting, I noticed that it still says that the module failed to load. Is it something I can fix or should I just not worry about it?

----------

## NeddySeagoon

enym,

Not updating grub.cfg was why genkernel appeared to not work.

You didn't ever boot the kernel that it made.

Your new grub.cfg contains

```
   echo   'Loading Linux 5.10.76-gentoo-r1-x86_64 ...'

   linux   /vmlinuz-5.10.76-gentoo-r1-x86_64 root=UUID=8c18ece1-7ac8-4e19-affd-d75b77769835 ro  

   echo   'Loading initial ramdisk ...'

   initrd   /initramfs-5.10.76-gentoo-r1-x86_64.img
```

for the default entry.

Which "module failed to load" ?

If its one that you don't need, it won't matter.

Pastebin dmesg, so we can see what happens.

You should not need net-sepup. Configure your system to start the network automatically at boot.

The details of how you do that depend on if you use openrc or systemd, or some other startup system.

As genkernel works, you can put off a manually configured kernel for some time, even indefinately.

----------

## enym

Actually, it doesn't matter. I forgot to remove a driver that I was loading by hand but couldn't be found. 

Again thank you for your help, I am now using nmcli to connect to the WiFi.

----------

