Unable to SSH to new Virtual Machine after upgrading the template to RHEL 8.7 or 9

Solution Verified - Updated -

Issue

  • Unable to SSH to a Virtual Machine after upgrading it to RHEL 8.7, 9 or higher versions.
  • During first boot, sshd fails to start on new Virtual Machines:
Nov 29 08:49:18 rhel8 systemd[1]: Starting OpenSSH server daemon...
Nov 29 08:49:18 rhel8 sshd[2946]: Unable to load host key: /etc/ssh/ssh_host_rsa_key
Nov 29 08:49:18 rhel8 sshd[2946]: Unable to load host key: /etc/ssh/ssh_host_ecdsa_key
Nov 29 08:49:18 rhel8 sshd[2946]: Unable to load host key: /etc/ssh/ssh_host_ed25519_key
Nov 29 08:49:18 rhel8 sshd[2946]: sshd: no hostkeys available -- exiting.
Nov 29 08:49:18 rhel8 systemd[1]: sshd.service: Main process exited, code=exited, status=1/FAILURE
Nov 29 08:49:18 rhel8 systemd[1]: sshd.service: Failed with result 'exit-code'.
Nov 29 08:49:18 rhel8 systemd[1]: Failed to start OpenSSH server daemon.

Environment

  • Red Hat Enterprise Linux (RHEL) 9
    • cloud-init-22.1-5 or higher (9.1)
    • cloud-init-21.1-10 or higher (9.0)
  • Red Hat Enterprise Linux (RHEL) 8
    • cloud-init-22.1-5 or higher (8.7)
  • Configuration file cloud.cfg originally created on RHEL 8.4 with cloud-init-20.3-10 or lower
  • Red Hat Virtualization 4
  • Red Hat OpenStack Platform 16
  • Red Hat OpenShift Container Platform 4
  • Amazon AWS
  • Microsoft Azure
  • Google Cloud Platform

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content