canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
3k stars 884 forks source link

users module does not allow ssh_import_id and ssh_authorized_keys at the same time #4045

Open ubuntu-server-builder opened 1 year ago

ubuntu-server-builder commented 1 year ago

This bug was originally filed in Launchpad as LP: #1997588

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2022-11-23T18:01:01.031774+00:00
date_fix_committed = None
date_fix_released = None
id = 1997588
importance = medium
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1997588
milestone = None
owner = nrobinaubertin
owner_name = Niels Robin-Aubertin
private = False
status = triaged
submitter = nrobinaubertin
submitter_name = Niels Robin-Aubertin
tags = []
duplicates = []

Launchpad user Niels Robin-Aubertin(nrobinaubertin) wrote on 2022-11-23T18:01:01.031774+00:00

I'm on ubuntu 22.04, using multipass 1.10.1 with a cloud-init file to instanciate a simple server:

users:
  - name: ubuntu
    ssh_authorized_keys:
      - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOkF+W1ETkZQr5PWhcugCVh3aSyNDFTYQRRblh7prGXN
    ssh_import_id:
      - lp:nrobinaubertin

I launch the instance with:

multipass launch -n simple_instance -d 10G -m 1G -c 1 --cloud-init cloud-init.yaml 22.04

And I check the authkeys file with:

multipass exec simple_instance -- cat /home/ubuntu/.ssh/authorized_keys

The key from ssh_authorized_keys is there but not the one from ssh_import_id. From the documentation website and the examples given here I would expect both keys to be present.

ubuntu-server-builder commented 1 year ago

Launchpad user Alberto Contreras(aciba) wrote on 2022-11-24T10:48:42.868010+00:00

Thanks, nrobinaubertin, for reporting this.

Could you please attach the instance logs[1]?

[1] https://cloudinit.readthedocs.io/en/latest/topics/bugs.html#collect-logs

ubuntu-server-builder commented 1 year ago

Launchpad user Niels Robin-Aubertin(nrobinaubertin) wrote on 2022-11-25T08:32:44.743706+00:00

Here is the log of an instance (created as written in the first message) Launchpad attachments: cloud-init.tar.gz

ubuntu-server-builder commented 1 year ago

Launchpad user Alberto Contreras(aciba) wrote on 2022-11-25T14:33:15.131987+00:00

Thanks, nrobinaubertin. I have reproduced this behavior on multipass and lxd.