Some time ago I noticed that I could no longer boot a remote machine via Wake-on-LAN. This annoyed me quite a bit, as the machine was 2100km away and there was nobody at that location who could boot it for me. I really had no clue why it stopped working. So when I recently arrived at the location again, I started looking into it. Everything I had previously configured was still in place. The BIOS option Power On by PCIE devices was enabled, and I still had this in /etc/local.d/wol.start:

#!/bin/sh

ethtool -s eth0 wol g

echo "GBE" > /proc/acpi/wakeup

Yet, when I ran ethtool eth0, it showed that WOL was disabled:

Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on (auto)
        Supports Wake-on: pumbg
        <strong>Wake-on: b</strong>
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

I manually ran ethtool -s eth0 wol g and verified, now it was enabled:

Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on (auto)
        Supports Wake-on: pumbg
        <strong>Wake-on: g</strong>
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

Then I verified in /proc/acpi/wakeup if the PCIe device was allowed to wake the system:

taz ~ # cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
UAR1      S4    *disabled  pnp:00:05
PS2K      S4    *disabled
PS2M      S4    *disabled
BR20      S3    *disabled  pci:0000:00:1e.0
EUSB      S4    *enabled   pci:0000:00:1d.0
USBE      S4    *enabled   pci:0000:00:1a.0
NPE1      S4    *disabled  pci:0000:00:01.0
NPE3      S4    *disabled  pci:0000:00:02.0
NPE4      S4    *disabled
NPE5      S4    *disabled
NPE6      S4    *disabled
NPE7      S4    *disabled  pci:0000:00:03.0
NPE8      S4    *disabled
NPE9      S4    *disabled
NPEA      S4    *disabled
PEX0      S4    *disabled  pci:0000:00:1c.0
PEX1      S4    *disabled  pci:0000:00:1c.1
PEX2      S4    *disabled  pci:0000:00:1c.2
PEX3      S4    *disabled
PEX4      S4    *disabled  pci:0000:00:1c.4
PEX5      S4    *disabled  pci:0000:00:1c.5
PEX6      S4    *disabled
PEX7      S4    *disabled  pci:0000:00:1c.7
<strong>GBE       S4    *enabled   pci:0000:00:19.0</strong>
NPE2      S4    *disabled  pci:0000:00:01.1
SLPB      S0    *disabled
PWRB      S4    *enabled   platform:PNP0C0C:00

All good, so I shut down the machine and tried to wake it via a Wake-on-LAN magic packet, by running this on my OpenWrt router: etherwake -i br-lan 10:bf:48:d5:44:b8. The machine booted, and I was happy. But then I ran ethtool again, and noticed Wake-on-LAN was again disabled. I verified that the startup script was actually executed by inserting an echo to a file in it and rebooting again. This confirmed that the startup script was working. So there must be something that toggles the WOL state after the startup script has been executed. Suspect number 1: NetworkManager. Started searching the web and quickly found an explanation. As you can read in the NetworkManager 1.0.6 release announcement, it now supports configuring Wake-on-LAN capabilities of Ethernet hardware. So I checked if I had recently updated NetworkManager, and according to qlop -gHv networkmanager that was indeed the case:

networkmanager-1.0.6: Tue Oct 13 05:23:19 2015: 1 minute, 53 seconds

Then I checked the Wake-on-LAN setting for my connection with nmcli c show 713b0ecf-fc5e-4387-99bd-4dceedd0027b | grep wake-on-lan:

802-3-ethernet.wake-on-lan:             default
802-3-ethernet.wake-on-lan-password:    --

Changed it to magic with nmcli c modify 713b0ecf-fc5e-4387-99bd-4dceedd0027b 802-3-ethernet.wake-on-lan magic and verified with ethtool. It still showed as disabled, so I disconnected and reconnected the connection via plasma-nm, verified again with ethtool and now WOL was enabled. Shutdown, etherwake, check WOL state in ethtool, all good. Yay.