cloud-init ssh key works but not user config
-
Hi!
Im have problems with cloud-init Custom config. SSH Key works but not Custom Config.
- Download focal-server-cloudimg-amd64.ova from
https://cloud-images.ubuntu.com/focal/current/ - Import it in Xen Orchestra (xo-server 5.79.5, xo-web 5.82.0)
- Convert the imported ova vm to template.
- Create VM from the template with Install Settings "SSH Key" and my ssh key.
- VM boots and i can ssh to the machine with user: ubuntu and my SSH key.
- mount /dev/xvdb /mnt/ and copy /mnt/user-data
#cloud-config hostname: ubuntu-focal-20.04-cloudimg ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA....- Create new VM from the template with Install Settings "User Config" and the config I copied from /mnt/user-data
- VM boots and i can NOT login with user: ubuntu and my SSH key.
So what is missing from the User Config that is in the SSH Key cloud-init?
Best regards,
Patrik - Download focal-server-cloudimg-amd64.ova from
-
Ok i figured it out. Seems like you need to have a valid or empty Network Config. When using the default commented out config it will not work. If i empty the Network Config field or uncomment all the lines it will work as expected.
Following works
User Config
#cloud-config hostname: testmachine2 ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA... packages: - xe-guest-utilitiesNetwork Config
network: version: 1 config: - type: physical name: eth0 subnets: - type: dhcp
Following does not work
User Config
#cloud-config hostname: testmachine2 ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA... packages: - xe-guest-utilitiesNetwork Config
#network: # version: 1 # config: # - type: physical # name: eth0 # subnets: # - type: dhcp -
Hi!
Thanks for the feedback. So I'm not sure to get it. If it's commented it doesn't work, but if it's empty, it does? That's weird

-
I can confirm this behavior :
- empty/generic network config (i.e basic DHCP) : OK
- commented : not OK
-
Can you check the actual diff in the Cloud init disk? If empty, no network file?
-
Commented :

Empty :

Seems consistent imo.
-
Regarding to logs on the machine where the network configuration is commented, there is this error :
2021-06-20 21:22:59,657 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceNoCloud.DataSourceNoCloudNet'> failedNo other errors, but it seems sufficient to broke the provisionning.
-
Hello,
Did you manage to make it work with a static addressing network ?
I tried this (where myip and mygateway are replaced by real values)network: version: 1 config: - type: physical name: eth0 subnets: - type: static address: myip/24 gateway: mygatewaywith no success.
and as I don't have an IP assignated and theses cloud images are passwordless by default I can't event log in from the console to troubleshoot.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login