Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Password input problem when resuming from suspend/hibernate #97

Open
tstsrt opened this issue May 19, 2020 · 4 comments
Open

Password input problem when resuming from suspend/hibernate #97

tstsrt opened this issue May 19, 2020 · 4 comments

Comments

@tstsrt
Copy link

tstsrt commented May 19, 2020

After resuming from suspend/hibernate, the first authentication attempt fails unless backspace is pressed atleast once. Later attempts work normally. This is because stdin isn't flushed before the password is read, and systemd automatically uses /dev/null as stdin, which puts an EOF in the password field. A workaround is to set StandardInput=tty in the service file.
I'm using the following systemd unit to start physlock before suspend. OS is Arch, physlock version is physlock 13, and systemd version is 245.5-2-arch.

[Unit]
Description=Lock the session before suspending
Before=sleep.target

[Service]
User=%I
Type=forking
StandardInput=tty
TTYPath=/dev/tty7
ExecStart=/usr/bin/physlock -d

[Install]
WantedBy=sleep.target
@Noahmatada
Copy link

Any ideas on how this might be solved without systemd, like when launching physlock manually, then closing laptop lid?

@tstsrt
Copy link
Author

tstsrt commented Jun 8, 2020

The bug seems to happen only if both a) the password prompt is running, and b) the system resumes from suspend/hibernate. One possible fix is to have two separate modes of operation - one to lock and another to unlock an already running physlock instance. This way, we can lock the system before suspend and then prompt only after resuming. I'm not sure how difficult this would be to implement, though.

@Noahmatada
Copy link

Couldn't it just be made to ignore the EOF character?

@tstsrt
Copy link
Author

tstsrt commented Jun 9, 2020

I believe that would involve either changing the upstream misc_conv function (the password prompt) or writing a custom PAM conversation function that ignores EOF.

menglishca added a commit to menglishca/physlock that referenced this issue Jul 27, 2020
Fix issue xyb3rt#97 with very basic signal handling
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants