4

I have a PC that has a Windows 8 partition and an Ubuntu 13.04 partition. I am trying to get wake-on-lan to work. Everything works fine on the Windows 8 partition: I can wake-on-lan from both the sleep state and the shutdown state. However, when I shutdown Ubuntu using:

sudo shutdown -h now

I cannot wake the PC through my LAN. Is this because the network interface is getting turned off? What command can I use or how can I reconfigure Ubuntu so that wake-on-lan still works?

Also, if I do not use the -h option in the shutdown command, the PC does not actually shutdown; it just freezes up on me.

Using ethtool, I found that it says:

Supports Wake-on: pumbg
Wake-on: g
...
Link detected: yes

My etc/network/interfaces says this:

auto eth0
iface eth0 inet dhcp
      up ethtool -s eth0 wol g

EDIT: I have found that if I shut down the PC by simply holding the power button, then wol works. If I shutdown using the command line or through the Ubunutu GUI, then it does not work. So I think the issue is not that it is not being setup properly, but that something is overriding it or shutting it off when I shut down properly. Are there are any scripts that get run at shutdown?

I have added

NETDOWN=no

to both etc/default/halt and etc/init.d/halt

mushroom
  • 111
  • 7

2 Answers2

2

Your commands are close, but try this in command line:

sudo ethtool -s <NIC> wol g

or add this to your /etc/network/interfaces file:

auto eth0
iface eth0 inet dhcp
    up ethtool -s eth0 wol g

'g' enables wake via "Magic Packet"

Looks like if you are shutting down using the following command:

sudo shutdown -h now  

then you will also need to edit your /etc/default/halt file. Add the following line:

NETDOWN=no

and see if that works. That should prevent the -h (halt) from shutting down the network interfaces.

kbuilds
  • 1,535
  • 2
  • 13
  • 18
  • See updates. I use g now. Still doesn't work if I shut down through CLI, but apparently works if hold down power button. – mushroom Sep 14 '13 at 18:02
  • See edit. I am determined to solve this one, haha – kbuilds Sep 14 '13 at 21:51
  • It actually did not work. I added that to both /etc/default/halt and /etc/init.d/halt. Thanks for your persistence. – mushroom Sep 14 '13 at 23:47
  • No problem, dude. Can you confirm that running the command `sudo ethtool -s eth0 wol g` then shutting down does not help WOL work? – kbuilds Sep 16 '13 at 00:44
  • Yep. Confirmed. Only works when I hold down power button or when I shutdown from Windows 8. – mushroom Sep 16 '13 at 01:49
1

this is how I got mine working (just done this this morning)

I created a file as root/sudo in /etc/init.d/ called wakeonlanconfig with the following in it

#! /bin/bash
ethtool -s eth0 wol g
exit

then I set the permissions on this file to

sudo chmod a+x wakeonlanconfig

then to make sure it executed on startup I did

sudo update-rc.d -f wakeonlanconfig defaults

and rebooted the machine, powered it down again and then from another machine on the network used the wakeonlan command to startup it up again

wakeonlan <mac address of machine to be woken up>

hey presto machine booted up, hope this helps

apacheuk
  • 928
  • 5
  • 9
  • You should be able to make the WOL setting permanent by adding the setting to your /etc/network/interfaces file rather than creating a new init script. This method also works though – kbuilds Sep 14 '13 at 13:11