1

Problem: I hibernate the computer at night and my cat wakes it by stepping on the keyboard. Yes, hibernate a.k.a. suspend to disk, with systemctl hibernate. Not suspend to ram. I used to think that, once completed, hibernation would be indistinguishable from a normal shutdown but apparently that's not the case since the computer doesn't wake on usb after a normal shutdown.

System: Debian 10, motherboard ASUS B450.

What I've tried:

I couldn't find anything on the BIOS.

cat /sys/bus/usb/devices/usb[1-7]/power/wakeup

All return disabled.

There are other "devices" under /sys/bus/usb/devices/ but they all seem to be hubs and don't have the power/wakeup option. They all have names like such: 1-0:1.0.

I would like to solve this by software. I would not like to:

  1. Anything that involves changing my setup, locking the room, selling the cat, etc;
  2. Turn off the power strip. The router is connected to it and other people might want wifi while I'm asleep.

Thanks for the help, in advance.

EDIT:

cat /proc/acpi/wakeup returns:

Device  S-state   Status   Sysfs node
GPP0      S4    *disabled
GPP1      S4    *disabled
GPP3      S4    *disabled
GPP4      S4    *disabled
GPP5      S4    *disabled
GPP6      S4    *disabled
GPP7      S4    *disabled
GPP8      S4    *enabled   pci:0000:00:03.1
X161      S4    *disabled  pci:0000:08:00.0
GPP9      S4    *disabled
X162      S4    *disabled
GPPA      S4    *disabled
GPPB      S4    *disabled
GPPC      S4    *disabled
GPPD      S4    *disabled
GPPE      S4    *disabled
GPPF      S4    *disabled
GP10      S4    *disabled
GP11      S4    *disabled
GP12      S4    *enabled   pci:0000:00:07.1
GP13      S4    *enabled   pci:0000:00:08.1
XHC0      S4    *enabled   pci:0000:0a:00.3
GP30      S4    *enabled   pci:0000:00:08.2
GP31      S4    *enabled   pci:0000:00:08.3
PS2K      S3    *disabled
PS2M      S3    *disabled
GPP2      S4    *enabled   pci:0000:00:01.3
PX11      S4    *disabled
PX12      S4    *disabled
RLAN      S4    *disabled  pci:0000:07:00.0
PTXH      S4    *enabled   pci:0000:01:00.0
13
  • "Wake" has little to do with the OS running--While "hibernated", the OS is not even running! If your _system BIOS does not have a way to disable wake on USB, then you will have to find an alternative that you do not want, such as... putting the keyboard/mouse where the cat will not step on it, etc. You might also turn off the power in your PC, and not the entire power strip, since "hibernation" actually writes RAM out to the system SWAP space, and shuts the hardware down.
    – C. M.
    Jul 30 at 18:15
  • I suspect there is a way to disable this behavior since it doesn't happen with normal shutdown. The operating system is telling the hardware to wake on usb only if I hibernate.
    – anajoy666
    Jul 30 at 18:42
  • First, I am differentiating between "hibernate" and "sleep" modes. Second, the BIOS ACPI configuration is what controls how and when the hardware wakes after it receives an ACPI S5 shutdown.. That is why it does not trigger during a normal shutdown. But to my knowledge, ACPI S5 shutdown has no way to limit wake events that are not set in the BIOS settings. If your mobo has no such setting, then your mobo does not aupport it, regardless. Sleep mode can, because it actually wakes the OS and resumes it long enough to let the OS decide if it wants to stay awake or go back to sleep.
    – C. M.
    Jul 30 at 19:13
  • Correction to the above: ACPI S4 and S5 is what differeniates between a "hibernation shutdown (S4)", and a "full shutdown (S5)"
    – C. M.
    Jul 30 at 19:22
  • 1
    This is how to make it permanent with systemd. CC @meuh in case you want to include it in the answer.
    – anajoy666
    Jul 31 at 18:48
1

There's some background on ACPI states in the kernel doc.

Since the keyboard is presumably a usb device, if it cannot be disabled, you can try to disable the controller. As well as /sys/bus/usb/devices/, there are also devices listed in pseudo file /proc/acpi/wakeup that you can disable. These tend to be on the motherboard, rather than hotplug. The 4 character names are rather obscure, coming from the bios, but some of them are described in this answer. You can toggle one by writing its name into the file, for example:

echo XHC0 >/proc/acpi/wakeup

This should disable your USB 3 controller. You are still dependent on what the bios does, hence suspend-to-ram might be necessary, as C.M. pointed out in the comments.

For a permanent setting, you need to write this everytime you boot, and as you found, the systemd-tmpfiles utility can do this using its general purpose methods. Create a file such as /etc/tmpfiles.d/disable-usb-wake.conf with the lines

#    Path                  Mode UID  GID  Age Argument
w    /proc/acpi/wakeup     -    -    -    -   XHC0

The first line is just a comment. See man tmpfiles.d for the format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.