jordansissel/fpm · warning

Failed to find group for gid #{gid}

Error message

Failed to find group for gid #{gid}

What it means

fpm's Puppet output target converts each file's numeric gid into a group name for the generated manifest. gid2group calls Etc.getgrgid(gid); when the build host's group database has no entry for that gid, Ruby raises ArgumentError. fpm rescues it, logs this warning, and falls back to embedding the raw numeric gid in the puppet package. The build succeeds; only the manifest's group naming degrades.

Source

Thrown at lib/fpm/package/puppet.rb:115

  def uid2user(uid)
    begin
      pwent = Etc.getpwuid(uid)
      return pwent.name
    rescue ArgumentError => e
      # Invalid user id? No user? Return the uid.
      logger.warn("Failed to find username for uid #{uid}")
      return uid.to_s
    end
  end # def uid2user

  # Helper for group lookup
  def gid2group(gid)
    begin
      grent = Etc.getgrgid(gid)
      return grent.name
    rescue ArgumentError => e
      # Invalid user id? No user? Return the uid.
      logger.warn("Failed to find group for gid #{gid}")
      return gid.to_s
    end
  end # def uid2user
end # class FPM::Target::Puppet

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Create the missing group on the build host before running fpm: `getent group <gid> || groupadd -g <gid> <name>`
  2. Run fpm in an environment that shares the group database of the system that produced the input files
  3. chgrp the input tree to a group that exists on the build host, then rebuild
  4. Accept the numeric-gid fallback and verify the target puppet nodes have a group with that numeric gid

Example fix

# before: gid 12345 exists only on the original build host
fpm -s dir -t puppet -n myapp -v 1.0 ./pkg/

# after: make the gid resolvable where fpm runs
getent group 12345 || sudo groupadd -g 12345 appgrp
fpm -s dir -t puppet -n myapp -v 1.0 ./pkg/
Defensive patterns

Strategy: validation

Validate before calling

# Scan the tree you will hand to fpm for gids unresolvable on this host
require 'etc'
unresolved = Dir.glob('pkg/**/*').map { |f| File.lstat(f).gid }.uniq.reject do |gid|
  begin
    Etc.getgrgid(gid)
    false
  rescue ArgumentError
    true
  end
end
abort "unresolvable gids: #{unresolved.join(', ')}" unless unresolved.empty?

Type guard

def group_resolvable?(gid)
  Etc.getgrgid(gid)
  true
rescue ArgumentError
  false
end

Try / catch

begin
  name = Etc.getgrgid(gid).name
rescue ArgumentError
  logger.warn("gid #{gid} has no group entry; using numeric fallback")
  name = gid.to_s
end

Prevention

When it happens

Trigger: Running `fpm -s dir -t puppet` (or any -t puppet build) where staged files carry a gid with no matching entry in /etc/group on the machine running fpm. Typical with tarballs created on another host or inside a minimal Docker/CI image that lacks the site-specific group.

Common situations: CI containers or chroots with a trimmed /etc/group; source tarballs whose files were chgrp'd to LDAP/NIS-managed groups not resolvable in the build sandbox; gids reused from a different machine.


AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21). Data as JSON: /api/errors/bab48ce9929f43ed. Report an issue: GitHub.