diff -Nru uvtool-0~git178/debian/changelog uvtool-0~git178/debian/changelog --- uvtool-0~git178/debian/changelog 2022-02-24 23:02:02.000000000 +0100 +++ uvtool-0~git178/debian/changelog 2024-02-02 10:34:16.000000000 +0100 @@ -1,3 +1,10 @@ +uvtool (0~git178-0ubuntu1.1) mantic; urgency=medium + + [ Thibault Ferrante ] + * Continue waiting while pam_nologin is active in the VM (LP: #2039441) + + -- Agathe Porte Fri, 02 Feb 2024 10:34:16 +0100 + uvtool (0~git178-0ubuntu1) jammy; urgency=medium [ Christian Ehrhardt ] diff -Nru uvtool-0~git178/debian/patches/series uvtool-0~git178/debian/patches/series --- uvtool-0~git178/debian/patches/series 2022-02-24 22:54:06.000000000 +0100 +++ uvtool-0~git178/debian/patches/series 2024-02-02 10:33:54.000000000 +0100 @@ -1,2 +1,3 @@ fix-iso-format remove-precise-test-workaround +uvtool-wait_Wait-for-login-to-be-ready.patch diff -Nru uvtool-0~git178/debian/patches/uvtool-wait_Wait-for-login-to-be-ready.patch uvtool-0~git178/debian/patches/uvtool-wait_Wait-for-login-to-be-ready.patch --- uvtool-0~git178/debian/patches/uvtool-wait_Wait-for-login-to-be-ready.patch 1970-01-01 01:00:00.000000000 +0100 +++ uvtool-0~git178/debian/patches/uvtool-wait_Wait-for-login-to-be-ready.patch 2024-02-02 10:33:54.000000000 +0100 @@ -0,0 +1,96 @@ +From 35dc66e269abb713472701980cbec8b09ef4677c Mon Sep 17 00:00:00 2001 +From: Thibault Ferrante +Date: Mon, 16 Oct 2023 22:06:56 +0200 +Subject: uvtool/wait: Wait for login to be ready + +Following LP: #2013403, cloud-init now prevent login until the system +is fully provisioned, which create a situation where we can connect to +ssh but not login. + +This fix it by capturing exit code and retrying if a specific exit code +occurs. + +We don't enable ssh retries for other kind of errors. + +BugLink: https://bugs.launchpad.net/bugs/2039441 +Signed-off-by: Thibault Ferrante +--- + uvtool/libvirt/kvm.py | 55 +++++++++++++++++++++++++++++++-------------------- + 1 file changed, 34 insertions(+), 21 deletions(-) + +diff --git a/uvtool/libvirt/kvm.py b/uvtool/libvirt/kvm.py +index 218a7f0..1bc0d63 100755 +--- a/uvtool/libvirt/kvm.py ++++ b/uvtool/libvirt/kvm.py +@@ -37,6 +37,7 @@ import string + import subprocess + import sys + import tempfile ++import time + import uuid + import yaml + +@@ -963,27 +964,39 @@ def main_ssh(parser, args, default_login_name='ubuntu'): + + def main_wait_remote(parser, args): + with open(args.remote_wait_script, 'rb') as wait_script: +- try: +- ssh( +- args.name, +- args.remote_wait_user, +- [ +- 'env', +- 'UVTOOL_WAIT_INTERVAL=%s' % args.interval, +- 'UVTOOL_WAIT_TIMEOUT=%s' % args.timeout, +- 'sh', +- '-' +- ], +- checked=True, +- stdin=wait_script, +- private_key_file=args.ssh_private_key_file, +- insecure=args.insecure, +- ) +- except InsecureError: +- raise CLIError( +- "ssh public host key not found. Use " +- "--insecure iff you trust your network path to the guest." +- ) ++ timeout = time.time() + args.timeout ++ while True: ++ try: ++ ssh( ++ args.name, ++ args.remote_wait_user, ++ [ ++ 'env', ++ 'UVTOOL_WAIT_INTERVAL=%s' % args.interval, ++ 'UVTOOL_WAIT_TIMEOUT=%s' % args.timeout, ++ 'sh', ++ '-' ++ ], ++ checked=True, ++ stdin=wait_script, ++ private_key_file=args.ssh_private_key_file, ++ insecure=args.insecure, ++ ) ++ break ++ except InsecureError: ++ raise CLIError( ++ "ssh public host key not found. Use " ++ "--insecure iff you trust your network path to the guest." ++ ) ++ except subprocess.CalledProcessError as e : ++ if e.returncode == 255: ++ if time.time() < timeout: ++ time.sleep(args.interval) ++ else: ++ raise CLIError( ++ "timed out waiting for ssh to open on %s." % args.name) from e ++ else: ++ raise e + + + def main_wait(parser, args): +-- +cgit v1.2.3 +