Ethernet does not resume after suspend.

sudo service network-manager restart

does not work. Only restart solves problem.

10 Answers 10

up vote 30 down vote accepted

The main Ubuntu bug tracking this issue, at least for network kernel module r8169, seems to be:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1752772

I'd encourage everyone that is affected by this issue to go there and mark that it affects you, so that the maintainers have a better sense of how serious it is.

I'm running a fresh install of Xubuntu 18.04, and my Ethernet interface uses kernel module r8169, which I discovered running:

sudo lshw -C network

There'll be 2 groups of info, one starting with description: Ethernet interface, and another with description: Wireless interface. Under description: Ethernet interface, look for a line starting with configuration:, like this:

configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl_nic/rtl8105e-1.fw ip=192.168.100.6 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s

The driver will be here: driver=.

Systemd runs all executable scripts under /lib/systemd/system-sleep before and after suspend, passing 2 parameters, $1 is the state (pre, before suspend, or post, after suspend), and $2 is the action (suspend, hibernate, hybrid-state, or suspend-then-hibernate). This is documented in the man page for systemd-suspend.service.

We need to reload the module for the Ethernet interface when resuming from suspend, after suspend. So I created script /lib/systemd/system-sleep/r8169-refresh:

#!/bin/bash

PROGNAME=$(basename "$0")
state=$1
action=$2

function log {
    logger -i -t "$PROGNAME" "$*"
}

log "Running $action $state"

if [[ $state == post ]]; then
    modprobe -r r8169 \
    && log "Removed r8169" \
    && modprobe -i r8169 \
    && log "Inserted r8169"
fi

and made it executable:

chmod +x /lib/systemd/system-sleep/r8169-refresh

The messages logged from the script will go to /var/log/syslog tagged with the name of the script and its PID. This way you can check whether the script reloaded the kernel module:

grep r8169-refresh /var/log/syslog
  • 1
    Thanks, this was very helpful. This should be the accepted answer since it is a complete solution to the problem – Carlos Roque May 9 at 15:27
  • madzohan, I feel it might be redundant to add your edit, since I mentioned twice in the answer that the script has to be executable: "systemd runs all executable scripts under /lib/systemd/system-sleep", and also "I created and made executable script /lib/systemd/system-sleep/r8169-refresh" – Paulo Marcel Coelho Aragão May 16 at 21:03
  • This was fixed in kernel 4.15.0-24.26, released on 07/01/2018, so the workaround is not needed anymore. – Paulo Marcel Coelho Aragão Jul 24 at 22:21
  • I have this problem on my laptop since installing some updates a few days ago. The solution given above does still solve the issue. Thanks a lot! – Daniel Jul 25 at 19:54
  • @Daniel, could you post the output of: apt policy linux-image-generic ? This issue should have been solved since 07/01/2018, this workaround shouldn't be needed anymore. – Paulo Marcel Coelho Aragão Jul 25 at 23:05

Here's another simple(r?) solution: create a systemd service whose only task is to unload/reload the module after a suspend cycle (I named it /etc/systemd/system/fix-r8169.service):

[Unit]
Description=Fix RTL-8169 Driver on resume from suspend
After=suspend.target

[Service]
User=root
Type=oneshot
ExecStartPre=/sbin/modprobe -r r8169
ExecStart=/sbin/modprobe r8169
TimeoutSec=0
StandardOutput=syslog

[Install]
WantedBy=suspend.target

Then just execute systemctl enable fix-r8169.service, and you should be set!! Systemd will now automagically unload-and-reload your module upon wake from suspend.

Cheers!

It happened to me too.

Unload/reload network kernel modules/drivers works.

Mine is r8169, so (as root): (I typed by hand, so there was a delay)

sudo modprobe -r r8169
sudo modprobe -i r8169

I also removed mii during my first try. Not necessary though.

  • sudo modprobe -i r8169 – aaaa Apr 28 at 15:07
  • worked! do I have to do this manually now all the time i resume? – aaaa Apr 28 at 15:07
  • This the same as the accepted solution, but without putting it in a script that will be executed at resume and without the logging function. – Dominic108 Oct 14 at 20:46

I had the same problem and i found this solution.

  1. run: sudo lshw -C network
    to find your network card kernel module

    In *-network, description: Ethernet interface, in configuration field found
    driver=sky2 for me. sky2 is a ethernet network kernel module for my laptop.

  2. I create a file sky2.sh into: /lib/systemd/system-sleep/ folder with

    #!/bin/bash 
    modprobe -r sky2 # unload sky2 kernel module 
    modprobe -i sky2 # reload sky2 kernel module 
    

    and change the permissions with:

    sudo chmod a+x sky2.sh
    

After that the problem solved.

  • This is the same as the accepted solution, without the logging function. – Dominic108 Oct 14 at 20:26

It detects the Ethernet Connection?

then

open NetworkManager.conf

sudo nano /etc/NetworkManager/NetworkManager.conf

Comment (Add #) the dns=dnsmasq

[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq

[ifupdown]
managed=true

Restart the Network manager

sudo service network-manager restart
  • [main] plugins=ifupdown,keyfile [ifupdown] managed=true [device] wifi.scan-rand-mac-address=no – aaaa Apr 28 at 14:47
  • this is what I have in the file.... – aaaa Apr 28 at 14:48
  • did you update the conf file Previously? if yes reboot & check – Santhosh Veer Apr 28 at 14:50
  • I tried your fix Santhosh Veer. Still greyed out. Ethernet. – aaaa Apr 28 at 14:51
  • run this command systemctl status NetworkManager.service to check the error – Santhosh Veer Apr 28 at 14:54

Press Ctrl+Alt+T to go to a terminal and type:

sudo apt-get purge tlp

or

edit /etc/default/tlp and change:

WOL_DISABLE = NO

to

WOL_DISABLE = YES
  • 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 Jul 1 at 10:16

I don't have enough reputation to comment or upvote the accepted answer (which is now outdated)

If you run lsmod | grep r8169 and it shows that you have the r8169 kernel module loaded, and your kernel is older than 4.15.0-24-generic then you are most likely affected by the bug linked in the accepted answer https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1752772

BTW I experienced this bug and for me lspci | grep 'Gigabit Ethernet' shows RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller

This bug has been fixed.

If your kernel is older than 4.15.0-24-generic, just run

apt-get update
apt-get upgrade
apt-get dist-upgrade
reboot

I had the same problem but the solutions here did not work for me. I spent days going through several forums on this subject and tried just about everything. Two alternative solutions are mentioned, upgrade the Kernel or install the previous module driver. I chose the latter and installed the r8168 driver. Initially, that also failed. However, I discovered something that works and adapted it to the solution from Paulo.

I'm running (K)ubuntu 18.04 with Kernel 4.15.0-24-generic.

The output from lshw -C network includes this ...

description: Ethernet interface
   product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
   vendor: Realtek Semiconductor Co., Ltd.
   physical id: 0
   bus info: pci@0000:05:00.0
   logical name: enp5s0
   version: 0c
   serial: 80:fa:5b:49:69:b3
   size: 1Gbit/s
   capacity: 1Gbit/s
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
   configuration: autonegotiation=on broadcast=yes driver=r8168 driverversion=8.045.08-NAPI duplex=full ip=192.168.10.213 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
   resources: irq:133 ioport:e000(size=256) memory:df000000-df000fff memory:d0000000-d0003fff

I installed the package r8168-dkms, however that was not enough. Two further steps were required.

Step 1) Edit the file /etc/modprobe.d/r8168-dkms.conf and enable the line (i.e. remove the comment) blacklist r8169

Step 2) Based on the solution from Paulo I created the following script /lib/systemd/system-sleep/r8168-refresh

#!/bin/bash

PROGNAME=$(basename "$0")
state=$1
action=$2

function log {
    logger -i -t "$PROGNAME" "$*"
}

log "Running $action $state"

if [[ $state == post ]]; then
     log "ifconfig down enp5s0"
     ifconfig enp5s0 down
     log "ifconfig up enp5s0"
     ifconfig enp5s0 192.168.10.213
fi

This code is of course specific to my machine (device name and IP-address). It could certainly be improved but it meets my needs at the moment.

This works will with NetworkManager.

This happened to me as well with a Gigabyte-B250M-DS3H motherboard after upgrading from Ubuntu 16.04 to 18.04 on July 28, 2018. The kernel is 4.15.0-29-generic.

The result of sudo lshw -C network showed RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller, while it showed that r8169 is the driver used.

What finally worked was installing the driver specific to the Ethernet controller (big surprise):

sudo apt install r8168-dkms

and then restarting the computer (Thanks andypotter). I did not have to blacklist r8169, but I did still have to create a script in /lib/systemd/system-sleep/ that I called r8168-refresh-after-suspend(a la Paulo's advice) that would remove and reinsert r8168:

#!/bin/bash

# $1 is the state (pre or post)
# $2 is the action (suspend)

case $1/$2 in
pre/suspend)
  modprobe -r r8168
;;
post/suspend)
  modprobe -i r8168
;;
esac

and, of course, make it executable with:

sudo chmod +x /lib/systemd/system-sleep/r8168-refresh-after-suspend

This worked like a charm. So, this is still an issue in the 4.15.0-29 kernel, but the band-aid fix still works.

I have the same problem (driver=r8169), Ethernet does not work after resume from suspend.

It works perfectly well with kernel 4.13.0-31. In other words the Ethernet continues to work after resuming from suspend.

But with kernel 4.15.0-32 the Ethernet does not work after resuming from suspend. I have tried the fix

modprobe -r r8169
modprobe -i r8169

but this has no effect.

I have reported this to https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1752772

  • 1
    This is not really an answer, unless you're suggesting to use kernel 4.13. – wjandrea Oct 27 at 21:20

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.