← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1420018] [NEW] cannot create user with primary group if it exists already

 

Public bug reported:

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

   default_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 - __init__.py[DEBUG]: Adding user docker
2015-02-09 21:37:29,285 - util.py[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 - util.py[WARNING]: Failed to create user docker
2015-02-09 21:37:29,312 - util.py[DEBUG]: Failed to create user docker
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cloudinit/distros/__init__.py", line 360, in add_user
    util.subp(adduser_cmd, logstring=log_adduser_cmd)
  File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 1539, in subp
    cmd=args)
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

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Description changed:

  I am trying to add a user with a primary group that already exists with
  the same name as the user.
  
-    default_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
+    default_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 - __init__.py[DEBUG]: Adding user docker
  2015-02-09 21:37:29,285 - util.py[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 - util.py[WARNING]: Failed to create user docker
  2015-02-09 21:37:29,312 - util.py[DEBUG]: Failed to create user docker
  Traceback (most recent call last):
-   File "/usr/lib/python2.7/dist-packages/cloudinit/distros/__init__.py", line 360, in add_user
-     util.subp(adduser_cmd, logstring=log_adduser_cmd)
-   File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 1539, in subp
-     cmd=args)
+   File "/usr/lib/python2.7/dist-packages/cloudinit/distros/__init__.py", line 360, in add_user
+     util.subp(adduser_cmd, logstring=log_adduser_cmd)
+   File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 1539, in subp
+     cmd=args)
  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

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1420018

Title:
  cannot create user with primary group if it exists already

Status in Init scripts for use on cloud images:
  New

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

     default_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 - __init__.py[DEBUG]: Adding user docker
  2015-02-09 21:37:29,285 - util.py[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 - util.py[WARNING]: Failed to create user docker
  2015-02-09 21:37:29,312 - util.py[DEBUG]: Failed to create user docker
  Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/cloudinit/distros/__init__.py", line 360, in add_user
      util.subp(adduser_cmd, logstring=log_adduser_cmd)
    File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 1539, in subp
      cmd=args)
  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

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1420018/+subscriptions


Follow ups

References