You are not logged in.

#1 2014-07-20 23:17:23

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Force hibernated system to only wake up on powerbutton press

Hi,

I need the computer to shut down on hibernate (via systemd).

By "shut down" I mean that the computer should not wake up on any other action than Power Button press or a WoL magic packet.

Currently when I hibernate (via systemctl hibernate or clicking on Hibernate in XFCE) the compuer shuts down but powers on on a keyboard press or a mouse click. I don't want that.

I've been ddg'ing around and found /sys/power/disk but "echo shutdown > /sys/power/disk" doesn't seem to have the desired effect. Didn't find anything useful on systemd itself.

When I do a "real" shutdown (i.e. run poweroff or click shutdown in xfce) I get the expected behavior.

Any tips on what I should look into?

thanks,

-miky


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#2 2014-07-20 23:47:48

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Force hibernated system to only wake up on powerbutton press

Two things to look into: /proc/acpi/wakeup and /sys/devices/.../power/wakeup. You could disable wakeup on devices before hibernating and enable it after thawing (man systemd-sleep).

Offline

#3 2014-07-21 11:04:31

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Force hibernated system to only wake up on powerbutton press

Also check your BIOS, I know mine has an option to enable/disable resume from keyboard.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2016-02-27 15:03:37

kepi
Member
Registered: 2016-02-27
Posts: 2

Re: Force hibernated system to only wake up on powerbutton press

AS lucke suggests, check /proc/acpi/wakeup. I.e. on my system there is XHC device with enabled status which is causing wake up from keyboard and mouse.

You can switch state with simple

echo XHC > /proc/acpi/wakeup

If you suspend system and it works, you just need to do this before every sleep. You can use systemd hook (beware that on some systems hooks are in /usr/lib/systemd/system-sleep and on some systems in /lib/systemd/system-sleep. Just check man systemd-suspend.service for correct path):

#!/bin/bash

# /lib/systemd/system-sleep/45fix-usb-wakup
# Disable wakup from USB devices
# 
# This is just modified version of pm-utils script from
# https://gist.github.com/rutsky/1ed8e9779f0b2941c5a6

[[ "$1" = "pre" ]] || exit 0

function print_state {
    cat /proc/acpi/wakeup | grep $1 | cut -f3 | cut -d' ' -f1 | tr -d '*'
}

function disable_wakup {
    dev=$1
    if [ "`print_state $dev`" == "enabled" ]; then
        echo $dev > /proc/acpi/wakeup
    fi
}

function enable_wakup {
    dev=$1
    if [ "`print_state $dev`" == "disabled" ]; then
        echo $dev > /proc/acpi/wakeup
    fi
}

case $2 in
    suspend)
            echo "Fixing acpi settings."

            # Disable wakup by events from USB hubs
            # (e.g. mouse move on some mices)
            disable_wakup XHC
            ;;
esac

Offline

Board footer

Powered by FluxBB