Wireless networking not working after resume in Ubuntu 14.04

90,966

Solution 1

The above answers did not work for me on 14.10. After a bit of trial-and-error, I ended up with this,

#!/bin/sh

case "${1}" in
  resume|thaw)
    nmcli r wifi off && nmcli r wifi on ;;
esac

Put this in /etc/pm/sleep.d/10_resume_wifi
Make it executable sudo chmod 755 /etc/pm/sleep.d/10_resume_wifi and the problem should be fixed immediately.

Solution 2

I got a solution but it is just for restarting your network manager.

sudo service network-manager restart

It is not the permanent solution.

Solution 3

The script that finally worked for me:

$ cat /etc/pm/sleep.d/10_resume_wifi 
#!/bin/sh

case "${1}" in
  resume|thaw) nmcli nm sleep false ;;
esac

$ ll /etc/pm/sleep.d/10_resume_wifi
-rwxr-xr-x 1 root root 70 mars  31 09:09 /etc/pm/sleep.d/10_resume_wifi

The other answer has typos (they can be fixed I know), but never worked for me anyway.

Share:
90,966

Related videos on Youtube

Ossama Nasser
Author by

Ossama Nasser

Updated on September 18, 2022

Comments

  • Ossama Nasser
    Ossama Nasser over 1 year

    [Update]:
    The same problem exists in Kubuntu and is solved in the same manner.
    [Solved]:
    By applying the following command nmcli nm I got the following:

    Before suspend

    RUNNING         STATE           WIFI-HARDWARE   WIFI       WWAN-HARDWARE   WWAN      
    running         connected       enabled         enabled    enabled         enabled  
    

    as can you see the state is connected and the rest are enabled and running

    After suspend

    RUNNING         STATE           WIFI-HARDWARE   WIFI       WWAN-HARDWARE   WWAN      
    running         asleep          enabled         enabled    enabled         disabled
    

    as can you see the state is asleep meaning our dear network manager is still napping, so to solve use the fallowing command line:
    sudo nmcli nm sleep false
    this tells the network manager to wake the hell up. to make this permenant :
    create a script in /etc/pm/sleep.d containg the following (and don't forget to mark the script as executable):

    #!/bin/sh
    
    case "${1}" in
            resume|thaw)
            nmcli nm sleep false
                    ;;
    esac
    

    Thanks to this

    The original problem:

    I just downloaded Ubuntu 14.04 and installed on my laptop: ASUS X61SL with Intel P8400 Core2Duo x64 processor.
    When I close the lid, the system is suspended, but when I open the lid again and resume, the wireless networking is not activited (networking as a whole is disabled), and when I select "Enable Networking" nothing happens.
    This is the information about my wireless adapter:

    $ lspci | grep -i wireless
    02:00.0 Network controller: Qualcomm Atheros AR928X Wireless Network Adapter (PCI-Express) (rev 01)  
    

    This problem wasn't present in Ubuntu 13.04, Linux Mint Debian Edition or Debian 7 wheezy (GNOME or KDE).

    Edit: few test with the following results :
    The problem effects my wireless and wired networking.
    Note: I need to add the pci=nomsi line to grub in order to boot.
    When logging out manually then suspend then resume then log in every thing works just fine.
    When suspending directly while logged in the problem happens.
    Locking and suspending causes the same problem as suspending directly.
    Also this problem appearnlty affects log out function: if you chose log out from the user menu in unity panel then you wan't log out, but if you use the command line gnome-session-quit --logout then you can log out.
    Now with lshw -C network output:
    Normal (fully functional networking):

      *-network               
           description: Ethernet interface
           product: 191 Gigabit Ethernet Adapter
           vendor: Silicon Integrated Systems [SiS]
           physical id: 4
           bus info: pci@0000:00:04.0
           logical name: eth0
           version: 02
           serial: 00:24:8c:1e:f8:53
           size: 10Mbit/s
           capacity: 100Mbit/s
           width: 32 bits
           clock: 33MHz
           capabilities: pm bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=sis190 driverversion=1.4 duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
           resources: irq:19 memory:fddfcc00-fddfcc7f ioport:cc00(size=128)
      *-network
           description: Wireless interface
           product: AR928X Wireless Network Adapter (PCI-Express)
           vendor: Qualcomm Atheros
           physical id: 0
           bus info: pci@0000:02:00.0
           logical name: wlan0
           version: 01
           serial: 00:15:af:e2:13:db
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
           configuration: broadcast=yes driver=ath9k driverversion=3.13.0-24-generic firmware=N/A ip=6.6.6.8 latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn
           resources: irq:16 memory:fdff0000-fdffffff
    

    After resume ("/etc/pm/config.d" does not contains "unload_modules"):

     *-network DISABLED      
           description: Ethernet interface
           product: 191 Gigabit Ethernet Adapter
           vendor: Silicon Integrated Systems [SiS]
           physical id: 4
           bus info: pci@0000:00:04.0
           logical name: eth0
           version: 02
           serial: 00:24:8c:1e:f8:53
           size: 10Mbit/s
           capacity: 100Mbit/s
           width: 32 bits
           clock: 33MHz
           capabilities: pm bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=sis190 driverversion=1.4 duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
           resources: irq:19 memory:fddfcc00-fddfcc7f ioport:cc00(size=128)
      *-network DISABLED
           description: Wireless interface
           product: AR928X Wireless Network Adapter (PCI-Express)
           vendor: Qualcomm Atheros
           physical id: 0
           bus info: pci@0000:02:00.0
           logical name: wlan0
           version: 01
           serial: 00:15:af:e2:13:db
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
           configuration: broadcast=yes driver=ath9k driverversion=3.13.0-24-generic firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11bgn
           resources: irq:16 memory:fdff0000-fdffffff
    

    When I added the file unload_modules to directory "/etc/pm/config.d" as suggested by here, after logging out, suspend ,resume then log in the networking works but I cannot connect to my wireless network.
    Again the result of lshw -C network After resume ( "/etc/pm/config.d" contains "unload_modules"):

     *-network DISABLED      
           description: Ethernet interface
           product: 191 Gigabit Ethernet Adapter
           vendor: Silicon Integrated Systems [SiS]
           physical id: 4
           bus info: pci@0000:00:04.0
           logical name: eth0
           version: 02
           serial: 00:24:8c:1e:f8:53
           size: 10Mbit/s
           capacity: 100Mbit/s
           width: 32 bits
           clock: 33MHz
           capabilities: pm bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=sis190 driverversion=1.4 duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
           resources: irq:19 memory:fddfcc00-fddfcc7f ioport:cc00(size=128)
      *-network DISABLED
           description: Wireless interface
           product: AR928X Wireless Network Adapter (PCI-Express)
           vendor: Qualcomm Atheros
           physical id: 0
           bus info: pci@0000:02:00.0
           logical name: wlan0
           version: 01
           serial: 00:15:af:e2:13:db
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
           configuration: broadcast=yes driver=ath9k driverversion=3.13.0-24-generic firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11bgn
           resources: irq:16 memory:fdff0000-fdffffff
    

    The contents of 'unload_modules" where:

    SUSPEND_MODULES="$SUSPEND_MODULES ath9k"
    SUSPEND_MODULES="$SUSPEND_MODULES sis190"
    

    Where 'ath9k' is my wireless module and 'sis190' is my Ethernet module.

    • Luigi Tiburzi
      Luigi Tiburzi about 10 years
      I have disconnected instead of asleep in my status, how can I solve the problem with that? Thx
    • bain
      bain over 9 years
    • Duncan Jones
      Duncan Jones over 9 years
      If you solve your own problem, you should post an answer, not include the answer in your question.
    • Ossama Nasser
      Ossama Nasser over 9 years
      @Duncan sorry about that :)
    • Augustin Riedinger
      Augustin Riedinger over 9 years
      Still no official fix to this issue? As per reading the bug report no. But this is highly surprising as it seems to affect quite many people ...
    • Ossama Nasser
      Ossama Nasser over 9 years
      On my old laptop Asus X61SL, the problem was present. On my new laptop Dell Inspiron 15R the problem is NOT present. Apparently it has to do with the hardware.
    • Rápli András
      Rápli András over 9 years
      I have to also connect to the proxy manually every time. duh. Restarting the router (if possible) helps by the way.
    • Alireza
      Alireza almost 9 years
      The command nmcli nm complains: Object 'nm' is unknown
    • umpirsky
      umpirsky almost 8 years
      Same here, Object 'nm' is unknown. @Alireza did you find solution?
    • rsht
      rsht almost 8 years
      @umpirsky try nmcli general status
    • rsht
      rsht almost 8 years
      @umpirsky yeah, I have similar results. I think this means that your wifi's dysfunction reason is different from the one OP had and the solution above won't help. In my case, restarting network manager (sudo service network-manager restart ) have helped, so I would recommend you to try that. Let me know if that works for you.
    • umpirsky
      umpirsky almost 8 years
      Yes, that one helps, I find it in answers below. Thanks.
    • matanster
      matanster over 7 years
      I get this problem from time to time, but I don't have a connection to solve it when it happens so I reboot. Network should be so basic, I hope this is automated/solved in later versions of Ubuntu, as it really sucks.
    • Kwaadpepper
      Kwaadpepper over 7 years
      Works for me on Kubuntu 16.04.1
  • Mahmoud Al-Qudsi
    Mahmoud Al-Qudsi about 9 years
    I think the syntax has recently changed, I isssued nmcli nm sleep false followed by nm wifi on to get it running. +1 for the tip!
  • Augustin Riedinger
    Augustin Riedinger about 9 years
    The command sudo nmcli nm sleep false does work for me, so I'm not stuck. But the /etc/network/network.d script doesn't auto-resume. If I try to execute it, I get Syntax error: newline unexpected (expecting ")"). Could you be more specific on the 1. Why it doesn't work? 2. What is supposed to do the script (so we can fix it individually)? 3. Why network.d? Thanks!
  • terdon
    terdon over 8 years
    What is this supposed to do? What is ![$]? Why ./bin/sh? You're in /etc/network, there will be no ./bin/sh there. What's a jsin7 file? Case statements end with esac, not easc. They also need a variable and a condition.
  • Petr Gladkikh
    Petr Gladkikh about 8 years
    Why not "off" before going to sleep?
  • Anton Matosov
    Anton Matosov about 8 years
    This solution is the only one that worked for me on 15.10 with Intel Wireless 7260
  • hmjha
    hmjha about 8 years
    This solution is also worked on 14.04 LTS and 14.10
  • tokam
    tokam almost 8 years
    Can I somehow test this without making it permanent? What do the commands do?
  • FizxMike
    FizxMike almost 8 years
    Tokam, see my comment above on Owais' post about "nmcli nm wifi on" working in the script first. Basically, by placing a script in the sleep.d directory, it will be executed at resume time and get passed 'resume' or 'thaw'. The script checks for either arguments being passed to the script and executes the nmcli command (Network Manager Command Line Interface). The specific command I mentioned is equivalent to clicking on network manager in the status bar and checking "Enable WiFi". For verification, enter "nmcli nm help" in terminal. Also, you need to make sure the script it's executable.
  • FizxMike
    FizxMike almost 8 years
    What is the 'r' for? I get "Error: Object 'r' is unknown." This seems to work for me: "nmcli nm wifi on;" (ubuntu 14.04 - dell precision laptop)
  • hmjha
    hmjha almost 8 years
    @umpirsky yes we can do from that method also. Thanks
  • MDMower
    MDMower over 7 years
    @FizxMike The r specifies object 'radio' in my version of nmcli (Ubuntu 16.04). When I type nmcli r --help, I see the available targets of a command are COMMAND := { all | wifi | wwan } and the available commands are [ on | off]. I surmise that previous to Ubuntu 14.10, it was not possible to target individual objects that are controlled by NetworkManager.
  • Eric
    Eric over 7 years
    This works for me on mint mate 18, which is based on ubuntu 16.04.1.
  • Matěj Kříž
    Matěj Kříž over 7 years
    Much cleaner working solution is '''sudo service network-manager restart'''
  • Marc Rochkind
    Marc Rochkind over 7 years
    Worked for me on Ubuntu 16.10. However, apparently /etc/pm/sleep.d is no longer used. I put it instead in /lib/systemd/system-sleep, as: #!/bin/sh case $1 in post) service network-manager restart ;; esac