Bug 217163

Summary: Wake on lan (WOL) not working with Realtek RTL8125B-CG
Product: Drivers Reporter: anarchy (omgwtfsalty)
Component: NetworkAssignee: drivers_network (drivers_network)
Status: NEW ---    
Severity: normal CC: bjorn
Priority: P1    
Hardware: AMD   
OS: Linux   
Kernel Version: 5.10.0-21-amd64 Subsystem:
Regression: No Bisected commit-id:

Description anarchy 2023-03-08 15:15:40 UTC
Using an amd mini pc with 5700u and Realtek® RTL8125B-CG lan card. 

Wake on lan isn't working properly.

I have tried it with debian, dietpi and arch linux.

When I turn off the computer, power down the main switch and turn it back on, I am able to use wake on lan.

When I shut it down using shutdown or poweroff. I am unable to start it up again.

I have to turn off the main switch manually and turn it back on again.

I noticed that the lights on the lan port turn off whenever the operating system shutdown on any of the 3 linux distros I used (using poweroff or shutdown).

However, it works when I shutdown with windows. The lights remain on after shutdown and I am able to turn the pc back on remotely.

Not sure why it's doing this, I have another thinkpad x260 on which this works fine on dietpi.

I tried to check for error messages using dmesg --level=err but all I get is 

>[    1.914318] tpm tpm0: [Firmware Bug]: TPM interrupt not working, polling
>instead
>[   62.595463] ucsi_acpi USBC000:00: PPM init failed (-110)

Don't this it's relevant.
Comment 1 anarchy 2023-03-08 15:20:54 UTC
In Summary, whenever I shutdown using poweroff or shutdown on a linux distro, the lan port leds turn off and wake on lan doesn't work until I turn off the main plug and turn it back on again manually. 

Doing the manual power cycle shows the leds come on again and wake on lan works after that.
Comment 2 anarchy 2023-03-08 16:48:47 UTC
I found a solution for my bug, https://wiki.debian.org/WakeOnLan

It works for me.

Add an interface config file /etc/network/interfaces.d/eth0 (or modify the global interface config file /etc/network/interfaces):

auto eth0
iface eth0 inet dhcp
        ethernet-wol g

Activate it:

sudo reboot
Comment 3 Bjorn Helgaas 2023-03-16 17:10:37 UTC
Thanks for the report!  I'm glad you found a workaround.

This isn't my area, but something doesn't seem quite right about this.  Maybe it is the desired behavior that Wake-on-LAN works after a cold power-up but not after a shutdown, but it seems a little non-intuitive.

I'm not quite clear on the manual power-off scenario.  Is it this:

  - Running Linux
  - Turn off main power switch without warning
  - Turn on main power switch
  - LAN port lights are on
  - System does not automatically boot
  - Wake-on-LAN causes system to boot

or more like this (please correct anything I got wrong):

  - Running Linux
  - Linux software shutdown ("shutdown" or "poweroff" command)
  - System shuts down
  - LAN port lights are off
  - Wake-on-LAN does nothing
  - Turn off main power switch
  - Turn on main power switch
  - LAN port lights are on
  - System does not automatically boot
  - Wake-on-LAN causes system to boot

I assume the Windows scenario is like this:

  - Running Windows
  - Windows software shutdown
  - System shuts down
  - LAN port lights are on
  - Wake-on-LAN causes system to boot

I guess adding "ethernet-wol g" to /etc/network/interfaces makes Wake-on-LAN work after Linux "poweroff" or "shutdown", the same as you see with Windows.
Comment 4 anarchy 2023-03-16 18:05:24 UTC
What you wrote is correct. I guess since it is in the Debian documentation this is the default behaviour that wake on lan doesn’t work.

I’m using Dietpi which I think comes with Linux kernel 5.4.

> On 17 Mar 2023, at 01:10, bugzilla-daemon@kernel.org wrote:
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=217163
> 
> Bjorn Helgaas (bjorn@helgaas.com) changed:
> 
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |bjorn@helgaas.com
> 
> --- Comment #3 from Bjorn Helgaas (bjorn@helgaas.com) ---
> Thanks for the report!  I'm glad you found a workaround.
> 
> This isn't my area, but something doesn't seem quite right about this.  Maybe
> it is the desired behavior that Wake-on-LAN works after a cold power-up but
> not
> after a shutdown, but it seems a little non-intuitive.
> 
> I'm not quite clear on the manual power-off scenario.  Is it this:
> 
>  - Running Linux
>  - Turn off main power switch without warning
>  - Turn on main power switch
>  - LAN port lights are on
>  - System does not automatically boot
>  - Wake-on-LAN causes system to boot
> 
> or more like this (please correct anything I got wrong):
> 
>  - Running Linux
>  - Linux software shutdown ("shutdown" or "poweroff" command)
>  - System shuts down
>  - LAN port lights are off
>  - Wake-on-LAN does nothing
>  - Turn off main power switch
>  - Turn on main power switch
>  - LAN port lights are on
>  - System does not automatically boot
>  - Wake-on-LAN causes system to boot
> 
> I assume the Windows scenario is like this:
> 
>  - Running Windows
>  - Windows software shutdown
>  - System shuts down
>  - LAN port lights are on
>  - Wake-on-LAN causes system to boot
> 
> I guess adding "ethernet-wol g" to /etc/network/interfaces makes Wake-on-LAN
> work after Linux "poweroff" or "shutdown", the same as you see with Windows.
> 
> -- 
> You may reply to this email to add a comment.
> 
> You are receiving this mail because:
> You reported the bug.
Comment 5 Bjorn Helgaas 2023-03-16 21:05:20 UTC
Since you chimed in on bug #217069, which is specifically about a WoL regression between v6.1 and v6.2, let me just clarify ...

In *this* report, you mention 5.10.0-21-amd64 in the initial report and 5.4 in comment #4, so I assume you have not tested v6.1 or v6.2, right?

And since you don't mention any older kernels that worked as expected without having to add "ethernet-wol g", I assume this report is not a regression, right?