Help Accessing Rocky-9-EC2-Base Image via Packer/QEMU

Hello Rocky Linux community,

I’m trying to initialize the official image Rocky-9-EC2-Base-9.4-20240609.0.x86_64.qcow2 using Packer with the QEMU builder, but I’m having trouble logging in via SSH.

Context:

Issue:
It is unclear what the default username is to access the image. I have tried using both rocky and ec2-user for SSH login without success.
Additionally, I would like to know if there is any specific configuration I need to adjust in my Packer template to successfully log into the instance.

What I’ve Tried:

  • Configuring the Packer template with ssh_username set to rocky and, subsequently, ec2-user.
  • Reviewing official documentation and previous forum posts without finding a definitive answer.

Question:
Has anyone worked with this image and can confirm the default username for login? Is there any additional configuration required in Packer (or on the image) to inject my SSH key or enable access?

Thank you in advance for your attention and help!

Welcome to the forums!

It will always be rocky on our images when setting up the image with cloud-init. There are no passwords nor keys applied on our images.

There are no default credentials. The expectation with our images that folks will utilize cloud-init by default to set an SSH key for the rocky user (or a password, if that’s what they desire). I would investigate packer to see if it will let you send cloud-init data in some way to put in an ssh key or set a temporary password for the rocky user so that way you can use the ssh_* parameters of packer.

Hope this helps

1 Like

On a Linux system you can install virt-rescue which in EL9 comes in libguestfs-rescue package. You can use this to get into the image in rescue mode, and then configure yourself a root or user password, or add your SSH key.

After this you can then use the image. Another option in case you can’t do any cloud-init stuff.

1 Like

Thanks for the tips guys, I already have a direction here.

I’m going to resume testing with the packer, I’ll post the solutions here later.