how to enable wake on lan / why ETHTOOL_OPTS don't work?

Hi, I’m trying to make wake-on-lan permamently enabled, but I fail to do this properly on tumbleweed. My all previous systems with whateverbuntu had this “g” option enabled by default, but tumbleweed have not. My card supports it, but it has to be configured by ethtool prior shutdown, if I forget, I’m unable to wake remotely since then. So before every shutdown I have to run

sudo ethtool -s enp31s0 wol g

I found, that network sysconfig should be edited to set ethtool options, so I put ETHTOOL_OPTS on last line:

me@pc:/etc/sysconfig/network> sudo cat ifcfg-enp31s0
BOOTPROTO='none'
STARTMODE='auto'
IPADDR=''
NETMASK=''
PREFIXLEN=''
ZONE=public
ETHTOOL_OPTS='wol g'

But for some reason it does not set the option, or maybe there’s something which later resets it, after reboot g is not enabled again (I tried with double quotes too). Opensuse does not have simple rc.local, and systemd script look way too complicated for me to run one single command, so how I can run ethtool with ‘wol g’ options properly? I hope it is not this https://lists.opensuse.org/opensuse-bugs/2016-02/msg02853.html bug two years old :sarcastic:

Btw. I tried the networkmanager dispatcher script (I have it chmod+xed) as suggested by the user reporting the bug, but it does not work for me :’(

me@pc:~> cat /etc/NetworkManager/dispatcher.d/wol
#!/bin/bash
#
# wol dispatcher script for NetworkManager
#
#
if  "$2" = "up" -a "$1" = "enp31s0" ]; then
sleep 2
/usr/sbin/ethtool -s enp31s0 wol g
fi

Maybe the bug still lasts, but perhaps config files were changed over again… Another solution comes to your mind? Thank you.

If you use Networkmanager, it is of no use to set parameters in ifcfg-* files, because they are used by wicked, not by NM.

Thank you for reply. I use whatever opensuse tumbleweed with lxde uses. That means I have no idea what I’m using :shame:

I have tried to put the (modified) script also elsewhere, interface name seems to be in $2 in network sysconfig:

me@pc:~> cat /etc/sysconfig/network/if-up.d/wol
#!/bin/bash
#
# wol dispatcher script for NetworkManager
#
#
if  "$2" = "enp31s0" ]; then
sleep 2
/usr/sbin/ethtool -s enp31s0 wol g
fi

But it does not do a thing too :frowning: The goal is to set wol g parameter once the network interface (enp31s0) comes up. How to do this?

Do you have a BIOS setting for enabling this WoL function by chance? That might render that need to employ a script redundant.

If not, you might try taking advantage of systemd and implement it as a script located in /usr/lib/systemd/system-shutdown, so that WoL is set before power off perhaps. If you want to trigger a wake from suspend, put the script in the /usr/lib/systemd/system-sleep/ directory instead. (I guess a symlink to the script could be used if both are required.)

This has nothing to do with it being Tumbleweed and/or which DE you use.

When it is a “walking around” system like a laptop, most use NetworkManager (and it is then the default chosen on installation), when it is more a desktop/ computer room system, wicked is the way to go.

YaST > Network Devices > Network Settings will show you on the Global tab what is used.

You probably use NM. And then all in /etc/sysconfig/network is NOT used.

When you say that you have copied a script “elsewhere”, that is of no use to anybody here. We need hard names.

I guess you best follow deano_ferrari’s advice or wait for a NM guru to show up (I do not use it).

Actually, the NM dispatcher script he mentioned was mentioned in the mailing list archive he linked to. It’s not obvious to me why it didn’t do the trick though.

@pruda:

Oh, just put that in /etc/init.d/halt.local. systemd’s unit halt-local will run it each time at shutdown after the next reboot (reboot twice the first time to wol up the machine). halt.local has to be executable.

wicked supports that (I tested with ‘wol d’). However, it does not use /usr/sbin/ethtool. Probably wicked does the settings itself.

If you really want to debug this setting, then edit /etc/sysconfig/network/config and set WICKED_DEBUG=‘all’ and WICKED_LOG_LEVEL=‘debug3’. Reboot and then have a look at journalctl -u wicked, type ‘/’ and enter ‘(wol|wake-on-lan)’ (no quotes) to search for wol and wake-on-lan.

But I suppose halt.local suffices because it works (it should) with wicked and networkmanager.

Kind regards,

Leen

Hi and thank you all for replies.

I guess I have everything set fine, when it was windows only computer, it waked just fine (after installing manufacturer driver, the one which came with windows installation wasn’t waking, but it’s pretty common, windows lan drivers probably have wake on lan disabled and ignore what you set in lan card preferences.)

Tried to put ethtool script there with hard coded interface name, marked executable, but it did not change wake on lan too. Strange.

I’m sorry, I thought it is obvious from the first line of pasted “code” where I put it

me@pc:~> cat /etc/sysconfig/network/if-up.d/wol

I surely tried, but the mentioned “trick” does not work for me.

Thank you for hint, it looks promising. I will test it week after next sunday, right now I’m away from the computer, so I cannot test it, because I can work with it only remotely and rely on running ethtool manually before shutdown, which is tested to be working.

Hi again, so I placed ethtool -s enp31s0 wol g into /etc/init.d/halt.local but it does not have any effect, computer won’t wake over lan.

Strange thing is, that when I boot to windows partition and shutdown windows, wake on lan works fine. On linux I have to run ethtool prior shutdown, or I never wake up remotely again. Any other ideas please?

While there is service to run this file on shutdown, this service itself is not pulled in by anything, nor does it have Install section. So as far as I can tell this script is ignored by default. This is arguably a bug by itself.

Did you enable the service first?

systemctl enable halt.local

That should result with

halt.local.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable halt.local

Following the next boot, this should be reported

# systemctl status halt.local  
● halt.local.service
   Loaded: loaded (/etc/init.d/halt.local; generated; vendor preset: disabled)
   Active: active (exited) since Sun 2018-08-05 18:32:52 NZST; 4min 4s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/halt.local.service

That is red herring. This service cannot be enabled in “normal” way.

Loaded: loaded (/etc/init.d/halt.local; **generated**;

Yes, I forgot that service is “enabled” dynamically by generator, thanks. Which means after creating executable script /etc/init.d/halt.local one needs to either reboot or to run “systemctl daemon-reload”.

hi just to share the solution i found to get NM permanent settled as wol enabled.

first discover your uuid with

nmcli connection

then

nmcli connection modify <your uuid> 802-3-ethernet.wake-on-lan magic

hope it also helps someone else

Hi, sorry for hijacking this old thread, but after some time with ubuntu, where wake on lan worked on the very same system out of the box, I have returned to opensuse tumbleweed again and now it works without configuring anything too. What seems to work across machines / distros is this:

sudo nano /etc/systemd/network/50-wired.link
[Match]
MACAddress=*aa:bb:cc:dd:ee:ff*

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

source: https://wiki.archlinux.org/index.php/Wake-on-LAN