Here's a script that will get the wifi back up and running again without
a reboot:

```
#!/bin/sh

# If an interface name was not passed in then assume that wlo1 is the interface 
name.
if [ -z "$1" ]; then
    interface="wlo1"
else
    interface=$1
fi

# Figure out what pci slot Linux has assigned the Network controller: Intel 
Corporation Wireless 7260
wirelessPCI=$(lspci |grep "Wireless 7260")
pci=$(echo ${wirelessPCI} | awk '{ print $1 }')
devicePath="/sys/bus/pci/devices/0000:$pci/remove"

# Not the best solution as this script can hang. 
# But since if this script fails the ONLY way to revive the wifi anyway is a 
reboot...
# Feel free to improve the script if you have the scriptfu ninja skills to do 
so.
while true; do

    # Tell Linux to remove the wifi card from the PCI device list only if it 
exists in the first place.
    if [ -f $devicePath ]; then
        echo 1 | sudo tee $devicePath > /dev/null
        sleep 1
    fi

    # Reprobe the driver modules in case we have removed them in a failed 
attempt to wake the network card.
    sudo modprobe iwlmvm
    sudo modprobe iwlwifi
    
    # Try to have Linux bring the network card back online as a PCI device. 
    echo 1 | sudo tee /sys/bus/pci/rescan > /dev/null
    sleep 1

    # Check if Linux managed to bring the network card back online as a PCI 
device.
    if [ -f $devicePath ]; then

        # Looks like we are back in business. 
        # So we try to set the PCI slot with some voodoo I don't understand 
that the Intel devs told me to try.
        # https://bugzilla.kernel.org/show_bug.cgi?id=191601
        sudo setpci -s $pci 0x50.B=0x40

        # Bring the wireless network interface up.
        sudo ifconfig $interface up

        # Did the wifi interface actually go live?
        exitCode=$?
        if [ $exitCode -eq 0 ];then

            # Not sure why in the hell this is not the default for wireless 
intefaces.
            # It is well documented that: (power_management === ON) === 
Wifi-Stupidity
            sudo iwconfig $interface power off

            # The exit code will be the exit code of our attempt at turning 
power management off for $interface/wlan0.
            break
        fi
    else
        # It's worse than that the wifi's dead Jim! Dead Jim! Dead!
        # We tell Linux to remove the the wifi driver modules and loop back in 
an attempt to revive the wifi.
        sudo modprobe -r iwlmvm
        sudo modprobe -r iwlwifi
    fi
done

```

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1673344

Title:
  Ubuntu 16.04 doesn't recongnize wifi card after loosing signal
  completely (intel 7260) even when I try to restart network manager

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1673344/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to