[Bug 1562918] Re: cloud-init does not create defined users
Please ignore my last comment (#4). When specifying an explicit primary-group it should of course already exist, before useradd can create the user. When removing the primary-group statement from the user definition the user is created just fine (including it's primary group with the same name as the user). For me this has fixed the issue I've reported. -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/1562918 Title: cloud-init does not create defined users To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1562918/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs
[Bug 1562918] Re: cloud-init does not create defined users
When I remove the groups: part I get the following errors in the /var/log/cloud-init.log: Mar 31 22:35:45 test [CLOUDINIT] stages.py[DEBUG]: Running module users-groups () with frequency once-per-instance Mar 31 22:35:45 test [CLOUDINIT] handlers.py[DEBUG]: start: init-network/config-users-groups: running config-users-groups with frequency once-per-instance Mar 31 22:35:45 test [CLOUDINIT] util.py[DEBUG]: Writing to /var/lib/cloud/instances/nocloud/sem/config_users_groups - wb: [420] 24 bytes Mar 31 22:35:45 test [CLOUDINIT] helpers.py[DEBUG]: Running config-users-groups using lock () Mar 31 22:35:45 test [CLOUDINIT] __init__.py[DEBUG]: Adding user ansible Mar 31 22:35:45 test [CLOUDINIT] util.py[DEBUG]: Running hidden command to protect sensitive input/output logstring: ['useradd', 'ansible', '--shell', '/bin/bash', '--gid', 'ansible', '--comment', 'Ansible', '--groups', 'sudo', '-m'] Mar 31 22:35:45 test [CLOUDINIT] util.py[WARNING]: Failed to create user ansible Mar 31 22:35:46 test [CLOUDINIT] util.py[DEBUG]: Failed to create user ansible#012Traceback (most recent call last):#012 File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 406, in add_user#012util.subp(adduser_cmd, logstring=log_adduser_cmd)#012 File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1704, in subp#012 cmd=args)#012cloudinit.util.ProcessExecutionError: Unexpected error while running command.#012Command: ['useradd', 'ansible', '--shell', '/bin/bash', '--gid', 'ansible', '--comment', 'Ansible', '--groups', 'sudo', '-m']#012Exit code: 6#012Reason: -#012Stdout: ''#012Stderr: "useradd: group 'ansible' does not exist\n" Mar 31 22:35:46 test [CLOUDINIT] handlers.py[DEBUG]: finish: init-network/config-users-groups: FAIL: running config-users-groups with frequency once-per-instance Mar 31 22:35:46 test [CLOUDINIT] util.py[WARNING]: Running module users-groups () failed Mar 31 22:35:46 test [CLOUDINIT] util.py[DEBUG]: Running module users-groups () failed#012Traceback (most recent call last):#012 File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 735, in _run_modules#012freq=freq)#012 File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 70, in run#012 return self._runners.run(name, functor, args, freq, clear_on_fail)#012 File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 199, in run#012 results = functor(*args)#012 File "/usr/lib/python3/dist-packages/cloudinit/config/cc_users_groups.py", line 34, in handle#012cloud.distro.create_user(user, **config)#012 File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 419, in create_user#012self.add_user(name, **kwargs)#012 File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 409, in add_user#01 2raise e#012 File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 406, in add_user#012util.subp(adduser_cmd, logstring=log_adduser_cmd)#012 File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1704, in subp#012 cmd=args)#012cloudinit.util.ProcessExecutionError: Unexpected error while running command.#012Command: ['useradd', 'ansible', '--shell', '/bin/bash', '--gid', 'ansible', '--comment', 'Ansible', '--groups', 'sudo', '-m']#012Exit code: 6#012Reason: -#012Stdout: ''#012Stderr: "useradd: group 'ansible' does not exist\n" Mar 31 22:35:46 test [CLOUDINIT] stages.py[DEBUG]: Running module ssh () with frequency once-per-instance -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/1562918 Title: cloud-init does not create defined users To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1562918/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs
[Bug 1562918] Re: cloud-init does not create defined users
I've applied the diff. The defined users are now being created, but only when their primary group is created first using the groups statement. The users are also correctly added to the specified additionals groups. I've pasted my userdata below: #cloud-config groups: - ansible - sysop users: - name: sysop gecos: "System Operator" primary-group: sysop groups: "sudo,adm" shell: /bin/bash lock-passwd: false passwd: - name: ansible gecos: Ansible primary-group: ansible groups: sudo shell: /bin/bash -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/1562918 Title: cloud-init does not create defined users To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1562918/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs
[Bug 1562918] Re: cloud-init does not create defined users
** Branch linked: lp:~smoser/cloud-init/trunk.1562918 -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/1562918 Title: cloud-init does not create defined users To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1562918/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs
[Bug 1562918] Re: cloud-init does not create defined users
Leander, I'd appreciate you giving the linked branch a test if you're up for it. I dont have time at the moment and probably wont until next week. You can either build a deb with: ./packages/bddeb or just apply the diff (copy in the new cloudinit/distros/__init__.py Thanks. -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/1562918 Title: cloud-init does not create defined users To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1562918/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs
[Bug 1562918] Re: cloud-init does not create defined users
Leander, Thanks for the bug report. Sorry for the regression. I suspect that you can work around the issue by just putting your user into a group. Ie, you add 2 groups, but your user is not in either one of them. We'll get this fixed. -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/1562918 Title: cloud-init does not create defined users To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1562918/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs
[Bug 1562918] Re: cloud-init does not create defined users
** Changed in: cloud-init (Ubuntu) Status: New => Confirmed ** Changed in: cloud-init (Ubuntu) Importance: Undecided => High -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/1562918 Title: cloud-init does not create defined users To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1562918/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs