The officially official Devuan Forum!

You are not logged in.

#1 2022-01-09 09:01:04

yolobro
Member
Registered: 2019-03-09
Posts: 7  

[SOLVED] Reloading wifi interface and kernel module without reboot

For my wifi I need a special kernel driver which is installed via dkms. It' working fine, however sometimes after a suspend, the driver crashes as evident in dmesg. lsmod still shows it though and the wifi interface is still up, but not working anymore.

I want to get wifi back without a reboot.

I have tried to simply rmmod and modprobe the module. It does that but that does not bring the wifi interface back. I have restarted networking (/etc/init.d/networking restart) which also would not help getting the interface back up.

I have also tried this without success:

echo '1' | tee /sys/bus/pci/devices/0000:$PCI/remove > /dev/null
sleep 2
echo '3' | tee /sys/bus/pci/rescan > /dev/null

What did work, but seems like an overkill, is to dkms remove and dkms install the module again.
Any idea what dkms could be doing here that I'm missing?

Thanks a lot for any hints!

Offline

#2 2022-01-09 11:39:23

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: [SOLVED] Reloading wifi interface and kernel module without reboot

Try restarting any network manager that you're running. (wicd, network-manager, connman or other.)

Or log out of desktop and log in again.

Or cycle through runlevel 1. As root:

init 1

and then ctrl-d to get back to runlevel 2.

Offline

#3 2022-01-09 11:55:25

yolobro
Member
Registered: 2019-03-09
Posts: 7  

Re: [SOLVED] Reloading wifi interface and kernel module without reboot

Thanks. I do not use any network manager. Just wpa_supplicant.
My init 1 just has these:

K01acpi-support  K01alsa-utils  K01hddtemp  K03rsyslog  S01killprocs  S02single  S05bootlogs

I dont think they can help.

Last edited by yolobro (2022-01-09 12:00:16)

Offline

#4 2022-01-09 14:19:59

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] Reloading wifi interface and kernel module without reboot

Report the driver crash to whoever wrote the module. Maybe they will be able to fix the problem.


Brianna Ghey — Rest In Power

Offline

#5 2022-01-09 17:29:57

PedroReina
Member
From: Madrid, Spain
Registered: 2019-01-13
Posts: 269  
Website

Re: [SOLVED] Reloading wifi interface and kernel module without reboot

yolobro wrote:

after a suspend, the driver crashes as evident in dmesg

Could be relevant to see the message you get?

Offline

#6 2022-01-09 21:19:39

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 221  

Re: [SOLVED] Reloading wifi interface and kernel module without reboot

You report that your problem is intermittent, which if true makes it hard to solve.

For myself I use the pm-utils package to suspend or hibernate and resume.

My wifi card uses the ath9k kernel module, however I found that it wasn't powering down when I suspended so I configured pm-utils to unload and reload the relevant module(s). This solved my problem.

One issues was that for my wifi card there are actually several interdependent modules, not just the primary one, and I needed to load/unload all of them. In my case these were ath9k ath9k_common ath9k_hw ath.

The instruction I had to use to specify which modules to load/unload were in the file /etc/pm/config.d/defaults, the relevant lines being:

# If you need to unload any modules to suspend/resume, add them here.
SUSPEND_MODULES="ath9k ath9k_common ath9k_hw ath"

you can check what is actually happening by viewing the log file /var/log/pm-suspend.log, where, on my system I find:

[on suspend]

Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend:
Unloading kernel module ath9k...Done.
Unloading kernel module ath9k_common...Done.
Unloading kernel module ath9k_hw...Done.
Unloading kernel module ath...Done.
/usr/lib/pm-utils/sleep.d/75modules suspend suspend: success.

[on resume]

Running hook /usr/lib/pm-utils/sleep.d/75modules resume suspend:
Reloaded unloaded modules.
/usr/lib/pm-utils/sleep.d/75modules resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant resume suspend:
Failed to connect to non-global ctrl_ifname: (nil)  error: No such file or directory
/usr/lib/pm-utils/sleep.d/60_wpa_supplicant resume suspend: success.

The log also captures module interdependencies, and this is where you can find if you've loaded/unload all the relevant modules. in my case it shows (in additions to all the other modules/dependencies:

Linux grendel 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux
Module                  Size  Used by
ath9k                 139264  0
ath9k_common           20480  1 ath9k
ath9k_hw              483328  2 ath9k_common,ath9k
ath                    36864  3 ath9k_common,ath9k,ath9k_hw

Which is where I got my list of related wifi card modules from.

For me suspend/hibernate and resume works and the networking restarts.

Last edited by Marjorie (2022-01-09 21:22:22)

Offline

#7 2022-01-10 08:15:14

yolobro
Member
Registered: 2019-03-09
Posts: 7  

Re: [SOLVED] Reloading wifi interface and kernel module without reboot

Marjorie wrote:

The instruction I had to use to specify which modules to load/unload were in the file /etc/pm/config.d/defaults, the relevant lines being:

# If you need to unload any modules to suspend/resume, add them here.
SUSPEND_MODULES="ath9k ath9k_common ath9k_hw ath"

Perfect, thank you very much.
I also use pm-utils, so I now have it unload the module. I verified it did that in the log. Coming back up, wifi works.
So I think this should effectively circumvent the crashing.

Offline

Board footer