Could not remove WiFi adapter kernel module; Linux hangs

1

1

I am using openSUSE Leap 15.0 (64-bit, kernel version 4.12.14-lp150.12.25-default) with KDE Plasma Desktop (version 5.12.6), all updates applied after installation. I am using a TP-Link T2U wireless adapter, which supposedly has the mt7650 chipset.

For the wireless adapter, I have installed this driver. The one from TP-Link's site doesn't compile (has code errors); other community drivers are apparently built for the mt7610 chipset, hence, the computer completely hangs as soon as the adapter is plugged in.

Anyways, I have compiled and installed the aforementioned driver and can successfully use the wireless adapter and connect to access points and surf the Internet.

This is how I use it:-

1) I plug in the adapter and run, in order:

sudo ip link set ra0 up
sudo systemctl restart NetworkManager.service

(The adapter is recognised as ra0; the system tray tool can't be used unless NetworkManager is restarted)

2) I click and open the NetworkManager tool in the system tray and connect to the hotspot of my choice.

Now, I can normally surf the Internet. So far, so good!

After I'm done, I disconnect from the hotspot (from the NetworkManager tool in the system tray) and then run:

sudo ip link set ra0 down

The real fun begins here: when I shut down the computer after this, either with the adapter still plugged in or taken out, the computer hangs at the splash screen! I mean, it would be like that forever. If I press Esc, to reveal the text messages behind, it would show:

...
...
...
[FAILED] Failed unmounting /var
...
...
...
Reached target Shutdown

The only way is to hold down the power button to shut it down.

If, after disconnecting from the hotspot (from the NetworkManager tool in the system tray) and after setting ra0 down, instead of shutting down, I run:

sudo modprobe -r mt7650u_sta

or

sudo modprobe -rf mt7650u_sta

or

rmmod mt7650u_sta

or

rmmod -f mt7650u_sta

the console window hangs, i.e., I don't get back the prompt. The rest of the system doesn't hang, though. (The kernel module for this driver is mt7650u_sta).

Interestingly, after a fresh boot, if I simply plug in the device but don't set it up, I can easily remove the kernel module mt7650u_sta and/or the computer shuts down normally. If I never plug in the adapter, the computer shuts down fine, too.

Basically, it is getting stuck at removing the mt7650u_sta module only if the adapter has been set up (whether after that I connect to any hotspot or not).

How to prevent this from happening and successfully remove the mt7650u_sta module even if the adapter has been "used"? Please note that I am only a novice Linux user. I can't modify any source code by myself, etc.. I would highly appreciate if you give your answers and suggestions in a simple way, so to speak! :-)



Some extra information:-

After the adapter is plugged in but not set up, ip a gives

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 00:22:4d:9f:89:65 brd ff:ff:ff:ff:ff:ff
3: ra0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

and lsmod | grep mt gives

mt7650u_sta          1024000  0
usbcore               286720  6 usbhid,ehci_hcd,xhci_pci,mt7650u_sta,xhci_hcd,ehci_pci

After the adapter is set up and then connected to a hotspot, ip a gives

...
...
...
3: ra0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 50:3e:aa:89:00:e0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.225.23/24 brd 192.168.225.255 scope global noprefixroute dynamic ra0
       valid_lft 43191sec preferred_lft 43191sec
    inet6 2405:204:42a4:8696:b83c:6cc9:98a4:17ea/64 scope global temporary dynamic 
       valid_lft 604788sec preferred_lft 85878sec
    inet6 2405:204:42a4:8696:f7c8:b248:7d11:fdc7/64 scope global mngtmpaddr noprefixroute 
       valid_lft forever preferred_lft forever
    inet6 fe80::db2c:9df4:4de5:1031/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

and lsmod | grep mt gives

mt7650u_sta          1024000  1
usbcore               286720  6 usbhid,ehci_hcd,xhci_pci,mt7650u_sta,xhci_hcd,ehci_pci

Later, after the adapter is set down, ip a gives

...
...
...
3: ra0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 50:3e:aa:89:00:e0 brd ff:ff:ff:ff:ff:ff

and lsmod | grep mt gives

mt7650u_sta          1024000  0
usbcore               286720  6 usbhid,ehci_hcd,xhci_pci,mt7650u_sta,xhci_hcd,ehci_pci

a_das

Posted 2018-12-15T13:47:10.933

Reputation: 11

No answers