Updated: April 18, 2015
All right. This is going to be a pretty quick and simple tutorial. The problem you're facing is as follows. You are running Ubuntu Trusty or a derivative thereof on a laptop that comes with a Realtek RTL8723BE Wireless network card. After a few seconds, minutes or hours, the quality and speed of the Wireless connection degrades until it becomes unusable.
In this short guide, we will work through one very quick and elegant workaround for the problem, and then also suggest a longer, more complex fix. Either way, some advanced technical knowledge is needed. Let's begin.
Recently, I bought a Lenovo G50 laptop for the sole purpose of testing Linux distributions on it. While I expected UEFI, Secure Boot and the likes to pose a problem, I did not expect the network to be an issue. In Ubuntu 14.04, this is exactly what happened. However, the problem does not manifest in the newer Netrunner 15, which is built on Utopic, and comes with a newer kernel and better driver support.
What happens is, the network connection simply becomes very slow. There are no apparent reasons for this, and reboots do help fix the issue temporarily. If you have followed my site for some time now, you will recall I had pretty much the same problem with Realtek drivers in Kubuntu, quite a while back. This is a good initial pointer, and indeed we will try to replace or tweak the Wireless card driver to make it work.
We have two options, and we will begin with the simple one. The only thing you really need to do is write a single line of text into a file. Basically, you will need to provide non-default options for the kernel module that governs the Wireless card. Specifically, open the /etc/modprobe.d/rtl8723be.conf file in a text editor, with sudo or root permissions. Then, add the following text:
options rtl8723be fwlps=N ips=N
Now, for these changes to take effect, reboot. There is another way, without rebooting, but let's not complicate it. After you restart your host, the Wireless connection should be stable and solid, and you should achieve good downloads. Try it, see what gives.
From the technical perspective, the two options govern the driver behavior. You can check the details by running modinfo rtl8723be. This will tell you about various power saving options.
The more difficult solution ...
The second part is only if the first fix does not work. Recompiling code can be painful, and you will need to do it every time there's a kernel update. However, assuming you have a high threshold of pain, and you like to suffer, then let's explore this other venue.
To compile code, you will need compilation tools. We've discussed this many times before. The transitional package build-essential provides most of it. However, several Ubuntu versions back, the dev team split the kernel headers from build essentials, so you will need to install them separately.
You will also need git - as we will pull some sources from the version control repositories. Essentially, it's just grabbing code for compilation, except that it is stored in a slightly different manner from your typical download. That's all. Fancy.
sudo apt-get install linux-headers-generic build-essential git
Next, clone the tree containing the Realtek driver code:
git clone http://github.com/lwfinger/rtl8723be
Finally, compile the code:
sudo make install
sudo modprobe rtl8723be
The make clean command will remove any compiled kernel objects from a previous compilation. If you're doing it the first time, it won't do much, but for any subsequent compilation, after kernel updates and such, it will purge existing modules, and then you can create new ones. If you want to script this sequence, it also makes for a tidier code with fewer branches of logic.
The modprobe command will not work if the module is already loaded in memory. So you should disconnect from the network first, gently remove the driver (modprobe -r rtl8723be) from memory, and then compile. After you're confident, you can add the removal line into your script as the first line or such. Just be careful.
Last but not the least, you may also want to tweak the software encryption parameter, as some users have also reported this being the culprit. Again, just append the right option to the directive in the rtl8723be.conf file, with swenc=Y (default is N), see which works for you.
A bunch of references and pointers that may help:
An older thread for Ubuntu 13.10, discussing the same problem
Likewise, an older bugzilla entry; how long does it take to fix this crap?
You can find more stuff, I'm sure. But hopefully, my article is good enough.
There you go. Hopefully, now you are enjoying Wireless in Trusty, and it will only be a few more years until the support is properly integrated in the kernel. Reminds me of my T400 woes, which were never solved. I want to say, go for Intel Wireless, but then there's no guarantee there. Maybe just fewer issues on average.
Anyhow, this short guide has everything, including some fancy compilations, manipulation of kernel modules and their parameters and such. You've also learned a little more about the necessary tools to support this process, how Linux works and behaves, and some more besides. Not bad for a lazy afternoon, in case you are feeling lazy and reading on this in the afternoon. We're done. Enjoy.