How can I install the proper wifi card for my Hp pavellion gaming laptop in Ubuntu 21.04? [duplicate]

Solution 1:

Of course, if you wish, you could return the laptop and request that you instead receive a replacement equipped with the captioned Intel AX200. As well, you could easily install the correct driver for your Realtek device.

With a temporary internet connection by ethernet, tethered or whatever means possible, open a terminal and do:

sudo apt update
sudo apt install -y git build-essential
git clone https://github.com/lwfinger/rtw89.git
cd rtw89
make
sudo make install
sudo mkdir /usr/lib/firmware/rtw89
sudo cp  rtw8852a_fw.bin  /usr/lib/firmware/rtw89/
sudo modprobe rtw89pci

Your wireless should now be working.

EDIT: From time to time, when security flaws are corrected, when bugs are fixed or when new features are added, Update Manager will offer updates that include ‘Complete Linux Image’, that is, a newer kernel version than that installed today. After the update is installed, you will be prompted to restart to complete the update. After you restart, your wireless will no longer be working. To restore the wireless, open a terminal and do:

cd ~/rtw89
git pull
make
sudo make install
sudo modprobe rtw89pci

Please retain the rtw89 file and these instructions for that time.

At some future time, the rtw89 suite of drivers will be included in the latest kernels and this process will no longer be required. We haven’t yet any idea when that may occur.

Solution 2:

When running "sudo modprobe rtw89pci" above, you may run into 'operation not permitted' problems.

sudo modprobe rtw89pci   - 'operation not permitted'

This is because of SecureBoot enabled in your OS. You can follow this link to check and disable SecureBoot.

sudo apt-get install mokutil
mokutil --sb-state
sudo mokutil --disable-validation

Then you need to reboot and follow instructions to disable mok secureboot.

After reboot, run "sudo modprobe rtw89pci" again. It should work.

Good luck!

Solution 3:

When ubuntu gets updated, wifi driver may stop working. When you try install the driver again you may get the following error:

modprobe: ERROR: could not insert 'rtw89pci': Exec format error

This happens because you are trying to install the previously compiled files on the new kernel. The solution is to compile the files again. One possible way to do this is to

cd rtw99
rm *.o # removes previous .o files
make
sudo make install
sudo mkdir /usr/lib/firmware/rtw89
sudo cp  rtw8852a_fw.bin  /usr/lib/firmware/rtw89/
sudo modprobe rtw89pci