summaryrefslogtreecommitdiffstats
path: root/src/tty-ask-password-agent
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-23 10:06:38 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-31 19:22:51 +0200
commit44a989e03906b0cf8ae60494992e531a5c3a434a (patch)
tree7d808f0115213d2674b795482dc3d188030e5964 /src/tty-ask-password-agent
parenttty-ask-password-agent: highlight summary in help (diff)
downloadsystemd-44a989e03906b0cf8ae60494992e531a5c3a434a.tar.xz
systemd-44a989e03906b0cf8ae60494992e531a5c3a434a.zip
tty-ask-password-agent: log when starting a query on the console
When looking at logs from a boot with an encrypted device, I see (with unrelevant messages snipped): [ 2.751692] systemd[1]: Started Dispatch Password Requests to Console. [ 7.929199] systemd-cryptsetup[258]: Set cipher aes, mode xts-plain64, key size 512 bits for device /dev/disk/by-uuid/2d9b648a-15b1-4204-988b-ec085089f8ce. [ 9.499483] systemd[1]: Finished Cryptography Setup for luks-2d9b648a-15b1-4204-988b-ec085089f8ce. There is a hug gap in timing without any explanatory message. If I didn't type in the password, there would be no way to figure out why things blocked from this log, so let's log something to the log too.
Diffstat (limited to 'src/tty-ask-password-agent')
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index 80f5408e12..08e191faf0 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -143,10 +143,9 @@ static int agent_ask_password_tty(
char ***ret) {
int tty_fd = -1, r;
+ const char *con = arg_device ?: "/dev/console";
if (arg_console) {
- const char *con = arg_device ?: "/dev/console";
-
tty_fd = acquire_terminal(con, ACQUIRE_TERMINAL_WAIT, USEC_INFINITY);
if (tty_fd < 0)
return log_error_errno(tty_fd, "Failed to acquire %s: %m", con);
@@ -155,6 +154,7 @@ static int agent_ask_password_tty(
if (r < 0)
log_warning_errno(r, "Failed to reset terminal, ignoring: %m");
+ log_info("Starting password query on %s.", con);
}
r = ask_password_tty(tty_fd, message, NULL, until, flags, flag_file, ret);
@@ -162,6 +162,9 @@ static int agent_ask_password_tty(
if (arg_console) {
tty_fd = safe_close(tty_fd);
release_terminal();
+
+ if (r >= 0)
+ log_info("Password query on %s finished successfully.", con);
}
return r;