Ubuntu – How to get a Realtek RTL8723BE wireless card to work

driversrealtek-wirelesswireless

I have installed Ubuntu 15.04 on my laptop with RTL8723BE Wi-fi card. But it is always disconnecting from network. I have tried echo "options rtl8723be fwlps=N ips=N" | sudo tee /etc/modprobe.d/rtl8723be.conf but that didn't helped. What can I do to prevent the wifi from disconnecting? If I upgrade to kernel 4.X, will it help?

~$ lspci -knn | grep Net -A2

09:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter [10ec:b723]
    Subsystem: Hewlett-Packard Company Device [103c:2231]
    Kernel driver in use: rtl8723be


~$ rfkill list
0: hci0: Bluetooth
    Soft blocked: yes
    Hard blocked: no
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no


~$ ifconfig && iwconfig && route -n && ping -c 1 google.com
eth0      Link encap:Ethernet  HWaddr 38:63:bb:cd:4a:7e  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:53 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:752 (752.0 B)  TX bytes:8445 (8.4 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:3870 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3870 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:314613 (314.6 KB)  TX bytes:314613 (314.6 KB)

wlan0     Link encap:Ethernet  HWaddr c0:38:96:6d:c4:83  
          inet addr:192.168.1.205  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c238:96ff:fe6d:c483/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15240 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14627 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14410285 (14.4 MB)  TX bytes:2192744 (2.1 MB)

eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"DIR-615"  
          Mode:Managed  Frequency:2.437 GHz  Access Point: 00:90:4C:08:00:0D   
          Bit Rate=150 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr=2347 B   Fragment thr:off
          Power Management:off
          Link Quality=70/70  Signal level=-22 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:186   Missed beacon:0

lo        no wireless extensions.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    400    0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
PING google.com.Dlink (172.26.136.19) 56(84) bytes of data.
64 bytes from 19.136.26.172.in-addr.arpa (172.26.136.19): icmp_seq=1 ttl=249 time=102 ms

--- google.com.Dlink ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 102.547/102.547/102.547/0.000 ms

Best Answer

  • First of all remove the settings you made.

    sudo rm /etc/modprobe.d/rtl8723be.conf
    

    If you do not have this file, nothing is wrong.

    Then install a good driver

    sudo add-apt-repository ppa:hanipouspilot/rtlwifi
    sudo apt-get update
    sudo apt-get install rtlwifi-new-dkms
    

    Reboot and enjoy

    If you still have problems (low signal), you may need to add an option:

    echo "options rtl8723be ant_sel=2"  | sudo tee /etc/modprobe.d/rtl8723be.conf
    

    then reboot again.

    Expanation is made by chili555 in this answer.

    This is the same driver as https://github.com/lwfinger/rtlwifi_new, rock.new_btcoex branch but packed as dkms.

    You can see all that at https://github.com/hanipouspilot/rtlwifi_new/tree/rock.new_btcoex

    If you also need bluetooth working, run also:

    sudo apt-get install rtl8723au-bt-dkms linux-firmware
    

    Note: Support for 4.2 kernels and Ubuntu 15.10 has been added to the PPA. For kernel 4.2 the bluetooth driver should not be installed from the PPA. There is already native support of the bluetooth adapter in kernel 4.2.

    Offline guide

    If you do not have any internet connection, you can download the package using another computer, a phone, etc.

    The package is HERE

    You will also need DKMS installed. You can find the DKMS package for Ubuntu 16.04 HERE

    Copy these two files to the Ubuntu Home folder (~/) and run in terminal

    sudo dpkg -i dkms*.deb rtlwifi*.deb
    

    Then reboot.

    Important: For new Ubuntu kernels installed on a system with Secure Boot on UEFI, the unsigned kernel module may not load. In this case see THIS ANSWER to fix it.

    Update: I have now a laptop with this adapter. It works perfectly on the 4.8 kernel that is available in Ubuntu 16.10 and 16.04.2.

    Installation of a custom driver is required only for kernels older than 4.8.

    I suggest installing the 4.8 kernel to Ubuntu 16.04 if it is not installed yet by

    sudo apt install linux-generic-hwe-16.04
    

    The device should work well after a reboot.

    But still if your laptop has only one antenna and it is attached to a "wrong" connector, setting ant_sel=2, or and_sel=1 may be required.

  • Related Question