Hello,
it seems I have to reload the kernel module r8169 after hibernate.
Can anybody tell how I can trigger such a script?
Thanks
Rainer
Hello,
it seems I have to reload the kernel module r8169 after hibernate.
Can anybody tell how I can trigger such a script?
Thanks
Rainer
It may work in the same way I sometimes have to “reset” my trackpad after the first (or occasionally not the first, but a subsequent) sleep or hibernate cycle:
sudo modprobe -r psmouse && sudo modprobe -a psmouse
(Not sure the -a is needed).
Is that module actually called r8169
? … if so try substituting that for my psmouse
example. also, this might well be kernel dependent as my above example doesn’t work on some HWE kernels.
Which are you using? mhwd-kernel -li
How did you come to that conclusion ?
Have you synced the linuxXX-r8168 package to your system ?
If yes - then uninstall - and reboot - then recheck …
The network is gone after the system comes out of hibernate, the issue is not there if the system just suspends to RAM.
sudo systemctl restart systemd-networkd
does not resolve the issue, but
sudo modprobe -r r8169; sudo modprobe r8169
does. It could be that the kernel module is not the root cause though.
@BG405: That part I understand, but I don’t know where to add the script that it gets executed automatically, when resuming from hibernate.
Unfortunately
$ cat /etc/systemd/system/fix-r8169.service
[Unit]
Description=Fix RTL-8169 Driver on resume from suspend
After=hibernate.target
[Service]
User=root
Type=oneshot
ExecStartPre=/sbin/modprobe -r r8169
ExecStart=/sbin/modprobe r8169
TimeoutSec=0
[Install]
WantedBy=hibernate.target
doesn’t seem to work (even though I enabled the service). I am not sure if a hibernate.target exists in Manjaro though…
That is because the default is NetworkManager.
Thanks for the hint.
Unfortunately
sudo systemctl restart NetworkManager.service
does not help either.
Not it was not installed.
Just in case it is useful, the output of
$lspci 00:00.0 Host bridge: Intel Corporation Device 461c
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-N [UHD Graphics]
00:14.0 USB controller: Intel Corporation Alder Lake-N PCH USB 3.2 xHCI Host Controller
00:14.2 RAM memory: Intel Corporation Alder Lake-N PCH Shared SRAM
00:14.3 Network controller: Intel Corporation CNVi: Wi-Fi
00:15.0 Serial bus controller: Intel Corporation Device 54e8
00:15.1 Serial bus controller: Intel Corporation Device 54e9
00:16.0 Communication controller: Intel Corporation Alder Lake-N PCH HECI Controller
00:17.0 SATA controller: Intel Corporation Device 54d3
00:19.0 Serial bus controller: Intel Corporation Device 54c5
00:19.1 Serial bus controller: Intel Corporation Device 54c6
00:1c.0 PCI bridge: Intel Corporation Device 54be
00:1d.0 PCI bridge: Intel Corporation Device 54b2
00:1e.0 Communication controller: Intel Corporation Device 54a8
00:1e.3 Serial bus controller: Intel Corporation Device 54ab
00:1f.0 ISA bridge: Intel Corporation Alder Lake-N PCH eSPI Controller
00:1f.3 Audio device: Intel Corporation Alder Lake-N PCH High Definition Audio Controller
00:1f.4 SMBus: Intel Corporation Device 54a3
00:1f.5 Serial bus controller: Intel Corporation Device 54a4
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)
02:00.0 Non-Volatile memory controller: Phison Electronics Corporation PS5015-E15 PCIe3 NVMe Controller (DRAM-less) (rev 01)
Adding machine configuration:
[smart ~]# inxi -F
System:
Host: smart Kernel: 6.9.3-3-MANJARO arch: x86_64 bits: 64
Console: pty pts/1 Distro: Manjaro Linux
Machine:
Type: Desktop Mobo: AZW model: MINI S v: 10 serial: N/A UEFI: American Megatrends LLC.
v: ADLNV104 date: 02/06/2023
CPU:
Info: quad core model: Intel N100 bits: 64 type: MCP cache: L2: 2 MiB
Speed (MHz): avg: 700 min/max: 700/3400 cores: 1: 700 2: 700 3: 700 4: 700
Graphics:
Device-1: Intel Alder Lake-N [UHD Graphics] driver: i915 v: kernel
Display: server: X.org v: 1.21.1.13 with: Xwayland v: 24.1.0 driver: X: loaded: modesetting
dri: iris gpu: i915 tty: 338x89 resolution: 3840x2160
API: EGL v: 1.5 drivers: iris,swrast platforms: surfaceless,device
API: OpenGL v: 4.6 compat-v: 4.5 vendor: mesa v: 24.0.9-manjaro1.1 note: console (EGL sourced)
renderer: Mesa Intel Graphics (ADL-N), llvmpipe (LLVM 17.0.6 256 bits)
API: Vulkan v: 1.3.279 drivers: intel surfaces: N/A
Audio:
Device-1: Intel Alder Lake-N PCH High Definition Audio driver: snd_hda_intel
API: ALSA v: k6.9.3-3-MANJARO status: kernel-api
Network:
Device-1: Intel CNVi: Wi-Fi driver: iwlwifi
IF: wlo1 state: down mac: ca:41:c5:cd:d2:b4
Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet driver: r8169
IF: enp1s0 state: up speed: 1000 Mbps duplex: full mac: 7c:83:34:be:2b:ae
IF-ID-1: enp1s0.1 state: up speed: 1000 Mbps duplex: full mac: 7c:83:34:be:2b:ae
IF-ID-2: enp1s0.2 state: up speed: 1000 Mbps duplex: full mac: 7c:83:34:be:2b:ae
IF-ID-3: enp1s0.7 state: up speed: 1000 Mbps duplex: full mac: 7c:83:34:be:2b:ae
Bluetooth:
Device-1: Intel AX201 Bluetooth driver: btusb type: USB
Report: rfkill ID: hci0 state: up address: see --recommends
Drives:
Local Storage: total: 476.94 GiB used: 74.38 GiB (15.6%)
ID-1: /dev/nvme0n1 model: PCIe SSD size: 476.94 GiB
Partition:
ID-1: / size: 451.41 GiB used: 74.38 GiB (16.5%) fs: ext4 dev: /dev/nvme0n1p2
ID-2: /boot/efi size: 299.4 MiB used: 296 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1
Swap:
ID-1: swap-1 type: partition size: 16.94 GiB used: 0 KiB (0.0%) dev: /dev/nvme0n1p3
Sensors:
System Temperatures: cpu: 34.0 C mobo: N/A
Fan Speeds (rpm): N/A
Info:
Memory: total: 16 GiB available: 15.4 GiB used: 3.77 GiB (24.5%) igpu: 60 MiB
Processes: 218 Uptime: 0m Init: systemd Shell: Bash inxi: 3.3.35
[smart ~]#
See the root-resume.service
example at Power management/Suspend and hibernate - ArchWiki
[Unit]
Description=Fix RTL-8169 Driver on resume from suspend
After=hibernate.target
[Service]
Type=simple
ExecStartPre=/sbin/modprobe -r r8169
ExecStart=/sbin/modprobe r8169
[Install]
WantedBy=hibernate.target
systemctl status hibernate.target
Unfortunately, that does not solve the problem. Manually unloading and reloading r8169 after hibernate works, and the network is coming back after a short moment.
With the systemd service though neither the network is coming back nor does it reboot properly anymore:
[smart ~]# systemctl disable fix-r8169
[smart ~]# systemctl hibernate
[smart ~]# ping heise.de
^C
[smart ~]# modprobe -r r8169
[smart ~]# modprobe r8169
[smart ~]# ping heise.de
ping: heise.de: Temporary failure in name resolution
[smart ~]# ping heise.de
PING heise.de (193.99.144.80) 56(84) bytes of data.
64 bytes from redirector.heise.de (193.99.144.80): icmp_seq=1 ttl=248 time=20.5 ms
64 bytes from redirector.heise.de (193.99.144.80): icmp_seq=2 ttl=248 time=18.5 ms
^C
--- heise.de ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 18.496/19.491/20.487/0.995 ms
[smart ~]# systemctl enable fix-r8169
Created symlink /etc/systemd/system/hibernate.target.wants/fix-r8169.service → /etc/systemd/system/fix-r8169.service.
[smart ~]# systemctl hibernate
[smart ~]# ping heise.de
ping: heise.de: Temporary failure in name resolution
[smart ~]# ping heise.de
ping: heise.de: Temporary failure in name resolution
[smart ~]# ping heise.de
ping: heise.de: Temporary failure in name resolution
[smart ~]# modprobe -r r8169
modprobe: ERROR: could not remove 'r8169': Device or resource busy
[smart ~]# cat /etc/systemd/system/fix-r8169.service
[Unit]
Description=Fix RTL-8169 Driver on resume from suspend
After=hibernate.target
[Service]
Type=simple
ExecStartPre=/sbin/modprobe -r r8169
ExecStart=/sbin/modprobe r8169
[Install]
WantedBy=hibernate.target
[smart ~]# systemctl reboot
Call to Reboot failed: Transaction for reboot.target/start is destructive (fix-r8169.service has 'start' job queued, but 'stop' is included in transaction).
Failed to start reboot.target: Transaction for reboot.target/start is destructive (fix-r8169.service has 'start' job queued, but 'stop' is included in transaction).
See system logs and 'systemctl status reboot.target' for details.
[smart ~]#
Any idea or hint what could go wrong is welcome.
Check systemctl status fix-r8169.service
after systemctl hibernate
to see what it’s doing, or any messages.
Debugging the issue becomes more troublesome, since it seems that it is somehow intermittent ( I apologize for the poor prompt). If I interpret the output correctly, modprobe -r r8189 hangs in these situations:
~ systemctl status fix-r8169 ✔
○ fix-r8169.service - Fix RTL-8169 Driver on resume from suspend
Loaded: loaded (/etc/systemd/system/fix-r8169.service; enabled; preset: disabled)
Active: inactive (dead)
~ systemctl hibernate 3 ✘
~ systemctl status fix-r8169 ✔
○ fix-r8169.service - Fix RTL-8169 Driver on resume from suspend
Loaded: loaded (/etc/systemd/system/fix-r8169.service; enabled; preset: disabled)
Active: inactive (dead)
Jun 29 14:59:04 smart systemd[1]: Starting Fix RTL-8169 Driver on resume from suspend...
Jun 29 14:59:05 smart systemd[1]: Started Fix RTL-8169 Driver on resume from suspend.
Jun 29 14:59:05 smart systemd[1]: fix-r8169.service: Deactivated successfully.
~ ping heise.de 3 ✘
PING heise.de (2a02:2e0:3fe:1001:302::) 56 Datenbytes
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=1 ttl=57 Zeit=22.2 ms
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=2 ttl=57 Zeit=15.9 ms
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=3 ttl=57 Zeit=14.0 ms
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=4 ttl=57 Zeit=20.1 ms
^C
--- heise.de ping-Statistik ---
4 Pakete übertragen, 4 empfangen, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 13.968/18.038/22.172/3.246 ms
~ systemctl hibernate ✔ 4s
~ systemctl status fix-r8169 ✔
○ fix-r8169.service - Fix RTL-8169 Driver on resume from suspend
Loaded: loaded (/etc/systemd/system/fix-r8169.service; enabled; preset: disabled)
Active: inactive (dead)
Jun 29 14:59:04 smart systemd[1]: Starting Fix RTL-8169 Driver on resume from suspend...
Jun 29 14:59:05 smart systemd[1]: Started Fix RTL-8169 Driver on resume from suspend.
Jun 29 14:59:05 smart systemd[1]: fix-r8169.service: Deactivated successfully.
Jun 29 15:00:35 smart systemd[1]: Starting Fix RTL-8169 Driver on resume from suspend...
Jun 29 15:00:36 smart systemd[1]: Started Fix RTL-8169 Driver on resume from suspend.
Jun 29 15:00:36 smart systemd[1]: fix-r8169.service: Deactivated successfully.
~ ping heise.de 3 ✘
PING heise.de (2a02:2e0:3fe:1001:302::) 56 Datenbytes
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=1 ttl=57 Zeit=21.1 ms
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=2 ttl=57 Zeit=19.2 ms
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=3 ttl=57 Zeit=16.8 ms
64 Bytes von redirector.heise.de (2a02:2e0:3fe:1001:302::): icmp_seq=4 ttl=57 Zeit=15.5 ms
^C
--- heise.de ping-Statistik ---
4 Pakete übertragen, 4 empfangen, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 15.537/18.154/21.149/2.164 ms
~ systemctl hibernate ✔ 4s
~ systemctl status fix-r8169 ✔
● fix-r8169.service - Fix RTL-8169 Driver on resume from suspend
Loaded: loaded (/etc/systemd/system/fix-r8169.service; enabled; preset: disabled)
Active: activating (start-pre) since Sat 2024-06-29 15:02:51 CEST; 8s ago
Cntrl PID: 2178 (modprobe)
Tasks: 1 (limit: 18882)
Memory: 696.0K (peak: 1.4M)
CPU: 6ms
CGroup: /system.slice/fix-r8169.service
└─2178 /sbin/modprobe -r r8169
Jun 29 15:02:51 smart systemd[1]: Starting Fix RTL-8169 Driver on resume from suspend...
~ systemctl status fix-r8169 3 ✘
● fix-r8169.service - Fix RTL-8169 Driver on resume from suspend
Loaded: loaded (/etc/systemd/system/fix-r8169.service; enabled; preset: disabled)
Active: activating (start-pre) since Sat 2024-06-29 15:02:51 CEST; 20s ago
Cntrl PID: 2178 (modprobe)
Tasks: 1 (limit: 18882)
Memory: 696.0K (peak: 1.4M)
CPU: 6ms
CGroup: /system.slice/fix-r8169.service
└─2178 /sbin/modprobe -r r8169
Jun 29 15:02:51 smart systemd[1]: Starting Fix RTL-8169 Driver on resume from suspend...
~ systemctl status fix-r8169 3 ✘
● fix-r8169.service - Fix RTL-8169 Driver on resume from suspend
Loaded: loaded (/etc/systemd/system/fix-r8169.service; enabled; preset: disabled)
Active: activating (start-pre) since Sat 2024-06-29 15:02:51 CEST; 27s ago
Cntrl PID: 2178 (modprobe)
Tasks: 1 (limit: 18882)
Memory: 696.0K (peak: 1.4M)
CPU: 6ms
CGroup: /system.slice/fix-r8169.service
└─2178 /sbin/modprobe -r r8169
Jun 29 15:02:51 smart systemd[1]: Starting Fix RTL-8169 Driver on resume from suspend...
~ ping heise.de 3 ✘
ping: heise.de: Temporärer Fehler bei der Namensauflösung
~
As last entries in dmesg I see
[ 127.874795] PM: hibernation: hibernation exit
[ 127.875921] Bluetooth: hci0: Fseq status: Success (0x00)
[ 127.875927] Bluetooth: hci0: Fseq executed: 00.00.02.41
[ 127.875929] Bluetooth: hci0: Fseq BT Top: 00.00.02.41
[ 127.876317] thermal thermal_zone1: failed to read out thermal zone (-61)
[ 127.926281] Generic FE-GE Realtek PHY r8169-0-100:00: attached PHY driver (mii_bus:phy_addr=r8169-0-100:00, irq=MAC)
[ 127.947166] Bluetooth: MGMT ver 1.22
[ 128.119409] r8169 0000:01:00.0 enp1s0: Link is Down
[ 128.120172] leds enp1s0-0::lan: Setting an LED's brightness failed (-524)
[ 128.120490] leds enp1s0-0::lan: Setting an LED's brightness failed (-524)
[ 128.156166] leds enp1s0-1::lan: Setting an LED's brightness failed (-524)
[ 128.156230] leds enp1s0-1::lan: Setting an LED's brightness failed (-524)
[ 128.190937] leds enp1s0-2::lan: Setting an LED's brightness failed (-524)
[ 128.580655] r8169 0000:01:00.0: can't disable ASPM; OS doesn't have ASPM control
[ 128.597385] r8169 0000:01:00.0 eth0: RTL8168h/8111h, 7c:83:34:be:2b:ae, XID 541, IRQ 143
[ 128.597395] r8169 0000:01:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
[ 128.598821] r8169 0000:01:00.0 enp1s0: renamed from eth0
[ 128.639341] Generic FE-GE Realtek PHY r8169-0-100:00: attached PHY driver (mii_bus:phy_addr=r8169-0-100:00, irq=MAC)
[ 128.836052] r8169 0000:01:00.0 enp1s0: Link is Down
[ 131.513280] r8169 0000:01:00.0 enp1s0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 153.064999] r8169 0000:01:00.0 enp1s0: Link is Down
[ 153.507026] PM: hibernation: hibernation entry
[ 153.523908] Filesystems sync: 0.014 seconds
[ 153.524041] Freezing user space processes
[ 153.526727] Freezing user space processes completed (elapsed 0.002 seconds)
[ 153.526733] OOM killer disabled.
[ 153.526895] PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
[ 153.526898] PM: hibernation: Marking nosave pages: [mem 0x0009e000-0x0009efff]
[ 153.526899] PM: hibernation: Marking nosave pages: [mem 0x000a0000-0x000fffff]
[ 153.526901] PM: hibernation: Marking nosave pages: [mem 0x4035c000-0x4035cfff]
[ 153.526902] PM: hibernation: Marking nosave pages: [mem 0x40393000-0x40393fff]
[ 153.526903] PM: hibernation: Marking nosave pages: [mem 0x6bf8d000-0x6c108fff]
[ 153.526907] PM: hibernation: Marking nosave pages: [mem 0x723de000-0x75ffefff]
[ 153.527061] PM: hibernation: Marking nosave pages: [mem 0x76000000-0xffffffff]
[ 153.528763] PM: hibernation: Basic memory bitmaps created
[ 153.528908] PM: hibernation: Preallocating image memory
[ 154.416177] PM: hibernation: Allocated 1258804 pages for snapshot
[ 154.416183] PM: hibernation: Allocated 5035216 kbytes in 0.88 seconds (5721.83 MB/s)
[ 154.416185] Freezing remaining freezable tasks
[ 154.417433] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 154.458667] printk: Suspending console(s) (use no_console_suspend to debug)
[ 154.461860] serial 00:01: disabled
[ 154.515608] azx_single_wait_for_response: 27 callbacks suppressed
[ 154.612647] ACPI: PM: Preparing to enter system sleep state S4
[ 154.616120] ACPI: PM: Saving platform NVS memory
[ 154.617961] Disabling non-boot CPUs ...
[ 154.620105] smpboot: CPU 1 is now offline
[ 154.622942] smpboot: CPU 2 is now offline
[ 154.625810] smpboot: CPU 3 is now offline
[ 154.628246] PM: hibernation: Creating image:
[ 154.819319] PM: hibernation: Need to copy 1237099 pages
[ 154.819322] PM: hibernation: Normal pages needed: 1237099 + 1024, available pages: 2898418
[ 154.628333] ACPI: PM: Restoring platform NVS memory
[ 154.629340] Enabling non-boot CPUs ...
[ 154.629583] smpboot: Booting Node 0 Processor 1 APIC 0x2
[ 154.630693] CPU1 is up
[ 154.630907] smpboot: Booting Node 0 Processor 2 APIC 0x4
[ 154.632083] CPU2 is up
[ 154.632276] smpboot: Booting Node 0 Processor 3 APIC 0x6
[ 154.633438] CPU3 is up
[ 154.633903] ACPI: PM: Waking up from system sleep state S4
[ 154.745917] usb usb1: root hub lost power or was reset
[ 154.745922] usb usb2: root hub lost power or was reset
[ 154.748494] serial 00:01: activated
[ 154.748622] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/tgl_guc_70.bin version 70.20.0
[ 154.748626] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc.bin version 7.9.3
[ 154.753145] i915 0000:00:02.0: [drm] GT0: HuC: authenticated for all workloads
[ 154.753607] i915 0000:00:02.0: [drm] GT0: GUC: submission enabled
[ 154.753608] i915 0000:00:02.0: [drm] GT0: GUC: SLPC enabled
[ 154.753925] i915 0000:00:02.0: [drm] GT0: GUC: RC enabled
[ 154.865360] nvme nvme0: 4/0/0 default/read/poll queues
[ 155.032284] usb 1-3: reset high-speed USB device number 2 using xhci_hcd
[ 155.056755] ata2: SATA link down (SStatus 4 SControl 300)
[ 155.295677] usb 1-10: reset full-speed USB device number 3 using xhci_hcd
[ 155.699109] usb 1-3.1: reset low-speed USB device number 4 using xhci_hcd
[ 156.242349] usb 1-3.2: reset low-speed USB device number 5 using xhci_hcd
[ 156.538154] PM: hibernation: Basic memory bitmaps freed
[ 156.538970] OOM killer enabled.
[ 156.538975] Restarting tasks ...
[ 156.540605] Bluetooth: hci0: Firmware timestamp 2024.14 buildtype 1 build 81454
[ 156.540622] Bluetooth: hci0: Firmware SHA1: 0xdfd62093
[ 156.540832] Bluetooth: hci0: DSM reset method type: 0x00
[ 156.541929] Bluetooth: hci0: Found device firmware: intel/ibt-0040-1050.sfi
[ 156.541950] Bluetooth: hci0: Boot Address: 0x100800
[ 156.541951] Bluetooth: hci0: Firmware Version: 46-14.24
[ 156.541952] Bluetooth: hci0: Firmware already loaded
[ 156.545433] Bluetooth: hci0: Fseq status: Success (0x00)
[ 156.545441] Bluetooth: hci0: Fseq executed: 00.00.02.41
[ 156.545443] Bluetooth: hci0: Fseq BT Top: 00.00.02.41
[ 156.552022] done.
[ 156.552038] PM: hibernation: hibernation exit
[ 156.552050] thermal thermal_zone1: failed to read out thermal zone (-61)
[ 156.618803] Bluetooth: MGMT ver 1.22
Hmmm. I have no idea why it gets stuck. I guess the next thing I’d try is putting both commands in a script and just run that from ExecStart
instead of using ExecStartPre
.
I upgraded to
Linux smart 6.9.5-1-MANJARO #1 SMP PREEMPT_DYNAMIC Wed Jun 19 19:07:41 UTC 2024 x86_64 GNU/Linux
but the problem persists.
Also
~ cat /usr/local/sbin/reload-r8169.sh ✔
#!/bin/sh
modprobe -r r8169
modprobe r8169
~
and calling this from ExecStart
does not change anything.
When I call modprobe -r r8169 and modprobe r8169 manually from a root console, that works reliably.
With the systemd script, I saw a hang after the second hibernate cycle.
I am wondering if that thread should move to Support → Kernel. If yes, who can do this?
Done. I also added the “network” tag for Forum reference purposes.
I’m currently looking into how to set this as a cron job.
EDIT:
I did find this on Stack Exchange (courtesy of a mate who has better search-fu than I). I’m reading through it but maybe it will help.