Finally fixing the infamous disappearing Wi-Fi on Ubuntu

This article is a follow-up explanation of how I fixed the issue of the Wi-Fi network disappearing on my Lenovo Ideapad 330 laptop running Ubuntu 20.04. I first encountered this issue almost three years ago, on the same laptop running, but it was running Ubuntu 18.04 back then. I found a solution that worked for me from back then, which I had shared in just a Github [Gist](https://gist.github.com/adybose/248bf6e81c7fe8c2b4e7dae413560e60) back then.

Only about last year, I uploaded a similar issue that I encountered with Ubuntu 20.04. It was a 30-second screen recording, with no audio. I didn't even provide the solution back then. I just wanted to put up a record of it since I had encountered this problem so frequently. when I found that someone had commented on that video asking for a solution to that problem, I had to write a reply to him, after which I am writing the detailed account here.

The issue of the Wi-Fi Network crashing and disappearing is a very common and long-standing issue plaguing Linux users because the Wireless Network Cards in their machines require their proprietary drivers, which are not available freely for Linux.

The open-source community however have however published some unofficial drivers that can be downloaded and built on a Linux machine to finally have Wi-Fi working as intended. However, these solutions don't work every time, and users have to fiddle around with the Linux kernel, making tweaks and upgrades, to finally get the Wi-Fi working again. But, before you can look for any drivers for your Linux distribution like Ubuntu, you will have to connect to the Internet to search and download the one that would best work for your Operating System's Linux kernel.

So, whenever you find your Wi-Fi isn't working on an Ubuntu run computer, the first thing you can do is restart the Wi-Fi network without a system reboot by running the below command in your Terminal:

sudo systemctl restart NetworkManager

If this doesn't work, a manual reboot should bring back the Wi-fi Network. However, this is not a complete fix, and the issue usually comes back again after having worked for some time. For a more permanent solution, you will have to install the drivers for your specific Wireless Network Card/Adapter which came with your computer.

If you still aren't able to connect to the Internet wirelessly, you can use a wired Internet Connection (Ethernet or USB Tethering from your phone) to connect to the Internet and begin your search for the unofficial releases of the drivers based on what Wireless Network Adapter you have in your system.

To look for the required Wi-Fi driver for your Operating System, first, determine the vendor of your Wireless Network Adapter by running the following command from the terminal:

lspci -vnn | grep Network

You should be able to identify the vendor and driver information from the output of the above command. Example:

Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller [14e4:432b]

If your wireless adapter is by Broadcom, you may very easily be able to install additional drivers from the Ubuntu Software & Updates GUI Application. Alternatively, you can install the open-source version for Chip-IDs BCM 4306 (rev 03), 4311, 4312, 4318, 4322, 4331, 43224 and 43225, by running the following commands from the terminal:

sudo apt remove broadcom-sta-dkms bcmwl-kernel-source
sudo apt install firmware-b43-installer

However, if your wireless card/adapter is by Realtek (as was in my case with my Lenovo Ideapad 330), you may see a response like the one below when you run the above lspci command:

Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter [10ec:c821]

This command shows the supported Driver for this Wireless Network Adapter which is RTL8821CE. You may have to look for compatible unofficial versions maintained by the open-source community. But, there may be no guarantees about the long-term support for these. For my Ubuntu 18.04 run machine, the solution was to run the following steps:

git clone https://github.com/tomaspinho/rtl8821ce.git
cd rtl8821ce/
sudo make all
sudo make install
sudo modprobe -a 8821ce

Luckily, since 2020, a package called rtl8821ce-dkms is now available directly from the Ubuntu Repositories, which can be installed just by running the command:

sudo apt install rtl8821ce-dkms

This will install all the necessary drivers for your Realtek Wireless Network Card, and all you have to do now is to restart your computer. After the restart, your Wi-Fi network should now be restored and you should not encounter the issue again issue should not come again.

This concludes my tutorial for fixing the crashing Wi-Fi issues for Ubuntu and many other Linux distro users. Hope you find the solution simple and working for you whenever you find it.

Have you ever faced this Wi-Fi issue with your computer, running Ubuntu, or any other Linux distribution? I would love to read your comments about those experiences and try to respond to any of your questions as best as I can.

Until next time,
Cheers!