While my Lubuntu 18.04 is connected to a wifi network via an external wifi adapter, I hot unplug the external wifi adapter.
Symptoms of the problem:
- When I plug the external wifi adapter back to my computer, no wifi network is detected, even though both networking and wifi are enbaled.
-
The top process shown in the output of
top
is:PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1068 root 20 0 1029552 8060 4864 R 85.7 0.1 29:25.70 NetworkManager
Trying to kill it by
sudo kill 1068
orsudo service NetworkManager restart/stop
orsudo systemctl restart/stop NetworkManager
will result in hanging foreverTrying to run any
sudo
command e.g.sudo pm-suspend
will result in the same forever
hanging -
The usb port on my laptop where the external wifi adapter was
originally plugged in has also stop working for other external
devices, unless I reboot my Lubuntu.
How can I solve the problem? Preferably not rebooting my Lubuntu.
How can I avoid the problem in the future?
Thanks.
Log:
This is part of /var/log/syslog
around the time when the problem happened. (I unplugged a keyword to free up a usb port for a flash drive, and then unplugged the external wifi adapter, to free up a usb port for a printer, and then plugged it back. )
This is from journalctl --since "2 days ago"
.
USB subsystems:
I also followed https://www.linux.org/threads/resetting-the-usb-subsystem.10404/ suggested by Network manager goes bad after hot unplugging an external usb wifi adapter
$ lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 048: ID 413c:2113 Dell Computer Corp.
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 009: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
$ lspci | grep USB
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03)
00:1a.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
But because sudo
commands seem not working, the following sudo
command doesn't work (also see https://askubuntu.com/questions/1153207/lsusb-i-get-always-couldnt-open-device-is-this-normal):
$ lsusb -v -s 1:9 | grep iSerial
Couldn't open device, some information will be missing
iSerial 3
$ sudo lsusb -v -s 1:9 | grep iSerial
$ lsusb -v -s 1:9
Couldn't open device, some information will be missing
Bus 001 Device 009: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x7392 Edimax Technology Co., Ltd
idProduct 0x7811 EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
bcdDevice 2.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 46
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 4
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Best Answer
As Vasconcelos writes above, "sudo service NetworkManager restart" (or the similar "sudo systemctl restart NetworkManager") is the way to fix your immediate problem.
The reason using "kill" to stop NetworkManager is a bad idea is that NM is the process that manages the network. It is not going to gracefully terminate until every process that uses the network also terminate -- which include some processes inside the kernel. (Well, "kill -9" might stop NM, but that will leave a nasty mess. Sorta like stopping your car at a stop light by ripping out all of the spark plug wires.)
You have two solutions here:
Find the network interface with "ip a", bring it down with "sudo link set $NAME_OF_PORT down", then remove it. That way NM is not blocking the USB port, & you ought to be able to plug another USB device into it.
Stop NM with "sudo service NetworkManager stop" (or "sudo systemctl stop NetworkManager"), remove the wireless WiFi adapter, then restart NetworkManager. A little more drastic, but it ought to work.
If neither works, query the manufacturer. They ought to know how a user can gracefully remove their product from a Linux system, especially if it requires some non-standard steps. (Their website might even have the answer, so you don't have to go thru call center Hell to find someone who knows where to find the answer.)
ADDENDUM: When I mentioned "journalctl", I meant that will be the tool you will need to use to further investigate this problem. Looking at the snippet you attached, I see all sorts of possibilities -- but none I'm certain is the problem.
I'll suggest you try the following steps:
First, powercycle the system so it is back in a known stable state. Then use sudo to execute a command, say
sudo nmcli con show
If the command completes & does not hang, continue on. If not, then there is something going on with this computer I can't diagnose from here. (You might have to reinstall the OS; it will be the simplest solution.)Next, execute
sudo nmcli radio all
This ought to confirm you have WiFi working.At this point, whenever you remove that USB wireless device, execute
sudo nmcli radio wifi off
first, then remove the device. This will tell NetworkManager to stop looking for it -- which appears to be the cause of your problem. Then, after you reconnect the device, executesudo nmcli radio wifi on
, which will tell NetworkManager to start looking for it.Here I have to stop. If this still doesn't help you with your problem, I'm out of ideas. I'll admit I'm still learning how to work with Network Manager; I've been able to avoid using it until now, but now have been forced to learn it.