How to make my pci wifi card rtl8822 working on ubuntu

I installed Ubuntu 17.04 on my HP OMEN 15(2017) laptop and found wifi card not working. I followed some advice from My WiFi adapter is not working at all, how to troubleshoot? | Ask Ubuntu I identified the wifi card id is Realtek 10ec:b822.

I found some information on these websites:
the product info site: RTL8822BE | Realtek.com
driver for windows: Realtek RTL8822BE Wireless LAN Driver for Windows 10 (64-bit) | support.lenovo.com

########## wireless info START ##########

Report from: 17 Jun 2017 15:09 CST +0800

Booted last: 17 Jun 2017 00:00 CST +0800

Script from: 25 Mar 2017 07:04 UTC +0000

##### release ###########################

Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:    17.04
Codename:   zesty

##### kernel ############################

Linux 4.10.0-19-generic #21-Ubuntu SMP Thu Apr 6 17:04:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Parameters: ro, quiet, splash, vt.handoff=7

##### desktop ###########################

GNOME

##### lspci #############################

03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 16)
    Subsystem: Hewlett-Packard Company RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [103c:838f]
    Kernel driver in use: r8169

04:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. Device [10ec:b822]
    Subsystem: Hewlett-Packard Company Device [103c:831b]

05:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader [10ec:522a] (rev 01)

##### lsusb #############################

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0bda:b00b Realtek Semiconductor Corp. 
Bus 001 Device 002: ID 04f2:b5d6 Chicony Electronics Co., Ltd 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

##### PCMCIA card info ##################

##### rfkill ############################

0: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no

##### lsmod #############################

hp_wmi                 16384  0
sparse_keymap          16384  1 hp_wmi
mxm_wmi                16384  1 nouveau
wmi                    16384  3 mxm_wmi,nouveau,hp_wmi

##### interfaces ########################

auto lo
iface lo inet loopback

##### ifconfig ##########################

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback <MAC address> brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether <MAC 'enp3s0' [IF1]> brd <MAC address>
    inet 192.168.50.5/24 brd 192.168.50.255 scope global dynamic enp3s0
       valid_lft 83146sec preferred_lft 83146sec
    inet6 fe80::ef4:dc54:7aa3:546/64 scope link 
       valid_lft forever preferred_lft forever

##### iwconfig ##########################

enp3s0    no wireless extensions.

lo        no wireless extensions.

##### route #############################

default via 192.168.50.1 dev enp3s0 proto static metric 100 
169.254.0.0/16 dev enp3s0 scope link metric 1000 
192.168.50.0/24 dev enp3s0 proto kernel scope link src 192.168.50.5 metric 100 

##### resolv.conf #######################

nameserver 127.0.0.53

##### network managers ##################

Installed:

    NetworkManager

Running:

root       829     1  0 14:15 ?        00:00:00 /usr/sbin/NetworkManager --no-daemon

##### NetworkManager info ###############

GENERAL.DEVICE:                         enp3s0
GENERAL.TYPE:                           ethernet
GENERAL.NM-TYPE:                        NMDeviceEthernet
GENERAL.VENDOR:                         Realtek Semiconductor Co., Ltd.
GENERAL.PRODUCT:                        RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
GENERAL.DRIVER:                         r8169
GENERAL.DRIVER-VERSION:                 2.3LK-NAPI
GENERAL.FIRMWARE-VERSION:               
GENERAL.HWADDR:                         <MAC 'enp3s0' [IF1]>
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.REASON:                         0 (No reason given)
GENERAL.UDI:                            /sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/net/enp3s0
GENERAL.IP-IFACE:                       enp3s0
GENERAL.IS-SOFTWARE:                    no
GENERAL.NM-MANAGED:                     yes
GENERAL.AUTOCONNECT:                    yes
GENERAL.FIRMWARE-MISSING:               no
GENERAL.NM-PLUGIN-MISSING:              no
GENERAL.PHYS-PORT-ID:                   --
GENERAL.CONNECTION:                     Wired connection 1
GENERAL.CON-UUID:                       d0a6c4d6-510a-325c-8465-361e2f13261b
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/0
GENERAL.METERED:                        no (guessed)
CAPABILITIES.CARRIER-DETECT:            yes
CAPABILITIES.SPEED:                     100 Mb/s
CAPABILITIES.IS-SOFTWARE:               no
WIRED-PROPERTIES.CARRIER:               on
CONNECTIONS.AVAILABLE-CONNECTION-PATHS: /org/freedesktop/NetworkManager/Settings/{0}
CONNECTIONS.AVAILABLE-CONNECTIONS[1]:   d0a6c4d6-510a-325c-8465-361e2f13261b | Wired connection 1
IP4.ADDRESS[1]:                         192.168.50.5/24
IP4.GATEWAY:                            192.168.50.1
IP4.ROUTE[1]:                           dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.DNS[1]:                             192.168.50.1
DHCP4.OPTION[1]:                        requested_subnet_mask = 1
DHCP4.OPTION[2]:                        requested_rfc3442_classless_static_routes = 1
DHCP4.OPTION[3]:                        subnet_mask = 255.255.255.0
DHCP4.OPTION[4]:                        domain_name_servers = 192.168.50.1
DHCP4.OPTION[5]:                        ip_address = 192.168.50.5
DHCP4.OPTION[6]:                        requested_static_routes = 1
DHCP4.OPTION[7]:                        dhcp_server_identifier = 192.168.50.1
DHCP4.OPTION[8]:                        requested_time_offset = 1
DHCP4.OPTION[9]:                        broadcast_address = 192.168.50.255
DHCP4.OPTION[10]:                       requested_interface_mtu = 1
DHCP4.OPTION[11]:                       dhcp_rebinding_time = 75600
DHCP4.OPTION[12]:                       requested_domain_name_servers = 1
DHCP4.OPTION[13]:                       dhcp_message_type = 5
DHCP4.OPTION[14]:                       requested_broadcast_address = 1
DHCP4.OPTION[15]:                       routers = 192.168.50.1
DHCP4.OPTION[16]:                       wpad = a
DHCP4.OPTION[17]:                       dhcp_renewal_time = 43200
DHCP4.OPTION[18]:                       requested_domain_name = 1
DHCP4.OPTION[19]:                       requested_routers = 1
DHCP4.OPTION[20]:                       expiry = 1497766543
DHCP4.OPTION[21]:                       requested_wpad = 1
DHCP4.OPTION[22]:                       host_name = OMEN15
DHCP4.OPTION[23]:                       requested_netbios_scope = 1
DHCP4.OPTION[24]:                       requested_ms_classless_static_routes = 1
DHCP4.OPTION[25]:                       requested_netbios_name_servers = 1
DHCP4.OPTION[26]:                       network_number = 192.168.50.0
DHCP4.OPTION[27]:                       requested_domain_search = 1
DHCP4.OPTION[28]:                       requested_ntp_servers = 1
DHCP4.OPTION[29]:                       next_server = 192.168.50.1
DHCP4.OPTION[30]:                       requested_host_name = 1
DHCP4.OPTION[31]:                       dhcp_lease_time = 86400
IP6.ADDRESS[1]:                         fe80::ef4:dc54:7aa3:546/64
IP6.GATEWAY:                            

##### NetworkManager.state ##############

[main]
NetworkingEnabled=true
WirelessEnabled=true
WWANEnabled=true

##### NetworkManager.conf ###############

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

##### NetworkManager profiles ###########

[[/etc/NetworkManager/system-connections/mac's MacBook Pro]] (600 root)
[connection] id=mac's MacBook Pro | type=wifi | permissions=
[wifi] mac-address=<MAC address> | mac-address-blacklist= | ssid=mac's MacBook Pro
[ipv4] method=auto
[ipv6] method=auto

[[/etc/NetworkManager/system-connections/9527]] (600 root)
[connection] id=9527 | type=wifi | permissions=
[wifi] mac-address=<MAC address> | mac-address-blacklist= | ssid=9527
[ipv4] method=auto
[ipv6] method=auto

[[/etc/NetworkManager/system-connections/Connectify-9999]] (600 root)
[connection] id=Connectify-9999 | type=wifi | permissions=
[wifi] mac-address=<MAC address> | mac-address-blacklist= | ssid=Connectify-9999
[ipv4] method=auto
[ipv6] method=auto

##### iw reg get ########################

Region: Asia/Shanghai (based on set time zone)

global
country 00: DFS-UNSET
    (2402 - 2472 @ 40), (6, 20), (N/A)
    (2457 - 2482 @ 20), (6, 20), (N/A), AUTO-BW, PASSIVE-SCAN
    (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
    (5170 - 5250 @ 80), (6, 20), (N/A), AUTO-BW, PASSIVE-SCAN
    (5250 - 5330 @ 80), (6, 20), (0 ms), DFS, AUTO-BW, PASSIVE-SCAN
    (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
    (5735 - 5835 @ 80), (6, 20), (N/A), PASSIVE-SCAN
    (57240 - 63720 @ 2160), (N/A, 0), (N/A)

##### iwlist channels ###################

enp3s0    no frequency information.

lo        no frequency information.

##### iwlist scan #######################

enp3s0    Interface doesn't support scanning.

lo        Interface doesn't support scanning.

##### module infos ######################

##### module parameters #################

##### /etc/modules ######################

##### modprobe options ##################

[/etc/modprobe.d/blacklist-ath_pci.conf]
blacklist ath_pci

[/etc/modprobe.d/blacklist.conf]
blacklist evbug
blacklist usbmouse
blacklist usbkbd
blacklist eepro100
blacklist de4x5
blacklist eth1394
blacklist snd_intel8x0m
blacklist snd_aw2
blacklist i2c_i801
blacklist prism54
blacklist bcm43xx
blacklist garmin_gps
blacklist asus_acpi
blacklist snd_pcsp
blacklist pcspkr
blacklist amd76x_edac

[/etc/modprobe.d/blacklist-rare-network.conf]
alias net-pf-3 off
alias net-pf-6 off
alias net-pf-9 off
alias net-pf-11 off
alias net-pf-12 off
alias net-pf-19 off
alias net-pf-21 off
alias net-pf-36 off

[/etc/modprobe.d/intel-microcode-blacklist.conf]
blacklist microcode

[/etc/modprobe.d/iwlwifi.conf]
remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211

[/etc/modprobe.d/mlx4.conf]
softdep mlx4_core post: mlx4_en

##### rc.local ##########################

grep: /etc/rc.local: No such file or directory

##### pm-utils ##########################

##### udev rules ########################

##### dmesg #############################

[    5.520481] Bluetooth: hci0: rtl: examining hci_ver=07 hci_rev=000b lmp_ver=07 lmp_subver=8822
[    5.520482] Bluetooth: hci0: rtl: loading rtl_bt/rtl8822b_config.bin
[    5.543562] Bluetooth: hci0: rtl: loading rtl_bt/rtl8822b_fw.bin
[    7.556142] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
[    7.576972] r8169 0000:03:00.0 enp3s0: link down
[    7.577052] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
[    7.585025] r8169 0000:03:00.0 enp3s0: link down
[   15.054434] r8169 0000:03:00.0 enp3s0: link up
[   15.054442] IPv6: ADDRCONF(NETDEV_CHANGE): enp3s0: link becomes ready

########## wireless info END ############

Updated Answer for 18.04

The accepted solution here is out of date for Ubuntu 18.04 - the rtl8822be is supposed to work out of the box.

  • During installation, Ubuntu should detect what Wifi Card you have and install the correct driver for it, but to search for any further available drivers on Ubuntu 18.04, go to the Software & Updates program and click the Additional Drivers tab.

('Software & Updates' can be found by clicking 'Activities' in the top left of your desktop. Typing 's' in the search box should be enough to show the available relevant programs)

  • Another occasional 'quirk' that has occurred is for Secure Boot to have an issue with the signing of the driver and preventing it from being loaded.

You can make sure that Secure Boot is disabled by checking your machine's BIOS settings (usually accessed by pressing a specific key chosen by your manufacturer, such as f2 or esc when you switch your computer on, but the Grub Menu also lets you select 'System setup' to take a look at your options).

  • In a few cases, a Software or Hardware block can be preventing the Wifi from connecting. You can check for this by typing rfkill list into the terminal.

If you are still experiencing issues, there is a good troubleshooting guide here: https://help.ubuntu.com/stable/ubuntu-help/net-wireless-troubleshooting.html.en


I just got this working, it is fairly easy all up (after googling etc.)

  1. Install the latest 4.14 kernel with the driver code, (from the instructions here)

    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14/linux-headers-4.14.0-041400_4.14.0-041400.201711122031_all.deb
    
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14/linux-headers-4.14.0-041400-generic_4.14.0-041400.201711122031_amd64.deb
    
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14/linux-image-4.14.0-041400-generic_4.14.0-041400.201711122031_amd64.deb
    
    sudo dpkg -i linux*.deb
    
  2. Download the rtl8822befw.bin firmware file from here.

  3. Save it in /lib/firmware/rtlwifi. Please note newer distributions may have this file already in here.

  4. Reboot.

Enjoy

Please note that this driver is still in staging at the moment, so use at your own risk!