Till last year whenever I encountered a laptop with WiFi not working in linux it was a Broadcom Wireless Adapter.

But this year things are different. Nearly all new HP laptops are having problems with WiFi in linux (ubuntu, arch, manjaro). And surprisingly the problem is not that the WiFi driver is not working at all. But it is worse, the signal strength received is so weak that it is absolutely unusable.

A quick lspci | grep Wireless shows the Wireless Adapter in your system. In my case the device causing problem was a Realtek:

RTL8723be

After scanning through numerous threads I finally found the solution in this github issue:

https://github.com/lwfinger/rtlwifi_new/issues/88

So here is the step by step procedure to solve the issue:

First some make sure the dependencies for building the driver are installed:

In Ubuntu:

sudo apt-get install build-essential git

In Arch:

sudo pacman -S git
sudo pacman -S linux-headers

Now clone the rtlwifi_new repository:

git clone git@github.com:lwfinger/rtlwifi_new.git

Checkout the branch rock.new_btcoex

cd rtlwifi_new
git checkout rock.new_btcoex

Now build and install the driver

make
sudo make install

Reboot the system.

Now disable and enable the driver with proper parameters.

sudo modprobe -rv rtl8723be
sudo modprobe -v rtl8723be ant_sel=2

NOTE: If this does not work try: sudo modprobe -v rtl8723be ant_sel=1