You are not logged in.

#1 2015-09-07 19:03:58

_pheinrich_
Member
Registered: 2014-05-26
Posts: 53

WOL setting with systemd

Hi,

I try to set the WOL flag every time my computer is started to be able starting it up with wol again.

executing

/usr/bin/ethtool -s enp2s1 wol g

sets the Wake-on flag to 'g'

ethtool enp2s1 | grep Wake-on
        Supports Wake-on: umbg
        Wake-on: g

shutting down the computer and booting up via

wol [mac]

is working

Now I need to set the Wake-on flag every time the computer comes up.
I have installed the wol-systemd package from aur because I am using NetworkManager on a headless system.

with

systemctrl start wol@enp2s1

the flag is set correctly

BUT

enabling the systemd file fails during startup with

Sep 07 20:56:15 ThinkX40 systemd[1]: Starting Wake-on-LAN for enp2s1...
Sep 07 20:56:15 ThinkX40 ethtool[232]: Cannot get current wake-on-lan settings: No such device
Sep 07 20:56:15 ThinkX40 ethtool[232]: not setting wol
Sep 07 20:56:15 ThinkX40 systemd[1]: Started Wake-on-LAN for enp2s1.

I think that the unit gets executed too early when the interface isn't up.

I tried several After= targets without luck.

[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
Wants=network.target network-online.target
After=network.target network-online.target

[Service]
ExecStart=/usr/bin/ethtool -s %i wol g
Type=oneshot

[Install]
WantedBy=multi-user.target

Any ideas?

Last edited by _pheinrich_ (2015-09-07 19:04:25)

Offline

#2 2015-09-07 19:36:49

losko
Member
Registered: 2014-11-19
Posts: 42

Re: WOL setting with systemd

From the wiki:

/etc/systemd/system/wol@.service

[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
After=network.target

[Service]
ExecStart=/usr/bin/ethtool -s %i wol g
Type=oneshot

[Install]
WantedBy=multi-user.target

Same as my homeserver, always worked for me...


I think that the unit gets executed too early when the interface isn't up

Maybe is waiting for network-online.target

Last edited by losko (2015-09-07 19:48:08)


"Greetings from the Banana Republic"

Offline

#3 2015-09-07 20:28:00

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: WOL setting with systemd

Try 'man systemd.link'. I have never tried it myself but it should work.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2015-09-07 23:00:49

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Re: WOL setting with systemd

If you use systemd-networkd for the link configuration then you can setup WOL using [Link] config option https://wiki.archlinux.org/index.php/Wa … th_systemd  Do not use third-party systemd services for WOL.


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

Board footer

Powered by FluxBB