From 44a989e03906b0cf8ae60494992e531a5c3a434a Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 23 May 2021 10:06:38 +0200 Subject: 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. --- src/tty-ask-password-agent/tty-ask-password-agent.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/tty-ask-password-agent') 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; -- cgit v1.2.3