Comment 2 for bug 1870310

Revision history for this message
Ryan Harper (raharper) wrote :

No, it's slighty more subtle.

It appears that you want to add a user $USER, and make them part of 'ubuntu' group , where 'ubuntu' group is the Ubuntu default user in cloud images.

If you intend to keep default user 'ubuntu' *and* add a user $USER, then you need two entries in your list. From the docs:

The ``users`` config key takes a list of users to configure. The first entry in
this list is used as the default user for the system. To preserve the standard
default user for the distro, the string ``default`` may be used as the first
entry of the ``users`` list. Each entry in the ``users`` list, other than a
``default`` entry, should be a dictionary of options for the user.

So:
multipass launch --cloud-init - <<EOF
users:
  - default
  - name: $USER
    groups: [ubuntu]
    ssh_authorized_keys:
      - $( cat ~/.ssh/id_rsa.pub )
EOF

And the error appears that since your $USER has group "ubuntu" when the default user was created, it tried to use the group 'ubuntu' which was already created. So another options would be:

multipass launch --cloud-init - <<EOF
users:
  - name: $USER
    groups: [$USER]
    ssh_authorized_keys:
      - $( cat ~/.ssh/id_rsa.pub )
EOF

That said, you can run 'cloud-init collect-logs' and attach the tarball we can see of something else is going on.