I have /etc/udev/rules.d/99-wakeup.rules to disable wakeup from sleep when using a keyboard or mouse connected to the device:
ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="0a81", ATTRS{idProduct}=="0205", ATTR{power/wakeup}="disabled"
The USB device is
$ lsusb | grep 0205
Bus 001 Device 006: ID 0a81:0205 Chesen Electronics Corp. PS/2 Keyboard+Mouse Adapter
I added GRUB_CMDLINE_LINUX="udev.log-priority=debug"
in /etc/default/grub and ran sudo update-grub
to increase log level.
Rebooted and ran
$ LC_ALL=C journalctl -b0 -u systemd-udevd | grep -F /etc/udev/rules.d/99-wakeup.rules
Nov 06 03:13:46 jarnos-OptiPlex-9010 systemd-udevd[341]: Reading rules file: /etc/udev/rules.d/99-wakeup.rules
Nov 06 03:13:47 jarnos-OptiPlex-9010 systemd-udevd[349]: 1-1.1.1: /etc/udev/rules.d/99-wakeup.rules:14 ATTR '/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.1/power/wakeup' writing 'disabled'
Nov 06 03:13:47 jarnos-OptiPlex-9010 systemd-udevd[375]: 1-1.1.1:1.1: /etc/udev/rules.d/99-wakeup.rules:14 ATTR '/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.1/power/wakeup' writing 'disabled'
Nov 06 03:13:47 jarnos-OptiPlex-9010 systemd-udevd[375]: 1-1.1.1:1.1: /etc/udev/rules.d/99-wakeup.rules:14 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.1/power/wakeup}, ignoring: No such file or directory
Nov 06 03:13:47 jarnos-OptiPlex-9010 systemd-udevd[349]: 1-1.1.1:1.0: /etc/udev/rules.d/99-wakeup.rules:14 ATTR '/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0/power/wakeup' writing 'disabled'
Nov 06 03:13:47 jarnos-OptiPlex-9010 systemd-udevd[349]: 1-1.1.1:1.0: /etc/udev/rules.d/99-wakeup.rules:14 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0/power/wakeup}, ignoring: No such file or directory
But after reboot
$ cat /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.1/power/wakeup
enabled
What changes it to "enabled"? Even mouse movement wakes system up from sleep. However, if I reconnect the adapter after boot, the value becomes "disabled". I expect the rule be effective in startup, too. If this is a bug, against which package this should be reported?
I can work this issue around by writing enabled
in /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.1/power/wakeup
before entering system suspend possibly automatically (see man systemd-sleep
).