Wednesday, February 24, 2010

wake on lan redux

Just like my other wake on lan experience, I spent about eight hours debugging why wake on lan wouldn't work on my newly built Fedora 12 system. I went through a bunch of threads and learned something about sleep states in Linux. I also learned that ACPI has supplanted APM. ACPI is now being replaced by /sys interfaces to power states.

The network card port was getting disabled by Fedora 12 for wake on lan when the box was shutdown.

I noticed that the status of the network activity led on the network card went dark when I shut the machine down.  This means that my network card was not active and listening for incoming WOL requests.  If I removed the power cable and plugged the power cable back in, the traffic light blipped on a couple times.  For some reason then, Linux was shutting off or disabling a WOL state for the network card when I would shutdown the machine.


After much googling and testing, I found that the sleep state for my network card was disabled.  My network card's identification was found in lspci output:

[sodo@computer ~]$ lspci -tv | grep 1c
           +-1c.0-[01]----00.0  Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express

I then correlated the pci card info to acpitool output.  I found my card (1c) in the output below at #4:

[sodo@computer ~]$ acpitool -w
   Device S-state   Status   Sysfs node
  1. DWN1   S5 *disabled  pci:0000:03:00.0
  2. PE2X   S5 *disabled  pci:0000:02:00.3
  3. PEX3   S5 *disabled  pci:0000:00:03.0
  4. SBEX   S5 *disabled  pci:0000:00:1c.0
  5. COMP   S5 *disabled  pci:0000:00:1e.0

Seeing it as disabled, I could reenable it by using this command:

[sodo@computer ~]$ acpitool -W 4
   Device S-state   Status   Sysfs node
  1. DWN1   S5 *disabled  pci:0000:03:00.0
  2. PE2X   S5 *disabled  pci:0000:02:00.3
  3. PEX3   S5 *disabled  pci:0000:00:03.0
  4. SBEX   S5 *enabled  pci:0000:00:1c.0
  5. COMP   S5 *disabled  pci:0000:00:1e.0

I finally resolved my WakeOnLan issue by creating a script to do three things:
1) remove my network card module
modprobe -r tg3
2) enabling sleep states
acpitool -W 1 (and also 2-5)
3) call "shutdown -h now"

The script is simple enough, though it is a bit of a pain to manually call it.  I put an alias to "sd" in my .bashrc:
[sodo@computer ~]$ sudo cat /usr/sbin/sd
modprobe -r tg3
# sleep state for Broadcom card (#4 from acpitool output)
acpitool -W 4
/usr/sbin/shutdown -h now

A variation on the script for my new i7 box:
sudo ethtool -s p5p1 wol g
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
   sudo acpitool -W $i
sudo shutdown -h now

A second variation for my latest i9 box (note that I don't need to enable all sleep states, just the one for the card.  Not sure why I thought I needed to enable all sleep states, I was probably just being lazy):
# enable wak-on-lan
sudo ethtool -s enp10s0 wol g

# enable sleep state for Realtek card (#20 from acpitool output)
acpitool -W 20 

/usr/sbin/shutdown -h now

Previous tries
try acpi=off (in grub.conf)
get this error: nvrm failed to register with acpi subsystem
try adding mem to /sys/power/state (in rc.local)
didn't work
try init=0 (each time you shutdown)
didn't work
now that edits are done to rc.local, try resetting card with Broadcom Diagnostic CD
didn't work
try just hitting power button
didn't work

ethtool eth0
ethtool -i eth0
ethtool -s eth0 wol d
ethtool -s eth0 wol g

WakeOnLan options description
wol pumbagsd...
Sets Wake-on-LAN options. Not all devices support this. The argument to this option is a string of

characters specifying which options to enable.
p Wake on phy activity
u Wake on unicast messages
m Wake on multicast messages
b Wake on broadcast messages
a Wake on ARP
g Wake on MagicPacket(tm)
s Enable SecureOn(tm) password for MagicPacket(tm)
d Disable (wake on nothing). This option clears all previous options.

acpitool -w

[root@ogre ~]$ cat /proc/acpi/sleep
S0 S4 S5

[root@ogre ~]$ cat /sys/power/state
[root@ogre /]# acpitool -w
Device S-state Status Sysfs node
1. DWN1 S5 enabled pci:0000:03:00.0
2. PE2X S5 enabled pci:0000:02:00.3
3. PEX3 S5 enabled pci:0000:00:03.0
4. SBEX S5 enabled pci:0000:00:1c.0
5. COMP S5 enabled pci:0000:00:1e.0

[root@ogre ~]# cat /proc/acpi/wakeup
Device S-state Status Sysfs node
DWN1 S5 enabled pci:0000:03:00.0
PE2X S5 enabled pci:0000:02:00.3
PEX3 S5 enabled pci:0000:00:03.0
SBEX S5 enabled pci:0000:00:1c.0
COMP S5 enabled pci:0000:00:1e.0

[root@ogre ~]# sh -c "echo COMP > /proc/acpi/wakeup"

[root@ogre /]# lspci -tv
-[0000:00]-+-00.0 Intel Corporation 5000V Chipset Memory Controller Hub
+-02.0-[02-06]--+-00.0-[03-05]--+-00.0-[04]----00.0 3ware Inc 9650SE SATA-II RAID PCIe
+-03.0-[07]----00.0 nVidia Corporation GeForce 8800 GT
+-10.0 Intel Corporation 5000 Series Chipset FSB Registers
+-10.1 Intel Corporation 5000 Series Chipset FSB Registers
+-10.2 Intel Corporation 5000 Series Chipset FSB Registers
+-11.0 Intel Corporation 5000 Series Chipset Reserved Registers
+-13.0 Intel Corporation 5000 Series Chipset Reserved Registers
+-15.0 Intel Corporation 5000 Series Chipset FBD Registers
+-16.0 Intel Corporation 5000 Series Chipset FBD Registers
+-1c.0-[01]----00.0 Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express
+-1d.0 Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #1
+-1d.1 Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #2
+-1d.2 Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #3
+-1d.3 Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #4
+-1d.7 Intel Corporation 631xESB/632xESB/3100 Chipset EHCI USB2 Controller
+-1f.0 Intel Corporation 631xESB/632xESB/3100 Chipset LPC Interface Controller
\-1f.1 Intel Corporation 631xESB/632xESB IDE Controller

[root@ogre ~]# lsmod grep tg
tg3 105476 0
[root@ogre ~]# modinfo tg3
filename: /lib/modules/
firmware: tigon/tg3_tso5.bin
firmware: tigon/tg3_tso.bin
firmware: tigon/tg3.bin
version: 3.99
license: GPL
description: Broadcom Tigon3 ethernet driver
author: David S. Miller ( and Jeff Garzik (
srcversion: 5B5CB8F28F8498838A4DBA7
alias: pci:v0000106Bd00001645sv*sd*bc*sc*i*
alias: pci:v0000173Bd000003EAsv*sd*bc*sc*i*
alias: pci:v0000173Bd000003EBsv*sd*bc*sc*i*
alias: pci:v0000173Bd000003E9sv*sd*bc*sc*i*
alias: pci:v0000173Bd000003E8sv*sd*bc*sc*i*
alias: pci:v00001148d00004500sv*sd*bc*sc*i*
alias: pci:v00001148d00004400sv*sd*bc*sc*i*
alias: pci:v000014E4d0000168Csv*sd*bc*sc*i*
alias: pci:v000014E4d00001694sv*sd*bc*sc*i*
alias: pci:v000014E4d00001690sv*sd*bc*sc*i*
alias: pci:v000014E4d00001692sv*sd*bc*sc*i*
alias: pci:v000014E4d00001699sv*sd*bc*sc*i*
alias: pci:v000014E4d00001689sv*sd*bc*sc*i*
alias: pci:v000014E4d00001688sv*sd*bc*sc*i*
alias: pci:v000014E4d00001680sv*sd*bc*sc*i*
alias: pci:v000014E4d00001681sv*sd*bc*sc*i*
alias: pci:v000014E4d0000165Bsv*sd*bc*sc*i*
alias: pci:v000014E4d00001684sv*sd*bc*sc*i*
alias: pci:v000014E4d00001698sv*sd*bc*sc*i*
alias: pci:v000014E4d00001713sv*sd*bc*sc*i*
alias: pci:v000014E4d00001712sv*sd*bc*sc*i*
alias: pci:v000014E4d000016DDsv*sd*bc*sc*i*
alias: pci:v000014E4d0000166Bsv*sd*bc*sc*i*
alias: pci:v000014E4d0000166Asv*sd*bc*sc*i*
alias: pci:v000014E4d00001679sv*sd*bc*sc*i*
alias: pci:v000014E4d00001678sv*sd*bc*sc*i*
alias: pci:v000014E4d00001669sv*sd*bc*sc*i*
alias: pci:v000014E4d00001668sv*sd*bc*sc*i*
alias: pci:v000014E4d0000167Fsv*sd*bc*sc*i*
alias: pci:v000014E4d00001693sv*sd*bc*sc*i*
alias: pci:v000014E4d0000169Bsv*sd*bc*sc*i*
alias: pci:v000014E4d0000169Asv*sd*bc*sc*i*
alias: pci:v000014E4d00001674sv*sd*bc*sc*i*
alias: pci:v000014E4d00001673sv*sd*bc*sc*i*
alias: pci:v000014E4d0000167Bsv*sd*bc*sc*i*
alias: pci:v000014E4d00001672sv*sd*bc*sc*i*
alias: pci:v000014E4d0000167Asv*sd*bc*sc*i*
alias: pci:v000014E4d000016FEsv*sd*bc*sc*i*
alias: pci:v000014E4d000016FDsv*sd*bc*sc*i*
alias: pci:v000014E4d000016F7sv*sd*bc*sc*i*
alias: pci:v000014E4d00001601sv*sd*bc*sc*i*
alias: pci:v000014E4d00001600sv*sd*bc*sc*i*
alias: pci:v000014E4d0000167Esv*sd*bc*sc*i*
alias: pci:v000014E4d0000167Dsv*sd*bc*sc*i*
alias: pci:v000014E4d0000167Csv*sd*bc*sc*i*
alias: pci:v000014E4d00001677sv*sd*bc*sc*i*
alias: pci:v000014E4d00001676sv*sd*bc*sc*i*
alias: pci:v000014E4d0000165Asv*sd*bc*sc*i*
alias: pci:v000014E4d00001659sv*sd*bc*sc*i*
alias: pci:v000014E4d00001658sv*sd*bc*sc*i*
alias: pci:v000014E4d0000166Esv*sd*bc*sc*i*
alias: pci:v000014E4d00001649sv*sd*bc*sc*i*
alias: pci:v000014E4d0000170Esv*sd*bc*sc*i*
alias: pci:v000014E4d0000170Dsv*sd*bc*sc*i*
alias: pci:v000014E4d0000169Dsv*sd*bc*sc*i*
alias: pci:v000014E4d0000169Csv*sd*bc*sc*i*
alias: pci:v000014E4d00001696sv*sd*bc*sc*i*
alias: pci:v000014E4d000016C7sv*sd*bc*sc*i*
alias: pci:v000014E4d000016C6sv*sd*bc*sc*i*
alias: pci:v000014E4d000016A8sv*sd*bc*sc*i*
alias: pci:v000014E4d000016A7sv*sd*bc*sc*i*
alias: pci:v000014E4d000016A6sv*sd*bc*sc*i*
alias: pci:v000014E4d0000165Esv*sd*bc*sc*i*
alias: pci:v000014E4d0000165Dsv*sd*bc*sc*i*
alias: pci:v000014E4d00001654sv*sd*bc*sc*i*
alias: pci:v000014E4d00001653sv*sd*bc*sc*i*
alias: pci:v000014E4d0000164Dsv*sd*bc*sc*i*
alias: pci:v000014E4d00001648sv*sd*bc*sc*i*
alias: pci:v000014E4d00001647sv*sd*bc*sc*i*
alias: pci:v000014E4d00001646sv*sd*bc*sc*i*
alias: pci:v000014E4d00001645sv*sd*bc*sc*i*
alias: pci:v000014E4d00001644sv*sd*bc*sc*i*
vermagic: SMP mod_unload
parm: tg3_debug:Tigon3 bitmapped debugging message enable value (int)

HOWTO: Set your system up for Wake On LAN (WOL)

Fedora List of Kernel Parameters
NOTE: The full list of kernel options is in the file /usr/share/doc/kernel-doc-/Documentation/kernel-parameters.txt, which is installed with the kernel-doc package.


smartgrid said...

We have 4 of these, and you have saved us a lot of trouble.

Can we get an updated list/round up on which video cards are working. we have been watching your videos as well :)

Cacasodo said...


ATI-based cards:
ATI Radeon hd4630
ATI x300
ATI x1550
VisionTek X1550 Radeon Pci 256MB VGA
Sapphire x1950GT 512mb card
Sapphire Radeon HD 4850

NVidia-based cards:
NVidia BFG 8800GT
NVidia BFG 8500GT
EVGA GeForce 9400GT 512MB PCI
NVidia BFG 9600GT
BFG Tech GeForce 9800GT 512MB

Feel free to drop me a line or ask me a question.