Ubuntu – wake on lan not working if i turn of with ubuntu

18.04wakeonlan

I'm dual-booting ubuntu 18.04 and Windows 10. If I turn off my computer with Windows, I can turn it back on using wol. However, if I turn it off using Ubuntu the computer won't turn back on if I use wol.

Is there a way of fixing this?


Following this answer I tried the following but it did not work:

ignacio@ignacio-XPS-8930:~$ ifconfig 
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:cff:fea4:9a1e  prefixlen 64  scopeid 0x20<link>
        ether 02:42:0c:a4:9a:1e  txqueuelen 0  (Ethernet)
        RX packets 93  bytes 19417 (19.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 173  bytes 29457 (29.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.86.31  netmask 255.255.255.0  broadcast 192.168.86.255
        inet6 fe80::955b:12c8:20b9:7645  prefixlen 64  scopeid 0x20<link>
        ether d8:9e:f3:85:42:8a  txqueuelen 1000  (Ethernet)
        RX packets 2879  bytes 2068361 (2.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2313  bytes 515874 (515.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 355  bytes 27658 (27.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 355  bytes 27658 (27.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth76213c1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::5c2b:3aff:fea8:d68c  prefixlen 64  scopeid 0x20<link>
        ether 5e:2b:3a:a8:d6:8c  txqueuelen 0  (Ethernet)
        RX packets 93  bytes 20719 (20.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 214  bytes 34037 (34.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 5c:ea:1d:4c:61:a7  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ignacio@ignacio-XPS-8930:~$ ifconfig enp4s0 | grep "HWaddr" | awk '{print $5}'
ignacio@ignacio-XPS-8930:~$ /sbin/ethtool -s enp4s0 wol g
Cannot get current wake-on-lan settings: Operation not permitted
  not setting wol

I also tried with sudo:

ignacio@ignacio-XPS-8930:~/docker/greta$ sudo /sbin/ethtool -s enp4s0 wol g
[sudo] password for ignacio: 
Cannot get current wake-on-lan settings: Operation not supported
  not setting wol

Best Answer

I just ran into this problem after upgrading two properly configured machines to 18.04. I remember that Ubuntu moved to netplan and found an answer from paulgj in the forums that made it work again for me. You may try this if the existing answers don't work.

I got it working by adding the macaddress match lines, here is the full .yaml file:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp2s0:
      match:
        macaddress: 50:e5:49:b3:fc:97
      dhcp4: true
      wakeonlan: true

Note: you need to change enp2s0 and 50:e5:49:b3:fc:97 and save it in /etc/netplan/ with a .yaml extension. I hope this configuration did not disable anything that's going to haunt me in the upcoming weeks.


Edit: for desktops you should replace renderer: networkd with renderer: NetworkManager and then run sudo netplan apply.

Related Question