7

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
10
  • This is a "feature" introduced in the latest kernel. I am on a phone so can't help much, but if you search for my question on this, my answer gives a workaround. Jul 8, 2018 at 17:58
  • I think this will solve your problem: askubuntu.com/questions/210890/wake-on-lan-under-ubuntu-12-04 Jul 8, 2018 at 18:04
  • I updated my question because ethtool is not working for me
    – Ignacio
    Jul 8, 2018 at 18:36
  • You have to use sudo if you are just typing the ethtool command in. Look under Edit 2 in my question. Jul 8, 2018 at 19:29
  • 1
    Ok this is something different then. Jul 8, 2018 at 19:36

4 Answers 4

5

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.

1
  • 1
    This did not work
    – Ignacio
    Sep 6, 2018 at 21:12
5

It is an old thread, but there is no answer accepted and my problem was similar, except that it is a mac mini dual boot MacOS and Ubuntu 18.04; on Mac suspend I could WOL from a Windows 10 machine; on Ubuntu suspend nothing happens...

And I too have the:

marcelo@Ubuntu-Macmini:~$ sudo ethtool -s wlp3s0 wol g
[sudo] senha para marcelo: 
Cannot get current wake-on-lan settings: Operation not supported
  not setting wol

So, I did all the steps at this question, better explained here but it still didn't work; but I read this thread and:

  1. did a sudo lshw -C network

    *-network                 
       descrição: Ethernet interface
       produto: NetXtreme BCM57765 Gigabit Ethernet PCIe
       fabricante: ...
       nome lógico: enp2s0f0
       ... autonegotiation=on broadcast=yes ***driver=tg3***
    
  2. after this, knowing that the driver is tg3:

    sudo gedit /etc/default/acpi-support

    I changed the

    # Add modules to this list to leave them in the kernel over suspend/resume
    MODULES_WHITELIST=""
    

    to

    MODULES_WHITELIST="tg3"
    

    And after a restart of the network service it worked like a charm, but only with Magic Packets, that is cool; to provide that Magic Packets I'm using a python script, adapted from here; I said adapted because this script is for Python 2, and my setup is Python 3. Hope this helps someone.

4
  • Can this be achieved in a modern Debian system that uses systemd to manage power / doesn't use the acpi-support package installed?
    – TCB13
    May 30, 2020 at 22:55
  • @TCB13: next week I'll need to install Ubuntu in a new system; I'll try to address your question then. Jun 16, 2020 at 19:52
  • 1
    This procedure turned on my ethernet ports LEDs when I shut down the computer. You're the man. I have been looking for a solution for weeks!
    – rtrigo
    Sep 10, 2020 at 23:18
  • THIS SOLVED MY PROBLEM THANK YOU
    – yusisushi
    Nov 23, 2020 at 20:23
3

Since it works in Windows than you know the problem lies within the Linux OS so the solution is... it depends. Either way you are going to need to know the name of the network interface. Run the following:

ip a

The interface with an IPv4 address (that isn't the loopback) is the one that we are looking for. The output looks like:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:f1:bb:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.12/24 brd 192.168.1.255 scope global dynamic ens160
       valid_lft 5919sec preferred_lft 5919sec
    inet6 fe80::20c:29ff:fef1:bbec/64 scope link
       valid_lft forever preferred_lft forever 

So the interface on this system is ens160.

Network Manager

See this post: How to enable Wake On Lan (WOL) in Ubuntu 16.04 If the following doesn't work, there is another method along with this one (that I blatently stole from loco.loop), that may be what you need.

If you used the Ubuntu Desktop ISO to install your system than you are using NetworkManager to control your network interfaces and you will need to do the following:

Systemd is how Ubuntu has decided to go so we might as well get used to it and use it to turn on WOL every time the system boots. Create /etc/systemd/system/[email protected] and add the following to it:

[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
After=network.target

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

[Install]
WantedBy=multi-user.target

Next we need to enable the service to run at boot:

sudo systemctl enable wol@enp3
sudo systemctl start wol@enp3

Netplan

If you were a bit more adventurous and installed Ubuntu Server than your interfaces are controlled via systemd-networkd and Ubuntu has added the Netplan.io front end to help configure it. There will be a YAML file in the /etc/netplan/ directory in the form: 0X-something.yaml, lets take a look:

/etc/netplan/50-cloud.init.yaml

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
  version: 2
  ethernets:
    ens160:
      dhcp4: true
  vlans:
    mgmt.10:
      id: 10
      link: ens160
      dhcp4: true
      dhcp6: false
    user.20:
      id: 20
      link: ens160
      dhcp4: true
      dhcp6: false

All that is needed is to add `wakeonlan: true' to the ens160 section. So it will look like this:

...
network:
  version: 2
  ethernets:
    ens160:
      dhcp4: true
      wakeonlan: true
  vlans:
    mgmt.10:
...

This is a YAML file and they are very picky about spacing so make sure the text you add is directly in line with the other text in the section.

Now we need to generate, test and apply the new config (the generation step isn't completely necessary but I've included it here for completeness):

sudo netplan generate
sudo netplan try

And assuming the test succeeds, if it doesn't the configuration will revert and you most likely got the formatting wrong, now run:

sudo netplan apply
1

@LiveWireBT's answer worked for me.

https://askubuntu.com/a/1072862/874871

Don't forget to run the apply command after you've changed the configuration.

$ sudo netplan apply
1
  • This did not work for me either. I get the following error when i check if wol is enabled Cannot get wake-on-lan settings: Operation not permitted Current message level: 0x000060e4 (24804) link ifup rx_err tx_err hw wol
    – Ignacio
    Sep 25, 2018 at 9:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .