kubernetes/kops · error

error creating group: %v Output: %s

Error message

error creating group: %v
Output: %s

What it means

nodeup ran the system 'groupadd' binary to create an OS group and it exited non-zero. The error includes groupadd's combined output. This is a host-level OS user/group management failure during instance bootstrap.

Source

Thrown at upup/pkg/fi/nodeup/nodetasks/group.go:98

	if e.GID != nil {
		args = append(args, "-g", strconv.Itoa(*e.GID))
	}
	if e.System {
		args = append(args, "--system")
	}
	args = append(args, e.Name)
	return args
}

func (_ *GroupTask) RenderLocal(t *local.LocalTarget, a, e, changes *GroupTask) error {
	if a == nil {
		args := buildGroupaddArgs(e)
		klog.Infof("Creating group %q", e.Name)
		cmd := exec.Command("groupadd", args...)
		klog.V(2).Infof("running command: groupadd %s", strings.Join(args, " "))
		output, err := cmd.CombinedOutput()
		if err != nil {
			return fmt.Errorf("error creating group: %v\nOutput: %s", err, output)
		}
	} else {
		var args []string

		if changes.GID != nil {
			args = append(args, "-g", strconv.Itoa(*e.GID))
		}

		if len(args) != 0 {
			args = append(args, e.Name)
			klog.Infof("Reconfiguring group %q", e.Name)
			cmd := exec.Command("groupmod", args...)
			klog.V(2).Infof("running command: groupmod %s", strings.Join(args, " "))
			output, err := cmd.CombinedOutput()
			if err != nil {
				return fmt.Errorf("error reconfiguring group: %v\nOutput: %s", err, output)
			}
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the Output: section for groupadd's specific message
  2. If the group already exists, mark the task as not needing creation or use groupmod (update) instead
  3. Verify the group name/GID is valid and not conflicting: getent group <name>
  4. Ensure the base image ships groupadd (shadow-utils package)

Example fix

// before
Name: fi.String("docker") // image already has docker group -> groupadd fails
// after
Name: fi.String("docker"), SystemUser: fi.Bool(true) // align GID/name with image, or handle existing group
Defensive patterns

Strategy: validation

Validate before calling

// pre-check group existence on the target image
out, err := exec.Command("getent", "group", name).Output()
exists := err == nil

Try / catch

if err := t.RenderLocal(ctx, a, b); err != nil {
  if strings.Contains(err.Error(), "group already exists") {
    klog.Warningf("group %s pre-exists; converting to update path", name)
    return nil
  }
  return err
}

Prevention

When it happens

Trigger: RenderLocal of a Group task with create=true changes; exec.Command("groupadd", args...) returns an error (e.g. exit status 9, group already exists).

Common situations: The group already exists because the base image pre-creates it; groupadd is missing on minimal images; GID conflicts with an existing group; name violates OS naming rules.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/0eaf2431333fb027. Report an issue: GitHub.