1

I want to enable WOL, I have it enabled in BIOS and understand I need to configure a systemd service to re-enable the setting on boot.

interface is enp3s0 (yes I checked), and script has 775 permissions

using Ubuntu 18.04 desktop

etc/systemd/system/wol.service looks like this:

[Unit]
Description=Configure Wake-up on LAN

[Service]
Type=oneshot
ExecStart=/sbin/ethtool -s enp3s0 wol g

[Install]
WantedBy=basic.target

When I reboot, sudo ethtool enp3s0 gives me

...
Wake-on: d
...

Should be = wake-on: g

yusisushi
  • 158
  • 10
  • 1
    Welcome to [ubuntu.se]! Please [don’t add “SOLVED” to the title](https://meta.askubuntu.com/q/7413/250300). In order to mark your question _solved_ in the right way, you may [_accept_ the answer](https://askubuntu.com/help/someone-answers) (by clicking the tick mark (✓) next to it) that helped you. In case the [helpful answer was posted by you](https://askubuntu.com/help/self-answer), you'll have to wait 2 days before being able to accept it. – Melebius Jan 29 '20 at 09:34
  • 1
    Does this answer your question? [Wake-on-LAN quit working with latest kernel (Bionic)](https://askubuntu.com/questions/1051822/wake-on-lan-quit-working-with-latest-kernel-bionic) – Organic Marble Jan 29 '20 at 21:37
  • hey @OrganicMarble I found the answer already but I can not yet mark it, (3 hours left) I had to enable wakeonlan in netplan, before I could make the setting persistent, with a service in systemd, it didn't run the service until I enabled wol in netplan first. :-), I've posted my answer at the bottom of the page. Have a good day! – yusisushi Jan 30 '20 at 08:50

2 Answers2

3

ANSWERED! you need to enable WOL in netplan, and configure a service that applies ethtool setting on reboot to specify wich (pubmg) network types wake your computer,

Ubuntu 18.04 does not use etc/network/interfaces/, but /etc/netplan/.
I didn't knew that you need to add a line in your netplan/yaml file, wakeonlan :true

      ethernets:
          enp3s0:
                  addresses: [192.168.0.99/24]
                  gateway4: 192.168.0.1
                  wakeonlan: true
                  nameservers:
                    addresses: [192.168.0.1]

I found you need to use ethtool command in combination with the netplan wakeonlan: true setting. and you need to have a service to make the ethtool command persist

in systemd/system you can add a script to specify types of WOL
I highly recommend only using g (magic packet) because if you specify pumbg you are likely to get immediate reboots after shutdown, becuase you accept ping,arp,etc... for waking!

script: etc/systemd/system/wol.service

[Unit]
Description=Configure Wake-up on LAN

[Service]
Type=oneshot
ExecStart=/sbin/ethtool -s enp3s0 wol g

[Install]
WantedBy=basic.target
yusisushi
  • 158
  • 10
1

This seems to be common enough. I was about to try put the ethtool -s dev wol g command into a script to run when the network connects but then I found in my network connections settings in gnome/cinnamon I had an option for wake on lan to select [x] magic. It now keeps the setting on reboot.

If you can't find it anywhere, this what I was about to try:

https://serverfault.com/questions/54704/how-to-get-ethtool-wake-on-lan-setting-to-stick

Hugh
  • 11
  • 1
  • hi hugh. it seems they added a line in network/interfaces but 1804 uses netplan for that instead rigth? I tried adding the line under my config in netplan/yamlfile but the result was: it applied "wake-on g" after reboot, but ignored all other lines (route/ip.) and because of that I had no network connection until i reconfigured gateway route/ ip address, any idea why? example of how my netplan file looked: `ethernets: enp3s0: post-up ethtool s enp3s0 s addresses: - 192.168.0.99 gateway4: 192.168.0.1 nameservers: addresses: [192.168.0.1]` – yusisushi Jan 28 '20 at 22:32
  • it seems i have no idea how to format 'enters' :/ – yusisushi Jan 28 '20 at 22:39