1

When resumed from a hibernation, the wi-fi's lost.

Can neither turn on wi-fi from appindicator nor >setting >Network.

Switch on/ off via hot key (Fn+F2) is useless too.

I have to suspend, then resume from suspend then wi-fi work again.

My platform: Ubuntu 14.04 LTS.

How to solve for wi-fi still naturally works (no intervention) after a resume from hibernation.

Following JWilliamson's instruction, after

sudo gedit /etc/pm/power.d/wireless

, the wireless" file's not a blank, it shows:

#!/bin/sh
# tlp - if tlp is enabled, override corresponding script
#       in /usr/lib*/pm-utils/power.d/

CONFFILE=/etc/default/tlp LIBDIRS='/usr/lib /usr/lib64'

for d in ${LIBDIRS}; do
    if [ -d "${d}/pm-utils/power.d" ]; then
        blocked="${d}/pm-utils/power.d/${0##*/}"
        break
    fi done

if [ -n "$blocked" ] && [ -x "$blocked" ]; then
    # else nothing to disable -> don't read $CONFFILE

    if [ -e "$CONFFILE" ] && . "$CONFFILE" -- && [ "$TLP_ENABLE" = '1' ]; then
        # TLP is enabled -> disable $blocked
        echo "Notice: '${blocked}' disabled by TLP."
    else
        exec "$blocked" $*
    fi fi

exit 0
4

Open terminal and input the following command; we need to see if Power Management is enabled on that card.

iwconfig wlan0

By running this code, we should see an output of something like this:

jayadmin@jayadmin-OptiPlex-GX280:~$ iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"MU WiFi"  
      Mode:Managed  Frequency:2.412 GHz  Access Point: 18:33:9D:C6:76:72   
      Bit Rate=65 Mb/s   Tx-Power=20 dBm   
      Retry  long limit:7   RTS thr:off   Fragment thr:off
      Power Management:off
      Link Quality=40/70  Signal level=-70 dBm  
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:18  Invalid misc:80   Missed beacon:0

If Power Management is ON, then run the following command (you'll need SU rights for this, thus the "sudo" command):

sudo iwconfig wlan0 power off

You'll have to type in your password after this command; without "sudo" you probably won't have user permission to run it.

To make this permanent, you'll have to add/create a system file that will keep Ubuntu from using PM after a restart. To do this, open terminal (if you have already closed it down) and type in the following command:

sudo gedit /etc/pm/power.d/wireless

This will open a text editor with a blank file. Insert the following lines into the file:

#!/bin/sh


/sbin/iwconfig wlan0 power off

Now, save the file and close gedit and your terminal window. PM should be disabled even after restart.

It sounds like there is an issue with Ubuntu and your particular card in regards to power management when you come back from hibernation. I had this same problem on my laptop and disabled PM and it took care of the problem.

I know this isn't the “nature work” non-command line intervention you were looking for, but it should take care of your problem. Sometimes you have to use terminal to fix odd problems.

Additional information

@evergreen

The TLP mentioned in your wireless file is an advanced power management utility in Ubuntu. It COULD be the issue of your wireless card not functioning correctly; your wifi card may not be fully compatible.

Run this code in terminal (this should be a perm fix, if it works):

sudo gedit /etc/default/tlp

In that file, search for these two lines. They should be together:

WIFI_PWR_ON_AC=5
WIFI_PWR_ON_BAT=5

If I remember all this correctly, mind you. 1 is disabled, while 5 is enabled. Change the 5 in both lines to 1 then save the file and exit out of terminal.

To be safe, reboot the computer to ensure the changes take effect on your system. If those two lines aren't replaced, anything else you do to change the wifi PM settings will be blocked by the TLP script.

I hope this helps. I'm not at my Ubuntu box for the rest of the night, so if this doesn't help then my next attempt to help figure this out will be delayed several hours. You could always completely replace the text found in the /etc/pm/power.d/wireless with the text from my first answer, but it will not work unless this setting in the tlp file is changed.

  • In my case, after "sudo gedit /etc/pm/power.d/wireless", the "wireless" not a blank, it shows as the supplement I've just added in my above question. Should I add anything in, and where? – evergreen Dec 5 '14 at 22:30
  • @evergreen Please refer to the additional information I placed in my answer. – JWilliamson Dec 6 '14 at 0:45
  • @ JWilliamson: excellent. – evergreen Dec 6 '14 at 11:58
3

I've been having the same issue and I finally found a complete solution, so here it is:

  1. Go to a terminal by pressing Ctrl+Alt+T

  2. Open a new .txt file to write the new command in. (you can change the file name but it has to still start with 99- because the system works alphabetically and we need this to be the last one:

    sudo nano /etc/pm/sleep.d/99_synclient` 
    
  3. Paste the following line into the empty .txt file:

    #!/bin/bash
    
    case "$1" in
      suspend|hibernate)
      ;;
    
      resume|thaw)
        sudo -u <USERNAME> env DISPLAY=:0 service network-manager restart 
      ;;
      *) 
        exit $NA
      ;;  
    esac
    

    Please replace above with your user name, without the <>

  4. Make the file executable:

    sudo chmod +x /etc/pm/sleep.d/99_synclient
    

    and don't forget to change the name if you did earlier.

You are done! Your WiFi should now work fine after a hibernate.

  • Welcome to Ask Ubuntu! ;-) Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-) – Fabby Sep 26 '15 at 0:44
  • thank you for the edit and the link! very new, so that will be extremely helpful! – Mayoshka Sep 26 '15 at 9:10
0

I would run

sudo service network-manager restart

sudo makes it superuser, or root, so you're allowed to run it. service runs a script, removing most environment variables and with the directory set to /. network-manager tells it the service we want, and restart stops and starts that process.

  • That's not an nature work, due to have an intervention by a command line. – evergreen Dec 5 '14 at 16:45
  • @evergreen you could set it to run automatically. – Tim Dec 5 '14 at 17:35
  • @Tim, how to set it run automatically, could you clarify? – evergreen Dec 5 '14 at 22:20
  • Try using cron? I'm not sure, a search may help... – Tim Dec 5 '14 at 22:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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