Oh Geez NetworkManager, Why are you so picky about interface name?

Posted by Umang on Aug. 1, 2018, 5:48 p.m.

Some weeks ago, after a system update, I felt my internet connection is lagging too much, so after some speed tests and manual testing, I got to know that I was getting the only 1/10th of the bandwidth than what is provided by wifi router. And latency was also crazy high. I looked at logs but there wasn't anything suspicious. Then obviously I turned to google to see if anyone else had such a problem. And to my surprise, I found out that many people had been experiencing this problem and the root cause of the issue was the ancient drivers of my wireless card(RTL8723BE). I asked for any solution on the forum and got some suggestions or more of workarounds. But even after doing all the workarounds, my wifi connectivity increased only 20% in terms of bandwidth and latency remained almost the same. Lucky me that I had external wifi card lying around so after plugging it, all of my internet issues were solved(Or so did I thought!).

So now, after a day, I booted in Debian(I use Manjaro and Debian with dual booting) and tried to connect to wifi network using external wifi card and to my surprise, it didn't connect. Now, this was very strange as it was working on Manjaro. From the logs, I found out that there was some problem was NetworkManager so I tried to connect manually using wpa_supplicant and it got connected flawlessly! Now, this was something strange and interesting thing happening but well I didn't have time at that time(or more precisely, motivation.) to solve or get to root of the problem so instead I just wrote a small bash script to connect to wifi network whenever I boot Debian and get a new IP address from DHCP server.

This fine evening I was using Debian and I felt motivated enough to fix this problem as it's been quite a few weeks using the workaround. So I took a look at logs again and found this specific line
"aborting authentication by local choice (Reason: 3=DEAUTH_LEAVING)"
So I did a quick google search with keywords "deauth leaving 3" and I found that the first google search result was about the same issue.

Any guesses what could cause such behavior? You will be surprised to know that it was because of interface name of fucking wifi card! Those of you who don't know, network cards have a specific name associated to them known as the interface name. For example, wlo1, wlo2, wlan0 etc for wifi networks, en1sp0, eth0 etc for wired connections. My external wifi card was assigned rather odd "wlxc83a35c6ea37" interface name and this stupid NetworkManager won't connect to any network using network cards with such long/odd interface names.

So now that I identified the problem, the question arose. How to solve it? The solution was quite simple. We need to add udev entry for USB device specifying name we want to assign to it. So I assigned "wlan1" name to it and rebooted my laptop and this bitch("NetworkManager") got connected to wifi network automatically! For those of you who don't know what are udev rules, It allows you to identify devices based on their properties, like vendor ID and device ID dynamically. udev allows for rules that specify what name is given to a device, regardless of which port it is plugged into.(They live in /etc/udev/rules.d/ directory)

Now you guys must be thinking that since I fixed the issue, it must be the end of this post because well what is left after the solution, right? But if you have read carefully and remembered that this same external wifi card was working on my Manjaro install with similar long/odd interface name without any issues. So then why these issues with Debian? The short answer is I don't have any idea! The long answer is that Manjaro is rolling release and it has the latest version of NetworkManager whereas Debian has a rather old version of NetworkManager so that might be the issue. But verify this assumption it will take at least 2-3 days(usual uptime of my machine is 2-3 days!).

This was a very long post. So if you have reached so far, Thank you. And If you are free to read such long posts, get a job. Seriously!

open terminal and type it: sudo tee /etc/modprobe.d/rtl8723be.conf <<< "options rtl8723be ant_sel=1" And reboot ! if still not solve then try to change ant_sel=2

DP wrote on Aug. 3, 2018, 12:20 a.m.

I have already tried it. It did increase the performance but not much. Even with this workaround, I was getting max 6 mbps bandwidth and 20-25ms latency.

darkLord wrote on Aug. 3, 2018, 3 p.m.