2

Sometimes my wireless loses connection and will not reconnect. However, I find it will reconnect when I open terminal and run

sudo modprobe -r nameOfDriver
sudo modprobe nameOfDriver

However, going to Network Manager and un-checking enable wireless and enable wireless does not fix the problem.

Is there any way to have network manager remove the driver via modprobe? What exactly is disabling in network manager (or with the hardware/keyboard switch) do?

ish
  • 139,926

2 Answers2

1
  • Disabling a wireless connection in Network Manager deactivates the wireless interface (similar to ifdown or ifconfig down), and then soft-blocks (turns off) the hardware device. It does not unload the wireless driver (kernel module).
  • The hardware/keyboard wireless switch will also soft-block (or hard-block, i.e. cut power) the internal wireless card.
  • You can customize -- to a limited degree -- what happens when Network Manager enables/disables an interface by editing scripts in /etc/NetworkManager/dispatcher.d; see man NetworkManager for more info.
    • BUT this cannot be used to load/unload the driver via modprobe, because once Network Manager unloads the driver, the interface ceases to exist and it won't be able to bring it back up! (notice when you modprobe -r that the Wireless options completely disappear from the drop-down menu)

So, the best option is to setup a custom keyboard shortcut to a script which unloads/loads the driver; you can add that script to the sudoers file such that no sudo is needed for it. See this question for details.

ish
  • 139,926
-1

modprobe -r is removing the driver but only for the session. To do so permanently, you would need to blacklist it, but I don't remember how sorry. the wireless button/switch is meant to turn off your wifi by disabling the driver btw.

Boi
  • 337
  • The wireless switch blocks the hardware device, it has nothing to with the kernel module. – ish Aug 22 '12 at 01:31
  • In fact it does, since the blocking is handled by the kernel module of the corresponding wireless adapter. –  Aug 22 '12 at 01:38
  • @Cumulus007 does it "disable the driver btw"? – ish Aug 22 '12 at 01:41
  • It doesn't, but your statement the wireless switch has nothing to do with the kernel module is simply not true. –  Aug 22 '12 at 01:42
  • @Cumulus007: so you are telling me that the hardware button/switch on the laptop to turn wireless on/off, which presumably works on any OS depends on the Linux kernel module? – ish Aug 22 '12 at 04:35