Sunday, November 3, 2019

alx driver - Reenable Wake On Lan

If you use the Linux Atheros driver alx you will very likely find that
Wake on Lan (wol) has been disabled since approximately 2013. When the
author was unable to find fixes for various wake-up issues including the
famous "wakeup twice" problem. This resulted in the author disabling wol
in alx. It turned out that the problem was not in alx at all yet instead
was within buggy firmware on the cards themselves.

Check your current alx driver:
$> sudo ethtool <ethdev,eg.enp3s0>

If you see something along the lines of:
 Supports Wake-on: d
          Wake-on: d

Then your alx has wol disabled.

You can find the history here:
https://bugzilla.kernel.org/show_bug.cgi?id=61651

The patch that disabled wol on alx was eventually reversed and found to
work perfectly. You can install the latest patch (supporting stable
kernel versions 5+) here: https://bugzilla.kernel.org/attachment.cgi?id=284877
(Right-click and choose Save Link As)

After you download it copy it to /usr/src, explode it and run setup:
$> sudo cp alx-dmks-installer-kernel5.tar.gz /usr/src
$> sudo tar xvf alx-dmks-installer-kernel5.tar.gz
$> cd alx-dmks-installer/
$> sudo ./setup

If all went well you should see a message along the lines of
DKMS: install completed.

Now install the newly patched alx driver, installed via dkms:
$> sudo modprobe -r alx && sudo modprobe alx

Note: in my testing, the above works remotely, without dropping your
connection!

Re-check your alx driver for wol support:
$> sudo ethtool <ethdev,eg.enp3s0>

You should now see something along the lines of:
 Supports Wake-on: pg
          Wake-on: g

Make sure to check that you don't have any scripts that unload the alx
driver when going to sleep, I found that I had one on my Ubuntu 19.04
system living in /usr/lib/pm-utils/sleep.d/50unload_alx
Remove any you find.

Now you can test, find your mac address and write it down:
$> ifconfig -a <ethdev,eg.enp3s0> | grep -o 'ether [^ ]*'

On your router turn on port forwarding for UDP Port 9 (Discard Protocol),
to the broadcast address (eg. 192.168.1.255).

Put your computer to sleep:
$> sudo pm-suspend

Now from another computer on the same LAN send a magic packet to the
sleeping computers MAC address on port 9 and voila! It will awaken.

No comments:

Post a Comment