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)
2020-04-02 09:40:26,907 - __init__.py[INFO]: Created new group ubuntu
2020-04-02 09:40:26,908 - __init__.py[DEBUG]: created group 'ubuntu' for user 'michal'
2020-04-02 09:40:26,908 - __init__.py[DEBUG]: Adding user michal
2020-04-02 09:40:26,909 - util.py[DEBUG]: Running hidden command to protect sensitive input/output logstring: ['useradd', 'michal', '--groups', 'ubuntu', '-m']
2020-04-02 09:40:27,480 - util.py[DEBUG]: Running command ['passwd', '-l', 'michal'] with allowed return codes [0] (shell=False, capture=True)
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.
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) cdrom,dialout, dip,floppy, lxd,netdev, plugdev, sudo,video' , '--shell', '/bin/bash', '-m'] python3/ dist-packages/ cloudinit/ distros/ __init_ _.py", line 481, in add_user subp(useradd_ cmd, logstring= log_useradd_ cmd) python3/ dist-packages/ cloudinit/ util.py" , line 2102, in subp util.ProcessExe cutionError: Unexpected error while running command. cdrom,dialout, dip,floppy, lxd,netdev, plugdev, sudo,video' , '--shell', '/bin/bash', '-m']
2020-04-02 09:40:26,907 - __init__.py[INFO]: Created new group ubuntu
2020-04-02 09:40:26,908 - __init__.py[DEBUG]: created group 'ubuntu' for user 'michal'
2020-04-02 09:40:26,908 - __init__.py[DEBUG]: Adding user michal
2020-04-02 09:40:26,909 - util.py[DEBUG]: Running hidden command to protect sensitive input/output logstring: ['useradd', 'michal', '--groups', 'ubuntu', '-m']
2020-04-02 09:40:27,480 - util.py[DEBUG]: Running command ['passwd', '-l', 'michal'] with allowed return codes [0] (shell=False, capture=True)
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,
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/
util.
File "/usr/lib/
cmd=args)
cloudinit.
Command: ['useradd', 'ubuntu', '--comment', 'Ubuntu', '--groups', 'adm,audio,
Exit code: 9
Reason: -
Stdout:
Stderr: useradd: group ubuntu exists - if you want to add this user to that group, use -g.