I've followed the instructions on https://help.ubuntu.com/community/WakeOnLan but i'm having difficulty getting it working. My BIOS is enabled for wake on lan and i've been able to do it using windows hibernate/sleep with the same NIC.
5 Answers
If the cause is WoL settings not being persistent after reboot as explained in the previous answer, there is a simpler solution, which is posted here: https://askubuntu.com/a/1051894/883129
- Make sure you have
ethtoolandwakeonlaninstalled. - Create
/etc/network/if-up.d/wol_fixfile with the following content:
where [card] is the name of your ethernet adapter, such as#!/bin/sh /sbin/ethtool -s [card] wol geth0,enp4s0etc. (you can check this withifconfigcommand). - Then run:
sudo chmod +x /etc/network/if-up.d/wol_fix
- 385
Ubuntu allows Netplan for configuration. Look for the interface entry in /etc/netplan/*.yaml and enable wakeonlan. E.g.
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: true
wakeonlan: true
Run 'netplan apply' after changes. To see the current setup 'netplan get all'
The filename can differ, check for 01-netcfg.yaml and others. One can also create a new one.
- 263
I recently upgraded to Linux Mint 20. After re-installing the "wakeonlan" package I noticed it was not working. It turned out that upon shutdown, the wakeonlan option was being disabled. Here's how I worked around it.
On the computer you want to be able to wake up remotely...
Become root...
sudo su
Install the wakeonlan program on the computer you want to be able to wake up remotely.
apt install wakeonlan
Find your ethernet adapter, mine was called 'enp10s0' (usually called 'eth0').
ifconfig -a
Check the ethernet adapter to see what "Wake-on" is set to. See below link for diffent options and what they mean. https://www.thomas-krenn.com/en/wiki/Wake_On_LAN_under_Linux
ethtool enp10s0
Non-interactive creation of script which will set the "Wake-on" option to "g" which means "Wake on MagicPacket". For the next step (systemd) to work correctly, you must have the she-bang line included on the first line of the file.
cat >> /root/wol_fix.sh <<EOF
#!/bin/bash
ethtool -s enp10s0 wol g
EOF
Set correct permissions for the fix script.
chmod 755 /root/wol_fix.sh
Non-interactive creation of script which will run on boot to run the fixing script.
cat >> /etc/systemd/system/wol_fix.service <<EOF
[Unit]
Description=Fix WakeOnLAN being reset to disabled on shutdown
[Service]
ExecStart=/root/wol_fix.sh
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
Reload the systemd manager configuration.
systemctl daemon-reload
Enable to wol_fix service script.
systemctl enable wol_fix.service
NOTE: must reboot for the on-boot script to take effect. Or you can run the /root/wol_fix.sh script manually this time only before your next shutdown or reboot.
reboot
On computer you want to use to remotely wake up your other computer...
# [another_computer]$
Non-interactive creation of script to wake up computers on network. The "255" means only broadcast to a specific subset of the IP range on the local network.
cat >> /home/$USER/wakeuppc.sh <<EOF
wakeonlan -i 192.168.1.255 <MAC ADDRESS>
EOF
Add execute permisson for the wakeonlan caller script.
chmod +x /home/$USER/wakeuppc.sh
- 19
Thanks for the hint to the tlp.conf.
This was the reason why my WOL was not working.
Be sure to uncomment the WOL_DISABLE setting and set it to NO:
# Disable wake on LAN: Y/N.
# Default: Y #
WOL_DISABLE=N
- 145
- 11
I had similar problem... I tried all the possible solutions and noone worked for me. Finally I discovered that my problem was related to the TLP. In its config, file tlp.conf in /etc/ folder, there is the deactivation of the wol service so after I changed there the wol service started working again.
- 11