Ubuntu fix network stopped working after resume from sleep

I'm currently using Ubuntu Lucid on my HP Compaq CQ56 laptop. It is really Linux friendly laptop, but like every other configuration it needs some tweaking to really shine. In this post I will show you how to fix problem with ethernet network not working after resume from sleep. This procedure works for ethernet or wifi network devices, or any other hardware device that makes problems after resume from sleep.

First thing is to find out the kernel module that makes your network hardware alive (and dead after resume from sleep). It takes some knowledge to determine this name, usually it starts with "r" if you have Realtek NIC or "rt" for Ralink wifi hardware but it could be anything else. It might help to look into your hardware specification. To see the list of loaded kernel modules use this command:

sudo lsmod

The result of that command would be the list like this one:

...
r8169                  34108  0 
mii                     4381  1 r8169
binfmt_misc             6587  1 
videodev               34361  1 uvcvideo
v4l1_compat            13251  2 uvcvideo,videodev
rt3090sta             905769  0 
vboxdrv               230432  2 vboxnetadp,vboxnetflt
joydev                  8740  0 
...

Problem on my laptop is with Realtek 8169 ethernet device whose network connection is lost after returning from sleep. So name I was looking for is the name of "r8169" kernel module from the list above. Next thing is to add this kernel module to the list of kernel modules to unload before going to sleep and reload after returning from sleep. We do this by editing (creating it if it doesn't exist) /etc/pm/config.d/unload_modules file like this:

sudo gedit /etc/pm/config.d/unload_modules

Now we add following to that file (you should replace "r1869" with the name of kernel module that is making problems for your configuration):

SUSPEND_MODULES="$SUSPEND_MODULES r8169"

That is it. Now put your PC to sleep and test is your troublesome hardware working after resume. If you feel kind you can also report here if it works or not. Cheers!

DevGenii

A quality focused Magento specialized web development agency. Get in touch!

71 thoughts on “Ubuntu fix network stopped working after resume from sleep

  1. Kovo1533

    Looks like this solved my problem with wifi on lenovo S12 ion (module wl), now I am able to connect after resume, I use WICD instead NM.

    Reply
  2. SuaveRico

    It worked for me, with the same kernel module “r8169”
    At first it didn’t work, but after I rebooted Ubuntu I was able get my network working after sleep.
    Ubuntu 11.10
    HPDV51128ca
    Realtek RTL8102E

    Reply
  3. Euloiix

    It worked for me also. 

    Lucid 10.04 with ath9k module which prevented me to connect wirelessly after suspend

    Reply
  4. Netman

    Whooo Hooo worked for me too. Not being a linux guru (windows me — Boooo) I’m well on my way to liking what I see.
    Compaq 500 nouvo module now tick-a-tee boo

    Thanks Netman

    Reply
  5. Davious

    Brilliant, I was sick of having to re-boot after suspend to get wlan back online, this did the trick!!

    Many thanks to you sir!! 🙂

    Reply
    1. warrick

      You are a dipshit if you used to reboot, just turn the adapter off then back on and it’s fine. All laptops have a switch or a button to disable, if it’s a desktop with a dongle just unplug the dongle and plug it back in.

      Reply
  6. Indy

    Thanks, i have problem with Ubuntu 12.04 with r8712u – wifi dos not work after suspend.

    As you wrote, SUSPEND_MODULES=”$SUSPEND_MODULES r8712u” in
    /etc/pm/config.d/unload_modules and it works fine!

    Reply
  7. JimmySavile

    Another victory (and my first delve into the terminal) – How’s about that then!
    via_rhine seems to be a popular LAN module

    Reply
  8. David

    Damn, I thought this was the fix Ive been waiting for, but saly it does not seem to have worked. 🙁

    Mine was iwl3945
    So I put  SUSPEND_MODULES=”$SUSPEND_MODULES iwl3945″

    into the file, and nothing has changed, 🙁

    Any ideas? thank you.

    Reply
    1. Marko Author

      Hi. Check dmesg command after returning from suspend was module really unloaded. If it was unloaded then problem is unfortunately elsewhere, most probably inside iw3945 kernel module.

      Reply
  9. Daniel

    Thank you!
    Worked like a charm.
    In my case i needed to “wake up” more than one NIC,
    If anyone need it, just put a comma between them, like this:

    SUSPEND_MODULES=”$SUSPEND_MODULES module1, module2, module3″

    Reply
  10. mardocheo

    It works perfectly for me.

    But for my case it slowed also my hibernate wake-up, I mean that before this trick I could hibernate or suspend my 12.10 ubuntu distro and have a fast reboot, but now I must wait a little … anyway it`s perfetc for wifi modules.

    Thank you (I am luky i have the same wifi adapter of you!)

    Reply
  11. Chuck Finley

    Output of lsmod


    Module Size Used by
    rtl8192ce 53641 0
    rtl8192c_common 48780 1 rtl8192ce
    rtlwifi 74749 1 rtl8192ce

    Added this line tonew file /etc/pm/config.d/unload_modules

    SUSPEND_MODULES="$SUSPEND_MODULES rtl8192ce"

    Seems to have solved my problem of wifi being finicky after resuming from suspend on my Toshiba Satellite C855.

    Thanks

    Reply
  12. LongIslandSteven

    Works for me! I just installed Ubuntu and would not be keeping it if I wasn’t able to get wifi after suspend working.

    You’re a lifesaver!

    Reply
  13. Blaine

    That worked perfectly for me. USB wireless (r8712u) would not reload after suspend.

    Ubuntu 12.04LTS, Dell D620 laptop w/ Asus Wireless N USB (r8712u)

    Reply
  14. bubba_jones

    r8127u did not work after suspend.  built this file and it works great now. only line in file is:  I have ubuntu 12.04

    SUSPEND_MODULES=”$SUSPEND_MODULES r8712u”

    Reply
  15. roj

    great i made it and it works,,,,

    BUT after i shut down the system and start again the systems stops and keep giving me message waiting to reload nework configuration and after long time it logged in with no ethernet working at all,,,and removed the line again to make it run normally but of course it is back again not working the ethernet after wake up ,,,help,,,Please!!!!

    Reply
  16. Ram Sambamurthy

    Didn’t work on my Samsung NP535U using ath9k wifi chip. After waking up from hibernation, the network applet in the task bar said “Wifi disabled by hardware switch”

    I had to do the following in the terminal:
    sudo rfkill unblock wifi

    then the wifi came back on.

    hope this benefits someone

    Reply
  17. Peter

    I’d like to express my thanks also for this well explained solution. I am running Kubuntu 13.10 on a Lenovo T60, using a Realtek RTL8191SU (sold by Rosewill):
    lsusb
    Bus 001 Device 005: ID 0bda:8172 Realtek Semiconductor Corp. RTL8191SU 802.11n WLAN Adapter

    During the install Kbuntu installed the r8712u module:
    ~$ sudo lsmod | grep r8
    r8712u 158680 0

    and it always activated the adapter nicely during boot up. But after going to sleep and waking, it was inactive. Your solution worked perfectly, and now it reliably wakes up. Thank you again!

    Reply
  18. Ivan

    I have atheroe USB WIFI with the same module (r8169) but I add he following:

    SUSPEND_MODULES=”$SUSPEND_MODULES r8169, ath9k_common, ath9k_htc, ath9k_hw, ath, mac80211″

    Sorry, my English is bad

    Reply
  19. Zvonimir

    Working like a charm on Elementary OS Luna 64-bit with USB wi-fi adapter named Planet (driver name is rtl8192cu).

    Thanks a lot Marko.

    Reply
  20. Gilberto

    It does not work for me. I use Debian GNU/Linux (testing) and my ethernet card uses the r8169 module. When I resume the system I can see the interface with ifconfig but it does not work, even if I turn it down and up.

    Reply
  21. John Camden

    Worked perfectly:

    -Ubuntu 13.10
    -Qualcomm Atheros AR8171/8175 PCI-E Gigabit Ethernet Controller
    -SUSPEND_MODULES=”$SUSPEND_MODULES alx”

    Thanks!

    Reply
  22. Robby

    I was having the same problem with my Toshiba C655 running Linux Mint 13. It would not connect after waking from Suspend or Hibernate. (Hibernate isn’t enabled by default in this distro but I searched and found a way to enable it.) After restarting, however, it connected immediately. Luckily I found this post, followed the instructions, and edited with the following:

    SUSPEND_MODULES=”$SUSPEND_MODULES rtl8192ce”

    Solution works perfectly! Thanks, Marco!

    Reply
  23. Mike Buxton

    Worked for me on an old Acer Travelmate 2350 with ubuntu 12.04 using a Trendnet WiFi adapter. Many thanks for sharing your expertise.

    Reply
  24. Janiporo

    I got it working also!

    lsusb -command told me I have have:
    0bda:8172 Realtek Semiconductor Corp. RTL8191S WLAN Adapter

    did the following:
    sudo gedit /etc/pm/config.d/unload_modules
    added this line (file was empty):
    SUSPEND_MODULES=”$SUSPEND_MODULES r8712u”
    Save and try to suspend + startup, should work.
    I hope this helps someone also 🙂

    Reply
  25. Javesh Garg

    Thanks,
    But this problem persists for me even after doing the same. The driver is “e1000e” for my machine. Do, I need to restart the machine for the script to work. Thanks for the help.

    Reply
  26. Suparna Diwakar

    The solution worked for me on a Dell Latitude 3330 laptop with Ubuntu 12.04. Thank you! How can I do the same for hibernate?
    Thanks.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *