1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-05-23 10:06:38 +02:00
parent 0727077b53
commit 44a989e039

View File

@ -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;