You are not logged in.

#1 2024-06-07 22:20:07

TiredButExcited
Member
Registered: 2021-10-04
Posts: 5

[SOLVED]Waking up from hibernation into black screen wireless keyboard

Hello everyone,

I have a rare, but relatively long-standing problem, that my computer sometimes shows balck screen after waking up from hybernation. I had an idea, that this might be related to some hardware. After a lot of testing plugging in and out peripherals, while and after hibernating, I think, I found out the sequence which always leads to a problem.

When I hibernate and then unplug a dongle of my wireless keyboad and then try to wake up, above mentioned black screen comes up. The builtin keyboard of my laptop is lit, and I can even adjust backlight using function keys. But waking up process is stuck.

If on the other case I wake with dongle is the same state, as during hibernation, whether plug in or not -> everything works great.

I have looked into Troubleshooting section from here: https://wiki.archlinux.org/title/Power_ … _hibernate

- I checked that

Watchdog

  stuff is off in systemd config.


- That I have only

intel_lpss_pci

module in MODULES in

/etc/mkinitcpio.conf

- I dont have

nvidiafb

module, checked with

lsmod | grep nvidia

.

How do I go about fixing it? I always forget about this and then end up having to restart the PC, losing the session and workspaces.. sad

Last edited by TiredButExcited (2024-06-12 08:16:48)

Offline

#2 2024-06-08 08:03:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,979

Re: [SOLVED]Waking up from hibernation into black screen wireless keyboard

a lot of testing plugging in and out peripherals, while and after hibernating … When I hibernate and then unplug a dongle of my wireless keyboad and then try to wake up, above mentioned black screen comes up. The builtin keyboard of my laptop is lit, and I can even adjust backlight using function keys. But waking up process is stuck.

Generally https://bbs.archlinux.org/viewtopic.php … 4#p1960554

When this happens, can you
- switch to another VT (ctrl+alt+f3)
- reboot the system w/ the https://wiki.archlinux.org/title/Keyboa … el_(SysRq) (nb. that you'll have to explicitly enable the feature before) to hopefully preserve the journal of the failing resume?

As for mitigation, you could (logically) remove the usb dongle w/ a suspend/hibernation hook, https://unix.stackexchange.com/question … ice-dongle

Offline

#3 2024-06-09 22:55:19

TiredButExcited
Member
Registered: 2021-10-04
Posts: 5

Re: [SOLVED]Waking up from hibernation into black screen wireless keyboard

Thanks a lot for your answer

seth wrote:

switch to another VT (ctrl+alt+f3)
- reboot the system w/ the https://wiki.archlinux.org/title/Keyboa … el_(SysRq) (nb. that you'll have to explicitly enable the feature before) to hopefully preserve the journal of the failing resume?

This does not work. I enabled the button with `sysctl kernel.sysrq=1`


After some more testing I discovered that wake up only hangs if mouse dongle is connected together with keyboard. Weirdly enough disconnecting mouse dongle with PC off does not do anything.

seth wrote:

As for mitigation, you could (logically) remove the usb dongle w/ a suspend/hibernation hook, https://unix.stackexchange.com/question … ice-dongle

Could you please point me in the right direction how to make this hook? I think answer in the link only works if usb-port does not change, as otherwise path in /sys/bus/usb/drivers/ will change.

Offline

#4 2024-06-10 06:29:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,979

Re: [SOLVED]Waking up from hibernation into black screen wireless keyboard

You'd loop through /sys/bus/usb/devices/* until you find the device w/ the relevant /sys/bus/usb/devices/*/id{Product,Vendor}

Offline

#5 2024-06-10 20:38:56

TiredButExcited
Member
Registered: 2021-10-04
Posts: 5

Re: [SOLVED]Waking up from hibernation into black screen wireless keyboard

I wrote a bash script, that finds the device and disconnects it.

Do I understand correctly, that now I need to make a systemd service with WantedBy=hibernate.target ?

I also checked the list of targets with `systemctl list-units --type=target` and did not find hibernate.target. Do I need to create it manually, or does it exist and is not shown in the list?

Offline

#6 2024-06-10 20:46:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,979

Re: [SOLVED]Waking up from hibernation into black screen wireless keyboard

You can also just use the infrastructure for shell drop-ins, https://wiki.archlinux.org/title/Power_ … stem-sleep

Offline

#7 2024-06-12 08:14:51

TiredButExcited
Member
Registered: 2021-10-04
Posts: 5

Re: [SOLVED]Waking up from hibernation into black screen wireless keyboard

Thanks a lot seth. Now it works. Just a summary for other people:

0. Find out your `vendorID:deviceID` using `lsusb`.

1. Create a script to switch off keyboard just before hibernation. Here is a minimal example:

#!/bin/sh

# $1 parameter to a function is a number. 0 - for keyboard_off, 1 - for keyboard_on
toggle_keyboard () {
    for device in /sys/bus/usb/devices/*; 
    do
        [ "$(cat "$device"/idProduct 2> /dev/null)" = "<your-keyboard-id>" ] && { echo "$1" | sudo tee "$device/authorized"; }
    done;
}

case "$1/$2" in
  pre/*)
    toggle_keyboard 0
    ;;
  <Add additional checks if needed.>
esac

2. Put / link your script to /usr/lib/systemd/system-sleep/ 
Parameters $1 / $2 are passed by systemd. We only need to accept and process them. More options:

You can also just use the infrastructure for shell drop-ins, https://wiki.archlinux.org/title/Power_ … stem-sleep

Offline

Board footer

Powered by FluxBB