#348 default user for qcow2 base cloud image
Closed: fixed 5 months ago by lrossett. Opened 7 months ago by lrossett.


I am trying to modify a base fedora cloud image using packer [1] but I am getting stuck when packer tries to ssh into the vm and I can't find a valid credential as well.

Is there a default username/password for that image?


[1] - https://download.fedoraproject.org/pub/fedora/linux/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2

There is no default username and password on these images [1] as they are meant to be configured via cloud-init. If you just want to play around locally, I would use the Fedora Cloud Vagrant image [2] which is configured with this kickstart [3] and boot it with Vagrant.

If you are looking to really customize an a qcow2 image, I would configure it with packer and a kickstart file. I have a working example for CentOS 8 here [4] that most likely could be modified to use the Fedora 34 ISO and a modified kickstart file from the fedora-cloud-* files [5]. Then you could use the QEMU output [6] in packer to build and write out a qcow2 image with a user and SSH key added to /home/yourcooluser/.ssh/authorized_keys.

Hope this helps!

[1] https://pagure.io/fedora-kickstarts/blob/main/f/fedora-cloud-base.ks#_1
[2] https://app.vagrantup.com/fedora/boxes/34-cloud-base
[3] https://pagure.io/fedora-kickstarts/blob/main/f/fedora-cloud-base-vagrant.ks
[4] https://github.com/jdoss/imgbld/blob/master/centos.json
[5] https://pagure.io/fedora-kickstarts/
[6] https://www.packer.io/docs/builders/qemu

You can also use virt-sysprep (dnf install guestfs-tools) to add a user and inject a SSH key:

$ virt-sysprep -a Fedora-Cloud-Base-34-1.2.x86_64.qcow2 --run-command 'useradd jdoss' --ssh-inject jdoss:file:/home/jdoss/.ssh/id_ed25519_sk.pub

I will note that if you just give it a simple cloud-init file with an SSH key it will default to apply it to a user with username fedora. If you launch a web instance (i.e. AWS) and an SSH key is picked up from the metadata service then the user it's applied to is fedora. If someone were to ask me what the default username on Fedora Cloud was I would say fedora, but Joe's answer is also correct.

Thanks the input, I will take a look at those ks files.

I tried to use packer together with the fedora base cloud ks file (using the fedora server iso) but I gets stuck on "starting automated install..." - do you know if there is a way to tell the fedora installer to show what's going while the installer is running in text mode?

I don't think the kickstarts work with Anaconda normally, but you might want to try the Vagrant one, as that one should configure every spoke that Anaconda expects for autoinstall.

Metadata Update from @davdunc:
- Issue tagged with: meeting

6 months ago

Hey all, I was able to make it work with the fedora base server image and a ks file!

Thanks for the help, closing the ticket now.

Metadata Update from @lrossett:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

5 months ago

Login to comment on this ticket.