High lvl suspend not accepting wol

This is basically first time that I decide to create new question, I went through wast amount of pages and “solutions” without getting even closer to find the problem, so here it is:

  • When triggering suspend by low level interface echo mem > /sys/power/state wol is working as a dream without much issues.

  • When I try suspend system by high lvl command like systemclt suspend, I can’t wake up system by magic package anymore (power button is still working to wakeup system), also Wake-on flag in ethtool is getting lost in the process.

My question is:
How to find root cause or event better haw to fix it :smiley:

Here are some random configs that my or may not help :blush:

$inxi -Fazy

System:
  Kernel: 5.9.16-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.1 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.9-x86_64 
  root=UUID=038ccb7e-bcec-44b3-9bda-9f7b25b6170f ro quiet 
  resume=UUID=93c0a0a8-385a-42c6-bd52-9765f8e8e4de udev.log_priority=3 
  Desktop: Xfce info: polybar wm: Openbox 3.6.1 dm: LXDM Distro: Manjaro Linux 
Machine:
  Type: Desktop Mobo: ASRock model: E350M1 serial: <filter> 
  BIOS: American Megatrends v: P2.10 date: 03/06/2014 
CPU:
  Info: Dual Core model: AMD E-350 bits: 64 type: MCP arch: Bobcat 
  family: 14 (20) model-id: 1 stepping: N/A microcode: 5000029 
  L2 cache: 512 KiB 
  flags: lm nx pae sse sse2 sse3 sse4a ssse3 svm bogomips: 6402 
  Speed: 1048 MHz min/max: 800/1600 MHz Core speeds (MHz): 1: 1048 2: 801 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass status: Vulnerable 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 
  mitigation: Full AMD retpoline, STIBP: disabled, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: AMD Wrestler [Radeon HD 6310] vendor: ASRock driver: radeon 
  v: kernel bus ID: 00:01.0 chip ID: 1002:9802 class ID: 0300 
  Display: x11 server: X.Org 1.20.10 driver: loaded: ati,radeon 
  unloaded: fbdev,modesetting,vesa display ID: :0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: HDMI-0 res: 1920x1080 hz: 60 dpi: 30 
  size: 1600x900mm (63.0x35.4") diag: 1836mm (72.3") 
  Message: Unable to show advanced data. Required tool glxinfo missing. 
Audio:
  Device-1: AMD Wrestler HDMI Audio vendor: ASRock driver: snd_hda_intel 
  v: kernel bus ID: 00:01.1 chip ID: 1002:1314 class ID: 0403 
  Device-2: AMD SBx00 Azalia vendor: ASRock driver: snd_hda_intel v: kernel 
  bus ID: 00:14.2 chip ID: 1002:4383 class ID: 0403 
  Sound Server: ALSA v: k5.9.16-1-MANJARO 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: ASRock driver: r8169 v: kernel port: e000 bus ID: 04:00.0 
  chip ID: 10ec:8168 class ID: 0200 
  IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
  IF-ID-1: br-55bdd5b06c04 state: up speed: 10000 Mbps duplex: unknown 
  mac: <filter> 
  IF-ID-2: docker0 state: down mac: <filter> 
  IF-ID-3: veth2f50612 state: up speed: 10000 Mbps duplex: full mac: <filter> 
Drives:
  Local Storage: total: 2.84 TiB used: 46.43 GiB (1.6%) 
  SMART Message: Required tool smartctl not installed. Check --recommends 
  ID-1: /dev/sda maj-min: 8:0 vendor: Silicon Power 
  model: SPCC Solid State Disk size: 111.79 GiB block size: physical: 512 B 
  logical: 512 B speed: 6.0 Gb/s rotation: SSD serial: <filter> rev: 71.1 
  scheme: MBR 
  ID-2: /dev/sdb maj-min: 8:16 vendor: Western Digital model: WD20EARX-008FB0 
  size: 1.82 TiB block size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s 
  serial: <filter> rev: AB51 scheme: GPT 
  ID-3: /dev/sdc maj-min: 8:32 vendor: Samsung model: HD103SI size: 931.51 GiB 
  block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s serial: <filter> 
  rev: 1118 scheme: MBR 
Partition:
  ID-1: / raw size: 104.49 GiB size: 102.35 GiB (97.95%) used: 6.51 GiB (6.4%) 
  fs: ext4 block size: 4096 B dev: /dev/sda1 maj-min: 8:1 
Swap:
  Kernel: swappiness: 60 (default) cache pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 7.3 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/sda2 maj-min: 8:2 
Sensors:
  System Temperatures: cpu: 66.1 C mobo: N/A gpu: radeon temp: 67.0 C 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 161 Uptime: 1h 18m wakeups: 6 Memory: 3.32 GiB 
  used: 1.06 GiB (32.0%) Init: systemd v: 247 Compilers: gcc: 10.2.0 Packages: 
  pacman: 665 lib: 134 Shell: Zsh v: 5.8 running in: terminator inxi: 3.3.01 
$cat /sys/power/state
           
freeze mem disk
$cat /etc/systemd/sleep.conf  

[Sleep]
AllowSuspend=yes
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
SuspendState=mem
$cat /etc/systemd/network/50-wired.link
[Match]
MACAddress=aa:aa:aa:aa:aa

[Link]
NamePolicy=kernel database onboard slot path
MACAddressPolicy=persistent
WakeOnLan=magic
$journalctl -p3 -b-0 | cat 
-- Journal begins at Fri 2021-02-12 19:17:03 CET, ends at Sat 2021-02-20 12:55:01 CET. --
lut 20 11:43:16 serverus-mediapc systemd[1]: connman.service: Two services allocated for the same bus name net.connman, refusing operation.
lut 20 11:43:16 serverus-mediapc systemd[1]: Failed to start Wait for network to be configured by ConnMan.
lut 20 11:43:18 serverus-mediapc connman-vpnd[291]: Can't load /usr/lib/connman/plugins-vpn/wireguard.so: /usr/lib/connman/plugins-vpn/wireguard.so: undefined symbol: __vpn_ipconfig_foreach
lut 20 11:43:28 serverus-mediapc smbd[773]: [2021/02/20 11:43:28.864525,  0] ../../lib/util/become_daemon.c:135(daemon_ready)
lut 20 11:43:28 serverus-mediapc smbd[773]:   daemon_ready: daemon 'smbd' finished starting up and ready to serve connections

That’s a simple hack: just change your /usr/lib/systemd/system/systemd-suspend.service to execute:

echo mem > /sys/power/state

instead of:

/usr/lib/systemd/systemd-sleep suspend

If that works, copy the /usr/lib/systemd/system/systemd-suspend.service file to /etc/systemd/system/ because you’ve just changed a Unix System Resource (usr) that could be overwritten in the next update…

:wink:

I tried messing with systemd-suspend.service in couple of ways but without much success.

When ExecStart replaced to dumb:
ExecStart=echo mem > /sys/power/state
systemctl suspend basically stop working :frowning:

When replaced to:
ExecStart=/bin/sh -c 'echo mem > /sys/power/state'
systemctl suspend was working still without wol, but that made me try out couple more approaches.

For example I figured out only way to make wol work is to make suspend by calling it by:

su -
echo mem > /sys/power/state

If I tried calling it with sudo form sh like this: sudo -u root /bin/sh -c 'echo mem > /sys/power/state' had the same behaviour as high lvl call - sleep without possibility to wol ;(

Any more ideas where the problem can be ?

:thinking:
Try:

  • creating a script in /usr/local/bin and add:

    #!/bin/bash
    echo mem > /sys/power/state
    
  • Save it as E.G. make-wol-work.sh

  • Give execute to all:

    chmod a+x /usr/local/bin/make-wol-work.sh
    
  • change ExecStart= to

    ExecStart=/usr/local/bin/make-wol-work.sh
    

:crossed_fingers:

thousand restart’s later…
:man_facepalming:
It works… but only once, the issue was resolved only partially.

Seems like I never tested fully Wake-on: g flag since suspend wasn’t working -_-

After waking up system from sleep I check the flag by calling:

 sudo ethtool enp4s0 | grep Wake         ✔            
	Supports Wake-on: pumbg
	Wake-on: g

it’s look kinda correctly, unfortunately it’s not… unless I reset the flab by hand using

sudo ethtool -s enp4s0  wol g

next suspend will not resume by sending magic package >.<

My config to set Wake-on flag is done by custom config file:

cat /etc/systemd/network/50-wired.link                      ✔ 

[Match]
MACAddress=.........

[Link]
NamePolicy=kernel database onboard slot path
MACAddressPolicy=persistent
WakeOnLan=magic

Why WOL is so hard to configure on any Linux distro when it’s so old :tired_face:

Add that command (excluding sudo) to the script on the next line.

P.S. ethtool is quite old. Try setting it with nmcli and it might persist… :crossed_fingers: