Out of the box I tend to find WOL under Ubuntu will not work, despite WOL being enabled in a PC's BIOS. The way I've often resolved this is to install ethtool which allows the querying settings of an ethernet device and the changing of settings. Read on...
To install ethtool either use the Ubuntu package manager or manually run:
sudo apt-get install ethtool
Then query your ethernet device to check it supports WOL :
sudo ethtool eth0
If you see "Supports Wake-on: g" then you're supported
To enable WOL you will likely need to stick the following line into your /etc/rc.local file, this sets up the ethernet card to respond to WOL magic packets. The command does not appear to be persistent hence it needs to be run as part of every boot:
sudo ethtool -s eth0 wol g
Updated March 2012: As per rokafeller's comment below WOL can work on the Microserver under Ubuntu (10.04, 10.10 and 11.10, not sure about 11.04) with some simple tweaking. To get WOL to work the ethernet interface must be properly brought down as part of the system shutdown. This should be performed as part of run levels rc0 and rc6, noting that Linux typically has 7 different run levels (or operating modes):
- rc0.d - System Halted
- rc1.d - Single User Mode
- rc2.d - Single User Mode with Networking
- rc3.d - Multi-User Mode - boot up in text mode
- rc4.d - Not yet Defined
- rc5.d - Multi-User Mode - boot up in X Windows
- rc6.d - Shutdown & Reboot
sudo vi /etc/rc6.d/K99wol_poweroff
It may contain:
#!/bin/bash
ifconfig eth0 down
poweroff
Change the script's permissions to make it executable:
sudo chmod 755 /etc/rc6.d/K9ls /etc/rc0.d/K99wol_poweroff
Copy the script to work on system halt as well:
sudo cp /etc/rc6.d/wol_poweroff.sh /etc/rc0.d/K99wol_poweroff
Change permissions to make it executable:
sudo chmod 755 /etc/rc0.d/K99wol_poweroff
Job done.
To test power down the machine, sudo shutdown now or sudo poweroff , and use your favourite WOL tool to send a magic packet. Thanks to rockafeller and everyone else who have commented with various solutions.
Note I've found in my case the script must start with K## where ## is the scripts priority number 99 means that it is one of the last script to run in the rc# directory.
Comment prior to the March 2012 update: Sadly on the HP Microserver this [working WOL] isn't currently the case. Wake On Lan has proven to be an issue on the Microserver despite making the appropriate setting changes I have been unable to get WOL working under *nix and have not been able to find anyone on the internet with a solution on people with similar issues.The Microserver uses a Broadcom BCM5732 ethernet chipset which uses the Broadcom maintained Tg3 drivers these are now the only drivers that Broadcom maintain for *nix.
It's apparent that this is a common issue for the BCM5732 under *nix, under Windows people are reporting success with WOL depending on the flavour of Windows. So it looks like I'll be hanging on for a driver update from Broadcom that will enable WOL under *nix.
just stumbled across your post as I googled for help on the exact same topic (i.e. Ubuntu 11.04 on HP N36L microserver). Like you, I have no luck after making all the documented changes. :(
ReplyDeletePlease post back if you find a solution, Thanks
ReplyDeleteSome people have reportedly managed to get this working on Ubuntu following this post. I've no idea as to why it works for some and not me.
What's odd on mine is that it was working fine, so I know Ubuntu 11.04 and it's driver supported it without any tweaking on my part, but it simply stopped working suddenly despite being enabled in the BIOS. Even stranger is that I have a second Microserver with an identical installation and it continues to wake up without issue.
ReplyDeleteFinally got it working in 11.10....
ReplyDeleteI had to add this line to /etc/rc.local
echo PCE6 > /proc/acpi/wakeup
I also have NETDOWN=no in /etc/init.d/halt, not sure if this is needed, but probably.
Thanks will give that a try and report back.
ReplyDeleteJust wanted to say that I had hibernate working, then it stopped, but I added the two lines posted by Anonymous above and it is now working again so thanks for that!
ReplyDeleteFurther to Finally got it working in 11.10...
ReplyDeleteThe final bug I found causing problems with wol is network-manager in Gnome.
The solution (in addition to adding the lines three posts back), is to remove network-manager entirely and use a static IP address. Or you can install an alternative network manager like 'wicd' which doesn't interfere with wol.
To remove network-manager:
sudo apt-get --purge remove network-manager gnome-network-manager
(sudo apt-get --purge remove modemmanager won't hurt either)
To setup a static IP address, add your IP configuration choice to /etc/network/interfaces, for example:
auto eth0
iface eth0 inet static
address 10.0.0.3
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.2
/etc/resolv.conf should have something like:
nameserver 10.0.0.2
(or possibly your ISPs nameservers)
Make sure you have added the static ip address with your MAC address to the router (outside the DHCP range), then issue the following command to reload the network with the new IP address:
sudo /etc/init.d/networking restart
For WOL over the internet, configure your router to forward the WOL port (usually port 9 UDP) to your static IP address if you use NAT.
If you use a firewall make sure that the same port is open too.
Use http://wakeonlan.me to test.
Thanks for this, it's very helpful I've yet to play about with the fixes for this - as soon as I do I'll comment back.
ReplyDeleteI cannot get WOL to work at all. WOL is enabled in the BIOS and I've tired everything in this post. I've used a packet sniffer to check that the magic packet is reaching the server - it is.
ReplyDeleteI wonder whether I need to update the NW device driver. I see there are drivers on the HP site (link below) for Red Hat and SUSE... does anyone know if these will work with Ubuntu? I'm a noob to linux so am not sure how to go about trying / rolling back if things break.
http://h20000.www2.hp.com/bizsupport/TechSupport/DriverDownload.jsp?lang=en&cc=uk&prodNameId=3811493&taskId=135&prodTypeId=329290&prodSeriesId=3811492&lang=en&cc=uk
WOL now working on Ubuntu 11.10 on microserver.
ReplyDeleteI couldn't get WOL working as well with microserver and ubuntu 11.10 with tricks posted here, and i did what suggested on this other website:
http://www.bios-mods.com/forum/Thread-HP-Proliant-Microserver-AMI-BIOS-MOD?page=3
The forum refers to a modded bios which I DIDN'T flash; mine is plain factory HP bios. The trick still works.
The point is that when turning off the server, the poweroff helper apparently doesn't properly shut down the interface, losing the wol setting.
the interface, to preserve wol capability, must be turned off with 'ifconfig eth0 down' command.
I simply created a wol_poweroff.sh script that
1) shuts properly down interface eth0
2) powers off the system
#!/bin/sh
ifconfig eth0 down
poweroff
when the server is shut this way, wol works.
to be sure eth0 is brought back online with wol capability at boot time, I also added the following two lines to my /etc/rc.local
ifconfig eth0 up # turn the interface on
ethtool -s eth0 wol g # enable wol
Probably there are smarter ways to do this, ie. avoiding the custom poweroff script, ie. tweaking some other files ubuntu runs during shutdown.. if you have any suggestions on this they're very welcome.
Sorry your original post seemed to have been caught by a spam filter, now retrieved and restored thanks for your input.
DeleteI managed it to get it working on Microserver + Ubuntu 11.10.
ReplyDeleteThe trick is to force a proper shutdown of the ethernet interface before system shutdown.
you can create a trivial "wol_poweroff.sh" like this, and use it to shutdown the microserver:
#!/bin/bash
ifconfig eth0 down
otherwise you can force the ifconfig eth0 down command in the shutdown routines, by putting in a script file inside /etc/rc6.d/ and /etc/rc0.d/. This way the normal poweroff command will allow you to enjoy wol as well.
the "wol_poweroff.sh" is
Delete#!/bin/bash
ifconfig eth0 down
poweroff
Thanks rokafeller, confirmed this works on Ubuntu 10.04 LTS.
ReplyDeleteFirstly, thank you for this post. I've just spent about 3 hours trying to figure out why "ifconfig eth0 down" allowed my WOL to work and the answer is so obvious now.... for some reason my start up/shutdown scripts didn't have the right priorities. My "/etc/init.d/halt" script was set as "/etc/rc0.d/S03halt" and my "/etc/init.d/networking" script was set to "/etc/rc0.d/S03networking" meaning that the system would run the halt script before (or in parallel to) the networking script (given both have a priority of 03). I checked on both my laptop and another PC and the their halt scripts are set to "S90halt" so it'd be the last thing to run.
ReplyDeleteAfter changing the halt script to "/etc/rc0.d/S90halt" my WOL now work without the need for an "ifconfig eth0 down" script.
It might be worth checking this on your system to see if it's a bug with Ubuntu server version (both my other PC's are the desktop version).
I actually have the same situation on Ubuntu server 11.10.
Delete/etc/rc0.d/S01halt and /etc/rc0.d/S01networking have the same priority. I'll try to move the halt priority to 90 as you suggest and let you know
If that's the case you might, if you haven't already, want to check the other script priorities. I found that almost everything was set to priority 03, meaning S03networking would execute before S03umountnfs (umounting network filesystems), which obivously isn't want you want. The logical order of these scripts seems to have been messed up somewhere along the line. I've changed my rc0.d and rc6.d scripts to the following (which is the same order as they are on my laptop and desktop machines):
Delete/etc/rc0.d/:
K01apache2
K01webmin
K01winbind
K02mdadm
README
S10unattended-upgrades
S20sendsigs
S30urandom
S31umountnfs.sh
S35networking
S40umountfs
S48cryptdisks
S59cryptdisks-early
S60umountroot
S90halt
/etc/rc6.d/:
K01apache2
K01webmin
K01winbind
K02mdadm
README
S10unattended-upgrades
S20sendsigs
S30urandom
S31umountnfs.sh
S35networking
S40umountfs
S48cryptdisks
S59cryptdisks-early
S60umountroot
S90reboot
This seems to work fine and if anything boot up time has decreased (probably because everything's being shutdown properly now!).
P.S. I only changed the priorities on the start scripts, however, having given this another look I might change the kill scripts too as it seems to be shutting down apache before webmin!
Dude, on my ubuntu server all the Sxx script priorities in /etc/rc.0 and /etc/rc.6 were messed up. I followed your precious suggestions and now everything's running fine with wol as well without any additional eth down commands/scripts.
ReplyDeleteI don't have apache running, but everything in the Kxx looks overlapping.. anyway not a big deal here - independent p2p services mainly
thanks
My halt script has always been S90halt my networking script is S35networking and I still have issues with WOL. I'll keep the custom eth down script for the time being as a solution. It's strange that with seemingly correct shutdown script priorities I still need the custom eth down commands, hey ho at least it now works.
ReplyDeleteTHANK YOU!!!!!! I've searched all over the internet for this...stumbling across the craziest solutions, that never worked. So a few things
ReplyDelete1) Thank you...seriously...you have no idea how badly I needed this
2) I don't believe this is NetworkManager related, as some have speculated, because Ubuntu Server doesn't install it. However, both Desktop and Server install the ifupdown package for controlling the network interfaces, so I suspect that's the application causing the issue.
3) I work for Canonical as the Director of Engineering for Ubuntu Server, so I should be able to help get this fixed. I've opened a bug:
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/981461
and flipped the necessary switches to keep it on the radar.
I was struggling for 2 hours to setup 12.04 with WOL on D945GSEJT (mini-itx) and none of these tricks worked. Finally I found some other thread on instability of built-in NIC driver so I decided to give a try to the receipt from that blog:
ReplyDeletehttp://djlab.com/2010/10/fixing-rtl8111-8168b-driver-debian-ubuntu/
and wakeup-on-lan WORKS NOW without any hocus-pocus changes to system configuration :)
Good to hear you solved your problem, although I think it's slightly different to the one experienced in this post. The driver you refer to is for a Realtek chipset whilst the N36L and N40L use Broadcom chipset and TG3. That said thanks for posting and I hope anyone with issues on an Realtek 8168/8169 chipset are enlightened with your link.
DeleteYou are right, sorry for offtopic in this context; part of discussion was quite generic and I just wanted to say that sometimes problem may be release+driver specific.
DeleteI also got now WOL working on the HP Proliant Microserver under Ubuntu 11.10.
ReplyDeleteI think I'm getting the bigger picture now. One main problem is that the network interface is not disabled at shutdown.
Usually it gets disabled at entering runlevel 0 and executing /etc/rc0.d/S35networking. This script calls "ifdown -a". Which means it would go through all networking interfaces specified in /etc/network/interfaces and shut them down.
One error cause is an incorrect priority of this script as described by [Anonymous18 March 2012 22:08]. However, in my Ubuntu 11.10 installation the priority is correct.
My error cause was the one described by [Anonymous18 November 2011 14:13]: Because Ubuntu uses the (Gnome) network manager, the ethernet interface eth0 does not show up in /etc/network/interfaces. That is why ifdown -a cannot work. That is, however, why ifconfig eth0 down will work. But this command is not used in S35networking.
A workaround is to use the wol_poweroff.sh script as described originally. However, I think the cleanest solution is to deinstall the network manager and configure the network through /etc/network/interfaces, as [Anonymous18 November 2011 14:13] described. This is what I did, and it works!
Thanks to everybody, this seemed the only thread of 100 that contained the relevant information.
Wow, this is by far and away the thread with the most information on the subject than any other I have found, and believe me I have visited a lot.
ReplyDeleteThanks so much for helping me to get it working.
Props for being awesome :D
I have Ubuntu 12.04 LTS installed on my N40L and WOL works out of the box.
ReplyDeleteArgh that should say "Ubuntu 12.04 Server LTS"
DeleteN40L + Ubuntu 12.04 LTS Server
ReplyDeleteWOL works.
With the script or without any modifications? I am waiting for the fix to be implemented.
DeleteI have N40L with Ubuntu 12.04 LTS Server and WOL is configured however it doesn't work...
DeleteI had to create script mentioned above and then it works.
It is very strange that it works for some of you on the same enviroment.
Excellent tips.... THANKS. My N40L works with Ubuntu server 12.04 again... !!!
ReplyDeleteWill these same instructions work on debian?
ReplyDeleteShould do... let me know
Deletegreat post. work on N54L after sudo poweroff in few minutes. However, if try to wake on the next day after sudo poweroff. It does not work. any hints?
ReplyDeleteSorry nearly a year late... that sounds like an ARP cache issue with the router / switch. Try setting a static IP address with the router. If that doesn't help try using a different switch / router to isolate the issue, as it could be the N50L where the network interface goes into a power saving mode.
DeleteThis comment has been removed by the author.
ReplyDeleteSorry, after trying this solution the reboot command not works more.
ReplyDeleteIt's normal ? how can possible to solve?
WOL works.
Thank you
Thank you so much for spending time to write this blog article, i must say you are a excellent and talented blogger, I Found This Article To Be Very Informative and Helpful, please keep sharing such amazing blogs I am a Accountant from United States of America, Washington Dc, and I Love to read and Write Blog.
ReplyDeleteSome Of My Web Blogs Awesome Blog Post Please Feel Free to Check Out My Blog you will find the process of Norton software installation with step by step instructions and much more.
Keep Sharing will come back to read more,
Click to Process
norton.com/setup
norton.com/setup download and install
norton.com/setup enter product key
www.norton.com/setup
login.norton.com
my.norton.com
norton.com/setup activate
norton.com/setup install
norton.com/setup help
norton.com/setup renewals
norton.com/enroll product key
Thank you for the visiting here, if you want to setup and activate microsoft office on your pc then you should follow it.
ReplyDeletewww.office.com/setup
office.com/setup
office setup
office product key
office activation
www.office.com/setup
office.com/setup
office setup
office 365 setup
Microsoft office setup
office.com/setup
www.office.com/setup
office setup
ms office setup
comcast email sign in Xfinity Connect app is popular for its features and functions now available with all new users interface and advance security features.
ReplyDeleteHedges Information Technology LLC is a leading and established IT, ELV & AUTOMATION System Integrator based in Dubai, U.A.E, with over a decade of experience catering to key business verticals in SMB, Mid-market & Enterprise accounts.
ReplyDeletesynology partner in dubai
crucial ram 8gb ddr4 3200- Green available to buy online at needsofindia.in. Many ways to pay. Eligible for Cash on Delivery.
ReplyDelete