From d7c553fa3134772b13aff0b9b2fe90a39636f4e7 Mon Sep 17 00:00:00 2001 From: scott Date: Thu, 16 Apr 2026 12:31:27 -0400 Subject: [PATCH] Wait for shell prompt after 'Last login:' banner on fresh serial login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After sending the password, read_until_quiet returned as soon as the 'Last login:' banner went quiet — before the actual shell prompt arrived. Since 'Last login:' proves the password was accepted, do a second read (up to 10s) specifically to catch the delayed prompt. Co-Authored-By: Claude Sonnet 4.6 --- modules/workflow_serial.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/workflow_serial.py b/modules/workflow_serial.py index 03e0bca..804190a 100644 --- a/modules/workflow_serial.py +++ b/modules/workflow_serial.py @@ -135,6 +135,15 @@ def _login_serial_console(ser: SerialPort) -> tuple: ok("Logged in to IOM console.") return True, password + # "Last login:" in the response confirms the password was accepted — + # the shell prompt just hasn't arrived yet (slow shell init or motd). + # Give it up to 10 more seconds to appear. + if "last login" in response.lower(): + response += _ANSI_RE.sub("", ser.read_until_quiet(quiet_period=1.5, timeout=10.0)) + if _at_shell_prompt(response): + ok("Logged in to IOM console.") + return True, password + error(f"Login failed. Console response: {response.strip()[:120]}") return False, ""