From 7b2217caf3c720ca058e3525276d8b6e205fcacb Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Tue, 7 Jul 2026 15:47:11 +0200 Subject: [PATCH] qa/cephadm: fix hardcoded 'sshd' unit name in setup_ca_signed_keys setup_ca_signed_keys() hardcoded `systemctl restart sshd`, which fails on Debian/Ubuntu where the SSH server unit is named `ssh.service` rather than `sshd.service`. Try `ssh` first, fall back to `sshd` if that fails, grouped so the fallback only fires on restart failure and doesn't mask a failed config write. Fixes: https://tracker.ceph.com/issues/77991 Signed-off-by: Redouane Kachach --- qa/tasks/cephadm.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 6b08d8885e3..2c426044abb 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -628,12 +628,14 @@ def setup_ca_signed_keys(ctx, config): 'sudo', 'tee', '-a', '/etc/ssh/ca-key.pub', ]) # make sshd accept the CA signed key + # NOTE: the SSH server systemd unit is named 'ssh' on Debian/Ubuntu + # and 'sshd' on RHEL/CentOS/Rocky -- try both, but only after the + # config write itself has succeeded (grouped with parens so the + # restart fallback doesn't mask a failed config write). remote.run(args=[ - 'sudo', 'echo', 'TrustedUserCAKeys /etc/ssh/ca-key.pub', - run.Raw('|'), - 'sudo', 'tee', '-a', '/etc/ssh/sshd_config', - run.Raw('&&'), - 'sudo', 'systemctl', 'restart', 'sshd', + 'sudo', 'sh', '-c', + "echo 'TrustedUserCAKeys /etc/ssh/ca-key.pub' | sudo tee -a /etc/ssh/sshd_config && " + "(sudo systemctl restart ssh || sudo systemctl restart sshd)" ]) # generate a new key pair and sign the pub key to make a cert -- 2.47.3