Systemd / realtek r8169 suspend fails on wake
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I had not had issues with the r8169 module for realtek LAN nic for a long time, but with kernel 5.7, and current systemd, bang, suddenly stopped having networking enabled on wake from suspend.

Short term, of course, you can just do the classic. First find your nic IF ID:

:: Code ::

inxi -nxx
Network:   
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Gigabyte driver: r8169 v: kernel
  port: ce00 bus ID: 03:00.0 chip ID: 10ec:8168
  IF: enp2s0 state: down mac: <filter>

## then just stop and start the NIC:
sudo ifdown enp2s0
sudo ifup enp2s0


askubuntu.com/questions/1029250/ubuntu-18-04-ethernet-disconnected-after-suspend

One of the answers is worth keeping because it's a clean native solution, not a sort of hacked on one:
=============================
Create file: /etc/systemd/system/fix-r8169.service

with contents:

:: Code ::

[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:
:: Code ::
sudo systemctl enable fix-r8169.service

and you should be set!! Systemd will now automagically unload-and-reload your module upon wake from suspend.

=============================

I'm not getting consistent results with this, a reboot may be required, but I had this fail when suspend / wake was more than about 12 hours apart, but it worked when wake was closer to suspend.

This is however a good place to start.

Note that with these types of fixes, if the os is ever moved to different hardware, you want to remember that you made this and remove it, and also, test on different kernels.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I had further issues, this time with igb driver for network:

:: Code ::
inxi -nz
Network:
  Device-1: Intel I211 Gigabit Network driver: igb
  IF: enp7s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IF-ID-1: vboxnet0 state: down mac: <filter>


Tried:

:: Code ::
sudo ifdown enp7s0
sudo ifup enp7s0


no joy, no connection, luckily because I have experienced this before I did not waste time checking if it was a hardware issue.

Ran:

:: Code ::
sudo modprobe -r igb
sudo modprobe igb


and networking worked fine again.

This is I believe maybe related to systemd and suspend, but it could be kernels, network drivers, and suspend/resume, I don't know. All I know is this has happened on two systems now.

Posting this update in case anyone else out there has this issue, since this fix seems to correct it.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours