jordansissel/fpm · error · FPM::InvalidPackageConfiguration

Unknown compression type '#{compression}' for control.tar in

Error message

Unknown compression type '#{compression}' for control.tar in deb source package #{package}

What it means

While reading a .deb, fpm derives the compression suffix of the control.tar member from the ar listing and only understands gz, bzip2, xz, zst and plain tar. Any other suffix falls into the else branch and raises FPM::InvalidPackageConfiguration naming the unrecognized compression type.

Source

Thrown at lib/fpm/package/deb.rb:365

      when "gz"
        controltar = "control.tar.gz"
        compression = "-z"
      when "bzip2","bz2"
        controltar = "control.tar.bz2"
        compression = "-j"
      when "xz"
        controltar = "control.tar.xz"
        compression = "-J"
      when "zst"
        controltar = "control.tar.zst"
        compression = "--use-compress-program 'zstd -d'"
      when 'tar'
        controltar = "control.tar"
        compression = ""
      when nil
        raise FPM::InvalidPackageConfiguration, "Missing control.tar in deb source package #{package}"
      else
        raise FPM::InvalidPackageConfiguration,
          "Unknown compression type '#{compression}' for control.tar in deb source package #{package}"
    end

    build_path("control").tap do |path|
      FileUtils.mkdir(path) if !File.directory?(path)
      # unpack the control.tar.{,gz,bz2,xz,zst} from the deb package into staging_path
      # Unpack the control tarball
      safesystem(ar_cmd[0] + " p #{package} #{controltar} | tar #{compression} -xf - -C #{path}")

      control = File.read(File.join(path, "control"))

      parse = lambda do |field|
        value = control[/^#{field.capitalize}: .*/]
        if value.nil?
          return nil
        else
          logger.info("deb field", field => value.split(": ", 2).last)
          return value.split(": ",2).last

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Inspect the member: ar t package.deb to see the exact control.tar.* name and suffix
  2. Repack the deb with a supported compression: dpkg-deb -R package.deb tmp && dpkg-deb -b -Zxz tmp fixed.deb, then convert fixed.deb
  3. If the producer can be changed, build control.tar with gz/xz/zst to stay compatible

Example fix

# before
fpm -s deb -t rpm tool.deb        # contains control.tar.lzma

# after
dpkg-deb -R tool.deb /tmp/tool
fpm -s dir ... # or repack compressed:
dpkg-deb -b -Zxz /tmp/tool /tmp/tool-fixed.deb
fpm -s deb -t rpm /tmp/tool-fixed.deb
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = %w[gz bz2 xz zst tar]   # suffixes fpm understands on control.tar
members = `ar t #{Shellwords.escape(path)}`.split("\n")
ctl = members.find { |m| m.start_with?('control.tar') }
suffix = ctl && ctl.split('.').last
abort "unsupported control.tar compression '.#{suffix}' -- repack with dpkg-deb -Zxz" unless SUPPORTED.include?(suffix)

Type guard

def supported_control_member?(ar_member)
  %w[gz bz2 xz zst tar].include?(ar_member.split('.').last)
end

Try / catch

begin
  pkg.input(path)
rescue FPM::InvalidPackageConfiguration => e
  raise unless e.message =~ /Unknown compression type .* control\.tar/
  system("dpkg-deb -R #{path} /tmp/repack && dpkg-deb -b -Zxz /tmp/repack #{path}")
  retry   # convert the repacked deb
end

Prevention

When it happens

Trigger: Converting a deb that contains control.tar.lzma or another exotic member (historically produced by some embedded/legacy tooling), or an ar member name with trailing characters (e.g. carriage returns from a mangled listing) so the extracted suffix string does not match any known case.

Common situations: Debs produced by old mkdebian/openembedded-style tooling using lzma compression; debs re-packed by scripts that rename members; conversion pipelines on unusual platforms where ar output formatting differs.

Related errors


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