On a HP laptop with a Realtek RTL8111 wifi card I was able to install a working wifi connection after installing kernel modules, but after two times the wifi completely disappeared again. The first time I was not able to restore it using all kinds of tricks but I just had to reinstall Ubuntu. But within another week Wifi disappeared again and no card was detected at all.
After a lot of DuckDuckgoing I was able to recover Wifi by the help of the guide of @unixblogger found here:
I am quoting him and adapting it a little:
The automatic way
NOTE: Thanks to the user “Liyu” who gave me this hint!
NOTE2: For this way you need a working internet connection. You could use WLAN or a USB ethernet card like this one to get a temporary internet connection. You could also download every needed single package onto USB from another PC and install them in the right order.
As I said ealier, 5 years is a long time. And today Ubuntu and Debian have the driver included in it’s repository. For Debian you have to enable the non-free package sources. For Ubuntu you have to enable the universe package sources. You can easily do this by open your /etc/apt/sources.list as root with your editor of choice and add for each line starting with “deb” non-free or universe at the end. So for example, on Ubuntu:
deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted
would become to
deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted universe
After this you have to do a:
sudo apt-get update
You can of course use graphical ways to enable non-free or universe. After you enabled the missing package repository, you will be ready to install the driver. This can be easily done with the following command:
sudo apt-get install r8168-dkms
The procedure will take some time, depending on your CPU because the driver will be build for your working Kernel. The good side is, that if any Kernel update happens on your machine, the kernel will be rebuild against the new Kernel automatically after the update because of the use of dkms.
After the procedure is finished, you should be able to use your network card instantly. If not, you should consider a reboot of your PC then.
While a simple boot was not true in this case I also had to disable secure boot in the bios and on the subject of secure boot/uefi I will do some more research.
I know have to wait till the user brings me the laptop again without Wifi.