docs: user-groups uses - instead of _

Bug #1420018 reported by Samuel Jean
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

I am trying to add a user with a primary group that already exists with the same name as the user.

     name: docker
     lock_passwd: True
     gecos: Docker Administrator
     no-user-group: true
     primary-group: docker
     groups: [adm, audio, cdrom, dialout, dip, floppy, netdev, plugdev, sudo, video]
     sudo: ["ALL=(ALL) NOPASSWD:ALL"]
     shell: /bin/bash

2015-02-09 21:37:29,285 -[DEBUG]: Adding user docker
2015-02-09 21:37:29,285 -[DEBUG]: Running hidden command to protect sensitive input/output logstring: ['useradd', 'docker', '--shell', '/bin/bash', '--comment', 'Docker Administrator', '--groups', 'adm,audio,cdrom,dialout,dip,floppy,netdev,plugdev,sudo,video', '-m']
2015-02-09 21:37:29,312 -[WARNING]: Failed to create user docker
2015-02-09 21:37:29,312 -[DEBUG]: Failed to create user docker
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cloudinit/distros/", line 360, in add_user
    util.subp(adduser_cmd, logstring=log_adduser_cmd)
  File "/usr/lib/python2.7/dist-packages/cloudinit/", line 1539, in subp
ProcessExecutionError: Unexpected error while running command.
Command: ['useradd', 'docker', '--shell', '/bin/bash', '--comment', 'Docker Administrator', '--groups', 'adm,audio,cdrom,dialout,dip,floppy,netdev,plugdev,sudo,video', '-m']
Exit code: 9
Reason: -
Stdout: ''
Stderr: 'useradd: group docker exists - if you want to add this user to that group, use -g.\n'

backdoor@docker:~$ dpkg -l | grep cloud-init
ii cloud-init 0.7.5-0ubuntu1.3 all Init scripts for cloud instances

Tags: docs bitesized

Related branches

Samuel Jean (jseun)
description: updated
Revision history for this message
Samuel Jean (jseun) wrote :

Finally, the no_user_group works as expected.

From :

        adduser_flags = {
            "no_user_group": '--no-user-group',
            "system": '--system',
            "no_log_init": '--no-log-init',

However, the doc at speaks of no-user-group which does not work. The same would apply to no-log-init and no-create-home which should be no_log_init and no_create_home in the doc.

Am I missing something? Maybe this is expected to work with both underscores and dashes.

Revision history for this message
Joshua Powers (powersj) wrote :

Thank you for taking the time to report this bug. In an effort to keep
an up-to-date and valid list of bugs to work on, I have reviewed this
report verifying it still requires effort and occurs on a supported
version of Ubuntu.

It looks like you are correct and the docs say to use '-' when the
code is specifically looking for '_'.

The cloud-config-user-groups.txt file should be updated to reflect
the proper usage.

summary: - cannot create user with primary group if it exists already
+ docs: user-groups uses - instead of _
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Low
tags: added: bitesized docs
do3meli (d-info-e)
Changed in cloud-init:
assignee: nobody → do3meli (d-info-e)
do3meli (d-info-e)
Changed in cloud-init:
status: Confirmed → In Progress
Revision history for this message
Chad Smith (chad.smith) wrote :

An upstream commit landed for this bug.

To view that commit see the following URL:

Changed in cloud-init:
status: In Progress → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote : Fixed in cloud-init version 18.3.

This bug is believed to be fixed in cloud-init in version 18.3. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers