I've been reading quite a lot on suspend / resume, in here and other internet resources, and tried countless (too many to quote here) of the hints given; in vain...
My setup requires inputattach
, and this always had a problem with suspend / resume as it didn't come back cleanly after a resume. I never succeeded in using the "hooks" provided in /usr/lib/systemd/system-sleep/
: my scripts (built after examples in the documentation) in there were correctly(!) run during resume, but their effect was none. In journalctl
I can see the script executed, as the root
user, the inputattach
process created, and its PID listed:
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: echo "... in test ... $(whoami) -- $1"
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: ... in test ... root -- post
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: case $1 in
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: post)
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: { inputattach -mman /dev/ttyS0 --daemon --always & disown; echo $!; }
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: ;;
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: esac
Mär 04 16:48:42 RudisPC systemd-sleep[18074]: + inputattach -mman /dev/ttyS0 --daemon --always
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: + echo 18074
Mär 04 16:48:42 RudisPC systemd-sleep[18057]: 18074
Mär 04 16:48:42 RudisPC systemd-sleep[18075]: + ps -elfH
Mär 04 16:48:42 RudisPC systemd-sleep[18076]: 0 S root 18074 18057 0 80 0 - 1458 do_sel 16:48 ? 00:00:00 inputattach -mman /dev/ttyS0 --daemon --always
but when resume
has finished, that process is gone. Does it require special permissions / privileges to be accepted by the kernel and persist?
One observation: When running inputattach
at boot time, or manually after resume
, I see something like these entries in journalctl
:
Mär 04 16:48:50 RudisPC kernel: serio: Serial port ttyS0
Mär 04 16:48:50 RudisPC kernel: input: Logitech M+ Mouse as /devices/pnp0/00:06/tty/ttyS0/serio7/input/input18
which don't show up after process creation in the sleep
- hook.
My workaround for ages was to have an alias that, after resume had finished, ran inputattach
again. This doesn't work any more ever since the upgrade to 20.10. This may be as (now?) the systemctl suspend
command is asynchronous, and will not wait for the suspend/resume cycle to complete. I don't recall what it was before the upgrade.
Is there something obvious that I am doing wrong here? Any ideas / hints? Could there be a smart dbus
/ udev
action doing the trick?