Systemd / realtek r8169 suspend fails on wake
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4033
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
Display posts from previous:   

All times are GMT - 8 Hours