‘Wake on LAN’ is a handy little feature that lets individuals like system administrators to turn-on a computer on their network by simply sending a message from their PC to the targeted computer’s Ethernet adapter.
But in order for this to happen the Ethernet adapter has to keep it in a certain ‘awakened’ state (even when the computer is turned off) and it requires some power (it’s enabled by default by the Ethernet adapter). So if you have something like a laptop and don’t really need this feature then you can save some power by disabling it.
Now I did measure the power usage before and after and to be honest it was a tiny reduction, almost invincible (at least in my Vostro V131). So if you decided to not to go through all this hassle to disable it, well I’d understand ;-).
I used ‘powerstat’ for calculating the power consumption.
However, if you usually turn off your laptop for like 8-10 hours daily, then while running ‘WOL’ can still consume a decent amount of energy in that period. So by disabling it you can save that energy ‘waste’ nevertheless.
I’m using Ubuntu 12.04 LTS (Precise Pangolin) and by using a tool called ‘ethtool’ we can see whether if it’s already enabled or disabled, if it’s enabled then we can use it to easily disable it.
Step 1: ‘ethtool’ is not installed by default, so enter the below command in your Terminal window to install it.
sudo apt-get install ethtool
Step 2: Then enter the below command below command to see whether it’s enabled or disabled.
sudo ethtool eth0 | grep Wake-on
Then you should see a simple output and as illustrated in the below picture, if under the option ‘Wake-on:’ it says anything other than ‘d’ then it means this feature is enabled.
Step 3: If it’s enabled then on most occasions it’ll say ‘g’ and you can use the below command to disable it.
sudo ethtool -s eth0 wol d
Then enter the command showed in the ‘Step 2‘ again and this time under ‘Wake-on:’ it should say ‘d’.
But the thing is, this setting will be lost as soon as you reboot your computer. So to make Ubuntu permanently save the changes, use the below steps. If you use Ubuntu 12.04 then please skip to ‘Step 5‘ (I’m not sure but even 11.10 users might have to use that method as well).
Step 4: Enter the below command in your Terminal window. This will open a configuration file in Ubuntu that we can use to add and execute programs when the OS boots.
gksudo gedit /etc/rc.local
Now simply copy and past the below code into that newly opened configuration file (make sure to paste it above the ‘exit 0’ code).
ethtool -s eth0 wol d
Now click on the ‘Save’ button and close the window. That it now the setting is permanently saved.
For Ubuntu 12.04 (and up) users …
With Ubuntu 12.04, Ubuntu engineers have done some tweaks to the OS (HDD spin down, changing Wi-Fi signal strength, few file system related tweaks etc) and as a result it’s much more energy efficient than the previous releases (at least in my experience).
And there’s a simple script called ‘disable-wol’ that enable/disable the ‘Wake on LAN’ feature on its own and I think it was because of this that even after editing the ‘/etc/rc.local’ file my Ubuntu 12.04 still booted to the desktop with it enabled.
But there’s a simple trick that we can use so that the ‘disable-wol’ script to will always disable ‘WOL’ feature of your Ethernet card.
Step 5: Now, let’s first copy the original script to the ‘/etc/pm …’ folder, as if we were to edit the file while keeping it on its original location, then it might get overwritten when your OS receives update. So for that, open the terminal window and enter the below command.
sudo cp /usr/lib/pm-utils/power.d/disable_wol /etc/pm/power.d
Step 6: Now enter the below command to edit it.
gksudo gedit /etc/pm/power.d/disable_wol
Once opened locate a code called ‘wol g’ (you can search for it in the editor) as shown below then simply change the letter ‘g’ to ‘d’.
Then click on the ‘Save’ button’ and close the editor. Now reboot your PC and when you’ve logged into the desktop use the command in the ‘Step 2‘ to know if it’s working or not. If it’s working, then under ‘Wake-on’, now it should say ‘d’ (= disabled).
You can easily restore your changes later by simply re changing that latter ‘d’ to ‘g’ of that ‘disable_wol’ script.
If interested there are few other things that you can do to reduce the power usage of the Ethernet adapter and you can find the instructions from this page. Good luck.
5 thoughts on “Disabling ‘Wake On LAN’ in Ubuntu might save a Tiny Bit of Power on your Laptop”
Sorry. My wake-on-lan works perfectly when my system is halted or completely down. But it still wont work if ubuntu went to sleep or hibernates.
First of all, I'm sorry it took this long for me to reply. The reason is, your comment was in the 'spam' folder and I just saw it now.
Anyway there are few things that you can try …
1. First, if you haven't, then as pointed out in the article, install the 'ethtool' utility. If you have editied the 'disable_wol' configuration file, then undo the changes as well.
2. Then enter the below command.
3. Now enter the below command.
4. Now search for the below code …
Then in the 'wol d>' code, change the letter 'd' to 'g'. Don't change anything else. Now save the file and close its window and reboot the computer.
Now try putting it to Standby to see if it works or not.
Thanks bro, It worked for me Ubuntu 15.10
You’re welcome 🙂 .
Hello, could you give me a hint how to make it work in bionic 18.04? – Here the /etc/pm/sleep.d/disable_wol script does not exist.