dermotbradley / create-alpine-disk-image

Create cloud-init enabled Alpine disk images for physical machines (PCs & RPIs), VMs, and Cloud servers
GNU General Public License v2.0
93 stars 11 forks source link

Option '--ssh-public-key' is not working for vmware virtual type #19

Closed tomastzn closed 2 years ago

tomastzn commented 2 years ago

Created script with following options:

./create-alpine-disk-image --script-filename ../create-alpine-image-uefi-grub.sh --bootloader grub --boottype uefi --virtual vmware --timezone 'America/Toronto' --ssh-public-key ../user_id_rsa.pub --username someuser --password passw0rd --release 3.15 --insecure --short-hostname alpine-linux --os-device-media disk --os-device-type scsi --images-directory alpine-linux-images --image-filename alpine-linux-v3.15-vmware-eufi.img --cpu-vendor intel

Converted the image to vmdk type with following command:

qemu-img convert -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 alpine-linux-v3.15-vmware-eufi.img alpine-linux-v3.15-vmware-eufi.vmdk

Booted up a VM on ESXI host with the generated disk image and could not log in over SSH. Logging in locally with provided user name and password worked and the public key provided on the command line was no where to be found.

It seems the the option is either being ignored, or the default cloud-init is overwriting it at boot time, or it has to be provided by different means.

dermotbradley commented 2 years ago

Hi. I will modify the help text for this option as is only intended for physical machines (where it is used to create the user-data.yaml contents in the cidata partition).

For non-physical machines SSH public keys that are permitted for accessing any users are set via user-data sections global "ssh_authorized_keys:" setting (only applies for default user "alpine") or the "ssh_authorized_keys:" value inside the "users:" section.

I will add some logic to give an error if this option is specified for a non-physical machine.