You are not logged in.

#1 2014-03-30 02:15:21

longwaydown42
Member
Registered: 2014-03-30
Posts: 3

Wake-on LAN stops working after suspend via SSH

I've been using Arch for a few years, but I've never had a question that wasn't answered via the wiki or other forum posts until now. I have a desktop machine at home I want to use as a music server with MPD+Icecast to stream music to somewhere else, i.e. my machine at work. That part I've got working just fine. However, I'd like to keep my computer sleeping to save on my power bill when I'm not listening to music.

I have wake-on LAN enabled on my motherboard and I'm able to repeatedly suspend it locally using "systemctl suspend" and wake it remotely using wol without issue.

The problem comes when I suspend the machine via SSH (as the same user when logged in locally) using "systemctl suspend". Once I do that, I can't get the machine to resume without physical access to the box. Subsequent suspends, both local and via SSH, require physical access to resume until I reboot the machine. That is, after doing a suspend via SSH, the system won't wake-on LAN after any suspend until it's rebooted. 

Seeing as though I can suspend the machine locally without a password but have to authenticate when I call "systemctl suspend" via SSH, there seems to be something different about the remote suspend, but I don't know if that's affecting wake-on LAN.

Motherboard model is MSI X79A-GD65 (8D) and ethernet kernel driver is e1000e. Please let me know if I need to provide additional system/hardware details and thanks for any help you can provide.

Last edited by longwaydown42 (2014-03-30 15:42:36)

Offline

#2 2014-03-30 09:38:41

Blµb
Member
Registered: 2008-02-10
Posts: 224

Re: Wake-on LAN stops working after suspend via SSH

How do you suspend it when you suspend it locally? I assume you don't run `systemctl suspend` in a terminal? If that's the case, check the differences between the two methods. One might be running an additional target which runs the necessary ethtool command to activate wake-on-LAN. (I only used it a long time ago and I remember I added an ethtool line to re-enable wol on boot or shutdown since the setting would get lost across reboots - might have been due to dual-booting with windows sometimes though...).
In any case, you could login via SSH and check the WOL setting before doing a suspend that would otherwise make it not wake up anymore.


You know you're paranoid when you start thinking random letters while typing a password.
A good post about vim
Python has no multithreading.

Offline

#3 2014-03-30 15:26:57

longwaydown42
Member
Registered: 2014-03-30
Posts: 3

Re: Wake-on LAN stops working after suspend via SSH

[EDIT] I thought the following fixed the problem, but only changed the problem.

I figured it out and am marking the thread [SOLVED]. The key came from the "Power Managment" section of the systemd wiki page:

polkit is necessary for power management as an unprivileged user. If you are in a local systemd-logind user session and no other session is active, the following commands will work without root privileges.

Emphasis mine. Because I'm not in a local session, I have to authenticate to suspend the machine. This got me looking at the polkit page, from which I figured out how to create a polkit rule to allow my user to suspend when not local:

/* /etc/polkit-1/rules.d/00-remote-suspend.rules */

/* Allow specific user to suspend the machine remotely without authentication */
polkit.addRule(function(action, subject) {
  if (action.id == "org.freedesktop.login1.suspend" && 
      subject.user == "user" &&
      subject.local == false) {
    return polkit.Result.YES;
  } 
});

This seems like it might be a tad insecure, but I figure that if someone already has access to my user account, I have a lot worse troubles than giving them the power to suspend the machine remotely.

So it would seem whatever gets executed when running the code to authenticate a non-local user disables wake-on-LAN. I don't know the exact reason, but this should provide a solution should anyone else have the problem.

Last edited by longwaydown42 (2014-03-30 15:43:48)

Offline

#4 2014-03-30 15:42:26

longwaydown42
Member
Registered: 2014-03-30
Posts: 3

Re: Wake-on LAN stops working after suspend via SSH

Ok I spoke a little too soon. It seems now I can successfully suspend and wake-on-LAN exactly once, whether locally or via SSH. My polkit rule has changed the shape of the problem, but not solved it. It would seem that polkit and/or logind are the key, but I'll have to do a little more digging.

Offline

Board footer

Powered by FluxBB