0

I earlier asked a question Wifi isnt working after using wifite [duplicate]. This and this answer helped me. But, the problem is it works but, after few hours later when I start my laptop I get the same issue.

enter image description here

I faces the issue whenever I run codes on the picture. Then, reboot my laptop everything works fine. I am unable to fix the issue permanently. I didn't use wifite after facing the issue that moment

sudo airmon-ng check kill

Output : Killing these processes PID Name 1394 wpa_supplicant

sudo service NetworkManager restart
sudo ifconfig wlan0 up

Output : wlan0 : Error while getting interface flags : No such device

sudo iwconfig wlan0 down

Output : wlan0: ERROR while getting interface flags:No such device

sudo ifconfig wlan0 up

Output : wlan0 : ERROR while getting interface flags:No such device

sudo aireplay-ng wlan0

Output : Please specify an attack mode. "aireplay-ng --help" for help

I was trying to set wlan0 up. But, there was no wlan0 when I run ifconfig. When I restarted after running those commands. wlan0 was working correctly but, I have faced the multiple times. After running wifite few days ago. Even I have faced the issue again now... I think wifite status is keep running or something else is happening to it.

iwconfig

lo no wireless extensions.

eth0 no wireless extensions.

wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=15 dBm
Retry short limit:7 RTS thr:off Fragment thr:off Power Management:off

wwan0 no wireless extensions.

docker0 no wireless extensions.

ifconfig

docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 ether 02:42:7d:19:b4:b6 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether f0:de:f1:da:7d:80 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xf2500000-f2520000

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 28 bytes 1728 (1.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 28 bytes 1728 (1.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2
  • 2
    Please don't post images of text. Instead, copy/paste the text into your question and use the formatting tools to format it as code. Your images aren't even legible unless we open in a new tab. Also, please tell us what the "issue" is so that we don't need to go and read some other question to understand this one. – terdon Mar 25 at 16:48
  • @terdon Thanks for the information I have edited my question... :) – Istiak Mar 26 at 3:59
1

You've already tried killing wpa_supplicant and restarting NetworkManager, but if the entire interface is no longer visible in the outputs of commands iwconfig, ifconfig iw list and/or ip link show, then that won't help.

The problem could be that the WiFi adapter driver has some kind of miscommunication with the hardware. It might be a suspend/hibernate issue, if you use that functionality.

You might want to check the dmesg output to see if there are any error messages related to the WiFi interface. And when the interface is no longer visible to commands like iwconfig etc., then you might try unloading & reloading the driver module for your WiFi interface.

When the wlan0 interface is working correctly, sudo ethtool -i wlan0 | awk '/driver:/{print $2;}' should display the name of the driver module. Make a note of it.

When the wlan0 goes missing again, run sudo modprobe -r <driver module name>, replacing <driver module name> with the actual module name you noted earlier, to unload the module. Then sudo modprobe <driver module name> to re-load it. This will force the driver to re-initialize the WiFi adapter 100% from scratch, hopefully clearing any miscommunication-related error states.

If this causes the WiFi adapter to start working again, and the problem seems to happen whenever you suspend your laptop, then you might need to customize the suspend/resume process to automatically shut down the WiFi adapter and unload its driver on suspend, and reload it on resume. This is generally doable fairly easily on most distributions, but I don't know what would be the recommended method for it for Kali specifically.

Apparently Kali is based on Debian, so putting the following script into /lib/systemd/system-sleep/wifi-workaround.sh and making it executable (chmod a+rx /lib/systemd/system-sleep/wifi-workaround.sh) might do the trick:

#!/bin/sh
# When suspending/resuming, systemd will call executables in /lib/systemd/system-sleep 
# with the following parameters:
# $1 = either "pre" or "post"
# $2 = "suspend", "hibernate", "hybrid-sleep" or "suspend-then-hibernate"
INTERFACE=wlan0
DRIVER_MODULE=<driver module name>    

case "$1" in
    pre)
        nmcli device disconnect $INTERFACE
        modprobe -r $DRIVER_MODULE
        ;;
    post)
        modprobe $DRIVER_MODULE
        nmcli device connect $INTERFACE
        ;;
esac

# Don't stop suspending/resuming even if we fail somehow.
exit 0

Disclaimer: I have not tested this at all, you might need to troubleshoot & adjust this yourself. But I hope you get the idea.

6
  • Maybe, it's been twice months I was looking for answer.. Finally, I got a beautiful answer. Thanks(Oh Sorry to use the Thanks word cause, there's a hovering message when we can avoid comments like "+1" or "thanks".) – Istiak Mar 26 at 14:53
  • As you said, It might be a suspend/hibernate issue. But, sometimes I have to use suspend, So, How can I deal with it? – Istiak Mar 26 at 15:21
  • As you said, It might be a suspend/hibernate issue. But, sometimes I have to use suspend, So, How can I deal with it? – Istiak Mar 26 at 15:21
  • 1
    Please see my edit. – telcoM Mar 26 at 22:50
  • In the directory (/lib/systemd/system-sleep/) there's no file called wifi-workaround.sh. Should I create it? I have sysstat.sleep, unattended-upgrades, hdparm.. – Istiak Mar 27 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.