# Wake on lan not working after suspend to ram [SOLVED]

## Treovo

I am currently trying to cut down on electricity by having a server suspending to ram whenever idle for too long.

Suspend to RAM works perfectly, the  ethernet card lights shortly turn off and on again, signaling the ethernet card is still powered on an listening to magic packets. When sending packets to the card is can see the green light shortly blink  but the computre does not wake up.

If I press the power button the computer immediately start up again.

Why is WOL not working when the computer is suspended even when packets seems to be correctly received by the ethernet card? If I poweroff the computer wake on lan works without a hitch a the computer boots up fine.

I am using tuxonice-sources-2-6-24-r9.

I alsoI added 

```
 /usr/sbin/ethtool eth0 wol g
```

 to /etc/conf.d/local.stop to make sure that the ethernet card is not turned off when suspending, which obviously works as the lights are one and the card blinks upon receiving packets.

I can't think of any reason why the computer would not resume upon wake on lan as the card is clearly receiving packets for waking up the computer.

Any ideas?

Thanks

----------

## cwr

On my laptop I've found a number of drivers don't re-activate correctly after

suspending; sound and modem drivers being two of them.  I wouldn't expect

that problem with an ethernet driver, but it seems possible.

Will

----------

## Treovo

Thanks for your hint.

The problem is not that some drivers do not reactivate correctly but that the system does not wake up from suspend at all upon receiving magic packets.

Actually there is no reactivation at all as the system remains in suspended mode until the power button is pressed.

----------

## Treovo

I have been trying multiple setups with 2 different cards:

- compile drivers as modules and unload them when suspending via the option in /etc/hibernate/common.conf

- add and suppress /usr/sbin/ethtool -s eth0 wol g from /etc/init.d/local.start and /etc/init.d/local.stop

- tried a different kernel

I am always stuck with an ethernet card which receives a magic packet and shortly blinks, but the computer does not restart. I still need to press on the power button to bring it to life again.

I have been searching a lot around and cannot seem to find a solution for this particular issue.

Any help much appreciated. Thxs.

EDIT 

Well, it seems that you always write this kind of post minutes before finding the solution...  :Smile: 

For the sake of documentation and for all people looking for help on how to make wake on lan (call it wakeonlan or even wake-on-lan) work with suspend to disk/ram:

Various things are to be considered.

1) the actions run by /etc/hibernate/common.conf

Make sure you append here 

```
OnSuspend 10 /usr/sbin/ethtool -s eth0 wol g
```

 (replace eth0 and wol g by the appropriate parameters). This ensures that every time the hibernate script is called, the status of the ethernet card is set to wake on lan.

Additionally you can also append 

```
 OnResume 10 /usr/sbin/ethtool -s eth0 wol g
```

 which does the same every time the computer is brought back to life.

You can also add 

```
/usr/sbin/ethtool -s eth0 wol g
```

 to /etc/conf.d/local.start and /etc/conf.d/local.stop, which should actually have the same effect.

This should prevent for example your card not being in wol mode after one suspend cycle.

2) the different modes into your computer can hibernate:

You can choose here different options in case you have a broken BIOS. 

```
echo platform > /sys/power/disk
```

 should ensure that you are using the right method.

3) the status of the interface as set by /etc/conf.d/rc

As a matter of fact and depending on your card, setting the variable RC_DOWN_INTERFACE to "yes" in /etc/conf.d/rc might produce the opposite effect and keep it alive while a "no" will bring it down with every suspend cycle.

4) the fact that your ethernet card is allowed to wake up the computer (this one is pretty often overseen):

```
cat /proc/acpi/wakeup
```

 will show you the different component and their ability to wake up the system. Here in my computer th eresult looks like:

```
Device   S-state     Status   Sysfs node

P0P1     S4    disabled  

P0P3     S4    enabled   pci:0000:00:1e.0

P0P4     S4    disabled  pci:0000:00:1c.0

PCE2     S4    enabled   

P0P5     S4    disabled  

P0P6     S4    disabled  

P0P7     S4    disabled  

P0P8     S4    disabled  pci:0000:00:1c.4

P0P9     S4    disabled  pci:0000:00:1c.5

LANB     S4    enabled   pci:0000:02:00.0

USB1     S4    disabled  pci:0000:00:1d.0

USB2     S4    disabled  pci:0000:00:1d.1

USB3     S4    disabled  

USB4     S4    disabled  

EUSB     S4    disabled  pci:0000:00:1d.7

MC97     S4    disabled 
```

As you can see LANB is enabled to wake up the system from an S4 state (which by the way also allows it to wake up the computer from an S3...)

A simple

```
 echo -n LANB  > /proc/acpi/wakeup
```

 will change the status from disabled to enabled.

Don't hesitate to combine different options in /etc/hibernate/common.conf.

From my experience, if you suspend your computer,  the lights of the ethernet cards are on and they do blink when sending a wake up magic packet then your computer should wake up. If it is not, you probably forgot to enable your ethernet card to wake up the computer in /proc/acpi/wakeup as mentioned above.

Hope this will help someone. Please correct the above as you see fit if there are any mistakes.

----------

