From e23873888fe481c78cc96f3fd41dd2bdbdb2f9f0 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 9 Nov 2026 20:26:06 +0100 Subject: [PATCH] Serve installtodisk syncfiles with the sshd of the image After image2disk, installimage stopped the sshd of the image and moved port 22 to the initramfs sshd, chrooted into the install target, by sending that sshd HUP. The el9 initramfs only starts its sshd with debugssh, and on EL 9.8 it cannot start at all without sshd-session, so normally nothing listened on port 22. The syncfiles push of post.sh then failed with connection refused while the node still reported completed. Restart the sshd of the image instead, chrooted into the install target. It is always present and matches the OpenSSH helpers of the image, so this also works for images packed or captured before the initramfs fix. Wait for the old sshd to exit first, so the new one can bind port 22. --- .../profiles/default/scripts/installimage | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage b/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage index bec197a3..ae3f1e13 100644 --- a/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage +++ b/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage @@ -25,8 +25,6 @@ else done fi cd /sysroot/run -[ -f /run/sshd.pid ] && -cp /run/sshd.pid /tmp/dbgssh.pid chmod 0600 /sysroot/etc/ssh/ssh*key chroot /sysroot/ bash -c "/usr/sbin/sshd" chroot /sysroot/ bash -c "source /etc/confluent/functions; run_remote_python getinstalldisk" @@ -49,11 +47,14 @@ if [ -f /sysroot/etc/lvm/devices/system.devices ]; then fi chroot /sysroot /usr/lib/systemd/systemd-udevd --daemon chroot /sysroot bash -c "source /etc/confluent/functions; run_remote_python image2disk.py" -echo "Port 22" >> /etc/ssh/sshd_config -echo 'Match LocalPort 22' >> /etc/ssh/sshd_config -echo ' ChrootDirectory /sysroot/run/imginst/targ' >> /etc/ssh/sshd_config -kill $(cat /sysroot/var/run/sshd.pid) -[ -f /tmp/dbgssh.pid ] && kill -HUP $(cat /tmp/dbgssh.pid) +sshdpid=$(cat /sysroot/var/run/sshd.pid) +kill $sshdpid +# wait for the old sshd to release port 22 +for i in {1..50}; do kill -0 $sshdpid 2> /dev/null || break; sleep 0.1; done +# Serve the install target on port 22 for the syncfiles push of post.sh. Use +# the sshd of the image: the initramfs sshd only runs with debugssh and may +# lack helpers of the image's OpenSSH version, like sshd-session +chroot /sysroot /usr/sbin/sshd -p 22 -o ChrootDirectory=/run/imginst/targ cp /sysroot/etc/pki/ca-trust/source/anchors/* /sysroot/run/imginst/targ/etc/pki/ca-trust/source/anchors/ chroot /sysroot/run/imginst/targ update-ca-trust