The issue I'm having is that whenever I just remove my USB wifi card, it kernel panics and reboots the system. Is there some way to detect and kill any processes using the wifi card automatically to make some sort of shell script?
Asked
Active
Viewed 2,687 times
2
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
Nathan
- 21
- 1
- 2
-
Can you unmount it before removal without problems? http://unix.stackexchange.com/questions/45820/how-to-umount-a-usb-drive – iyrin Nov 03 '14 at 15:01
-
If you're running on Linux `netstat -tuapn | grep
` should tell you what processes/PIDs are using the IP address. – Bratchley Nov 03 '14 at 15:37 -
2But like Gareth says, an _application_ using the WiFi stick shouldn't cause the _kernel_ to panic. The root cause is probably at the kernel level. – Bratchley Nov 03 '14 at 15:41
-
There is no notion of “process using a network interface” (apart from some very low-level network diagnostics programs). There is a layer of isolation between processes and network interfaces; processes talk TCP (mostly) and all information about routing TCP packets through network interfaces keeps inside the kernel. – Gilles 'SO- stop being evil' Nov 03 '14 at 23:06
-
@Gilles `service ifplugd status` may respond something like `wlan0: ifplugd process for device wlan0 running as pid 1234` (and one can kill it with `sudo ifplugd -k -i wlan0`). I guess what you say implies that there is no _generic_ way to detect _all_ processes like ifplugd? – RolfBly Jun 11 '17 at 20:06
1 Answers
3
I suspect that the issue is with your driver rather than any process using it.
You'll need to make sure that nothing is using it and then remove it with modprobe -r. Try bringing down the network interface first. For example:
# ip link set wlan0 down
# modprobe -r <module>
You can find out the module name using lsusb.
garethTheRed
- 33,289
- 4
- 92
- 101