-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(can't fix) Hangs on iw dev wlan0 del
#63
Comments
Hi @ValdikSS Ouch. That is bad behavior. As much as I use usb wifi adapters, I never find the need to use that specific command so I can see why I would have missed this. May I ask what you are trying to accomplish? Nick |
I'm trying to use rtl8811cu on OpenWrt 22.03.3, and this is what is does internally. |
It locks here: 8821cu-20210916/os_dep/linux/os_intfs.c Line 2219 in 8cb0ee1
I'm not sure which exact mutex/semaphore should not be acquired for unregister_netdevice. |
I took a look at where it locks today. I also tried to see when the last time that code was modified and could not determine when. It appears this code has not been touched in a long time and it is the same code is other WiFi 5 generation Realtek drivers so the search has to continue for a hint as to what could be causing this. I use OpenWRT but only with adapters that use in-kernel drivers. I have no experience trying to use Realtek drivers on OpenWRT. Have you tried the command on other platforms? x86_64 or ARM64? I am hesitant to start playing with code until such time as we can narrow down whether this is an issue that affects more than just OpenWRT. |
I am testing on a Debian 11.6 x86_64 now, just happen to be created a VM so figured I would try to replicate the issue. @ValdikSS, what specific release of OpenWRT are you using? I happen to be familiar with OpenWRT. What hardware? Might be worth testing on OpenWRT for x86 as well. |
@Jibun-no-Kage, OpenWrt 22.03.3, x86 "generic" VM. |
Cool, that is what I needed to know, I will test on x86 generic OpenWRT as well. As for using the specific command, we pretty much all used NetworkManager in testing, Even when I did use iw I don't believe I ever have deleted an interface that way. Usually just replaced the entire configuration from scratch. So x86_64, Debian 11.6, test results... # ifconfig wlx00e032816834 # iw dev wlx00e032816834 del # ifconfig wlx00e032816834 Following the basic core steps for setup and configuration, i.e. install-driver.sh with DKMS for Debian, and options file defaults, plus US as region. Reboot after installation. I was able to delete the interface without error. If tried both with the interface just created, then created and explicitly associated via nmcli. Same result no error. So, might be specific to OpenWRT? Was there a different sequence of steps done? Tomorrow I will create another distribution and validate... something not Debian/Unbuntu based. Maybe x86_64 Manjaro? And will try OpenWRT generic x86_64 as well, just as a sanity test. |
I have the same issue on Debian 12, on Fedora 37. The exact steps are:
That's it. For the record: |
If you're going to debug the issue, you might need to add The other way is to use lockdep kernel subsystem. |
I was able to recreate the hang on Manjaro x86_64. So at least we know this might be a greater scope than just OpenWRT. It did not crash the entire instance, but definitely hung up the network stack. I could not reference the interface via terminal session or via network manager via the UI. Manjaro is a pretty new kernel, much newer that Debian 11.6. Don't think that is maternal per se, as yet, but was a significant difference I noticed. Wonder why Debian 11.6 did not hang but Debian 12 did? That might be an important clue. |
When I get to this issue, I think I will test 88x2bu to see what happens. That might expand the hunt enough to help. |
You might want to join the conversation at: It seems related. |
I am still working the related issue of interface renaming and I found that the messy log is related to Back to the original issue here I need more info. Can I get you to give me a step by step list of exactly what commands you are using? I need to duplicate this. A thought I had is that using iw ... del on a Realtek out-of-kernel driver would be very rare because they don't don't support adding another interface to the same adapter so why would del need to be used. Well, they support concurrent mode but that is a different animal. Let me back up a minute. Something I noticed when I started this site around 3 years ago is people would show up posting problems using a guide that was built for in-kernel drivers expecting the Realtek driver to be able to do the same thing the in-kernel driver can do. That is not the way it is and here is why: The in-kernel drivers such as the ar9271, rt5370, mt7610u, nt7612u and mt7921u are built using the mac80211 and stack capability per Linux Standards. Realtek and their out-of-kernel drivers are built to one degree or another on the old depreciated Wireless Extentions (WEXT) technology. I get asked on a regular basis why I don't submit the Realtek drivers here to the kernel maintainers to have it be in-kernel. Well, I can't because it would not be accepted because the Realtek drivers are based on old, depreciated technology. The submission would be denied. In fact, with WiFi 7, Realtek has no choice but to either drop Linux support or start doing the drivers in accordance with current standards as the old technology will no longer work with WiFi 7. Period. We maintain these driver to help Linux users but if you look around, I push users to seek out adapters that use in-kernel drivers because they will operate in accordance with the guides that are posted in many places. |
Step-by-step list of the actions to reproduce:
The command would hang indefinitely. |
To get the iw --help > iw.txt Then I compressed it and attached it. From the iw docs:
So, we need a virtual interface. Your wlan0 is not a virtual interface. How do I know this? Run:
Look for:
You won't find it. You will find:
None of the Realtek out-of-kernel drivers here or anywhere else support interface combinations. I was able to duplicate your result and I must say that hanging the terminal is not a good thing but this has probably not come up because anyone working on There is a reason that I put a statement in the docs encouraging Linux users to seek out adapters with in-kernel drivers. You have found one reason but there are many. If, for example you get a Alfa ACM: valid interface combinations: If you go to the USB-WiFi Main Menu: https://github.com/morrownr/USB-WiFi You can select menu item 4 and get a list of many adapters and the capabilities. You have to pick out an adapter with the virtual interface capabilities you want because different drivers/chipsets mean different capabilities. Sorry about not pointing this out right up front but I started to test and noticed the problem renaming an interface and I got focused on that... which is also a Realtek only problem. I'm going to show this issue as can't fix. |
iw dev wlan0 del
iw dev wlan0 del
Just FYI, rtw88 mainline kernel driver (and its backport https://github.com/lwfinger/rtw88) is currently in a state which allows for 8811cu dongles to work properly in both 2.4 and 5 GHz, client/ap/monitor/injection mode without any serious issues. |
I've been testing rtw88 8812bu support with kernel 6.3 lately. It is coming along nicely. I'll test 8811cu starting soon. My hope is that support for both of those chipsets is in very good shape within maybe a year from now so that I can look at discontinuing support for this driver and the 88x2bu out-of-kernel drivers. That would give me more time to try to keep the older drivers supporting the 8812au and 8811au chipsets in good shape. |
I got the same problem on OpenWrt, the following script will call |
Hi @bGN4 I do not support OpenWRT with this driver in this repo. I do use OpenWRT. What I recommend OpenWRT users do if they want to use a usb wifi adapter is they use the adapters based on chipsets that are well supported in OpenWRT. That includes: mt7921au The Main Menu for this site includes a Plug and Play list that includes many adapters based on those chipsets: |
@ValdikSS did you find any solution/workaround? found this: https://forums.developer.nvidia.com/t/fail-to-unload-the-nic-driver-for-realtek/255580/2 but probably unrelated |
I did not, didn't try to find it really.
Because this is a driver bug, not a hardware issue. rtw88 doesn't have this bug. It's better from many ways, I don't see any point in using this Realtek driver if we have rtw88. |
The driver in this repo and the rtw88 driver are totally different drivers. Realtek does not support USB very well at all. Even the USB support for rtw88 is provided by the community. Make sure you are using kernel 6.9 to pick 5 important patches that went in earlier this year. If you want to test and report on the downstream dev version of rtw88: That is right here in this repo. The first message gives the link to the downstream rtw88 that we are using to do work. Don't expect anything other than API maintenance on this out-of-kernel driver here in this repo and I plan to take it down later this year as long as the in-kernel rtw88 is in good shape. |
well, my device is a rtw8852cu (0x0bda, 0xc832), and the drivers at lwfinger/rtw8852 suffer from the same issue (apparently, same symptoms on Openwrt, I didn't debug the issue as mentioned by @ValdikSS in one of the posts above). |
You won't. If usb support is going to happen for the 8852cu or any other Realtek WiFi 6 chips, it will happen in rtw89. The is work ongoing to support the remaining unsupported chips in rtw88 but it may take a long time to get to rtw89. Tell me what you are trying to do and what hardward you have (like a RasPi4B for example) and I'll offer you some options. |
I've come across a rtw8832cu device, that I could've used in my openwrt x86 machine. |
Using any Realtek based adapter or card with OpenWRT is a challenge. This might change in the future but it is a frustrating thing for now.
The Realtek WiFi 6 usb wifi adapters driver are bad. Really bad. Maybe I have been too subtle with my advice for Linux users to avoid WiFi 6 usb wifi adapters with Realtek chips. I'll see about adding some warnings around the site. Not only is the driver support out-of-kernel, which not good, but it is really bad even for out-of-kernel drivers and that is not like to change anytime soon. Then there is the issue that all of the WiFi 6 Realtek based adapters that I have seen are multi-state. Linux users can do so much better than these adapters. You are aware of the site Main Menu? https://github.com/morrownr/USB-WiFi Reading menu items 1 and 2 is a really good idea. You have a choice to make. Get a good adapter that works well with OpenWRT now or wait a few years to see what Realtek does. |
Apparently netdev (un)registration changed since linux 5.12, so (un)register_netdevice should be replaced by cfg80211_(un)register_netdevice inside cfg80211 callcack. |
I can confirm this helps with the hang. |
the changes I found to help with the lock of rtnl, i.e. changing from here's one of the exception I have, when using the workaround (with some of my previous debugging prints starting with
to sum it up, in my view, merely replacing the functions is not the real solution to the hang, but a workaround that should be used after testing the effects it might have, in a case by case basis. as you very rightfully wrote in your usb-wifi repo, inherently, these realtek drivers suck. |
Deletion of the wireless interface results in endless hang of
iw
process which could not be killed even withkill -9
and makes the device unable to operate normally due to hangs on any operations related to the network interface enumeration.The kernel would also unable to reboot properly.
How to reproduce (do not do that on a production system):
iw dev wlan0 del
, wherewlan0
is the card's interface nameI suppose there's a lock which is not getting released somewhere.
The text was updated successfully, but these errors were encountered: