-
Notifications
You must be signed in to change notification settings - Fork 818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicit addition of a user's primary_group breaks the user creation #3641
Comments
Launchpad user Michael Hudson-Doyle(mwhudson) wrote on 2020-04-02T19:23:13.976135+00:00 Isn't this just the fact that if you specify a user the default user doesn't get created? |
Launchpad user Ryan Harper(raharper) wrote on 2020-04-02T20:01:07.278247+00:00 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 So:
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
That said, you can run 'cloud-init collect-logs' and attach the tarball we can see of something else is going on. |
Launchpad user Michał Sawicz(saviq) wrote on 2020-04-03T07:17:31.615822+00:00
Yes, that's exactly it. And I had the tarball collected, just forgot to attach, sorry! |
Launchpad user Michał Sawicz(saviq) wrote on 2020-04-03T07:18:11.857616+00:00 Launchpad attachments: cloud-init.tar.gz |
Launchpad user Michał Sawicz(saviq) wrote on 2020-04-03T07:20:06.085749+00:00
This is actually what happens with Multipass, since we enforce the |
Launchpad user Ryan Harper(raharper) wrote on 2020-04-03T14:48:44.645990+00:00 Thanks for the logs; here we can see that the the specified user is created prior to the default user; and since their groups overlap; there's a failure. 2020-04-02 09:40:26,700 - util.py[DEBUG]: Running command ['groupadd', 'ubuntu'] with allowed return codes [0] (shell=False, capture=True) |
Launchpad user Michał Sawicz(saviq) wrote on 2020-04-04T14:55:12.102893+00:00 It would be a similar problem if we just had a: groups:
|
This bug was originally filed in Launchpad as LP: #1870310
Launchpad details
Launchpad user Michał Sawicz(saviq) wrote on 2020-04-02T09:44:14.630245+00:00
$ multipass launch --cloud-init - <<EOF
users:
groups: [ubuntu]
ssh_authorized_keys:
EOF
times out due to missing
ubuntu
user$ multipass ls
find the IP
$ ssh $IP
/var/log/cloud-init.log
2020-04-02 09:40:27,551 - init.py[DEBUG]: Adding user ubuntu
2020-04-02 09:40:27,551 - util.py[DEBUG]: Running hidden command to protect sensitive input/output logstring: ['useradd', 'ubuntu', '--comment', 'Ubuntu', '--groups', 'adm,audio,cdrom,dialout,dip,floppy,lxd,netdev,plugdev,sudo,video', '--shell', '/bin/bash', '-m']
2020-04-02 09:40:27,555 - util.py[WARNING]: Failed to create user ubuntu
2020-04-02 09:40:27,556 - util.py[DEBUG]: Failed to create user ubuntu
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/distros/init.py", line 481, in add_user
util.subp(useradd_cmd, logstring=log_useradd_cmd)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2102, in subp
cmd=args)
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['useradd', 'ubuntu', '--comment', 'Ubuntu', '--groups', 'adm,audio,cdrom,dialout,dip,floppy,lxd,netdev,plugdev,sudo,video', '--shell', '/bin/bash', '-m']
Exit code: 9
Reason: -
Stdout:
Stderr: useradd: group ubuntu exists - if you want to add this user to that group, use -g.
2020-04-02 09:40:27,560 - handlers.py[DEBUG]: finish: init-network/config-users-groups: FAIL: running config-users-groups with frequency once-per-instance
It looks as if a user's primary_group is created prior to that user being created, the user addition fails.
The text was updated successfully, but these errors were encountered: