jordansissel/fpm · error · FPM::InvalidPackageConfiguration

#{name}: source_date_epoch of 0 not supported.

Error message

#{name}: source_date_epoch of 0 not supported.

What it means

When building a deb with reproducibility enabled, fpm refuses a source_date_epoch of exactly 0 because Ruby's Zlib::GzipWriter cannot store an mtime of zero in the gzip header of control.tar.gz/data.tar.gz. The check is a literal string comparison against '0' and raises FPM::InvalidPackageConfiguration before any tarball is written.

Source

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

        logger.info("You gave --deb-shlibs but no --after-install, so " \
                     "I am adding an after-install script that runs " \
                     "ldconfig to update the system library cache")
        scripts[:after_install] = template("deb/ldconfig.sh.erb").result(binding)
      end
      if !script?(:after_remove)
        logger.info("You gave --deb-shlibs but no --after-remove, so " \
                     "I am adding an after-remove script that runs " \
                     "ldconfig to update the system library cache")
        scripts[:after_remove] = template("deb/ldconfig.sh.erb").result(binding)
      end
    end

    if attributes[:source_date_epoch].nil? and not attributes[:source_date_epoch_default].nil?
      attributes[:source_date_epoch] = attributes[:source_date_epoch_default]
    end
    if attributes[:source_date_epoch] == "0"
      logger.error("Alas, ruby's Zlib::GzipWriter does not support setting an mtime of zero.  Aborting.")
      raise FPM::InvalidPackageConfiguration, "#{name}: source_date_epoch of 0 not supported."
    end
    if not attributes[:source_date_epoch].nil? and not ar_cmd_deterministic?
      logger.error("Alas, could not find an ar that can handle -D option. Try installing recent gnu binutils. Aborting.")
      raise FPM::InvalidPackageConfiguration, "#{name}: ar is insufficient to support source_date_epoch."
    end
    if not attributes[:source_date_epoch].nil? and not tar_cmd_supports_sort_names_and_set_mtime?
      logger.error("Alas, could not find a tar that can set mtime and sort.  Try installing recent gnu tar. Aborting.")
      raise FPM::InvalidPackageConfiguration, "#{name}: tar is insufficient to support source_date_epoch."
    end

    systemd_file_extensions = [
        ".service",
        ".socket",
        ".device",
        ".mount",
        ".automount",
        ".swap",
        ".target",

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Use a fixed nonzero timestamp instead: --source-date-epoch 1, or the project's real release date (e.g. the last commit timestamp)
  2. Unset SOURCE_DATE_EPOCH=0 in the environment or stop mapping it to --source-date-epoch-default
  3. If bit-identical output is required, pin any constant nonzero epoch consistently across builds

Example fix

# before
SOURCE_DATE_EPOCH=0 fpm -s dir -t deb -n foo .
# -> source_date_epoch of 0 not supported

# after
SOURCE_DATE_EPOCH=1 fpm -s dir -t deb -n foo .
# or: fpm -s dir -t deb -n foo --source-date-epoch 1 .
Defensive patterns

Strategy: validation

Validate before calling

epoch = ENV['SOURCE_DATE_EPOCH']
if epoch == '0'
  warn 'SOURCE_DATE_EPOCH=0 unsupported by fpm/gzip; using 1'
  ENV['SOURCE_DATE_EPOCH'] = '1'
end

Type guard

def usable_source_date_epoch?(value)
  !value.nil? && value != '0' && value =~ /\A\d+\z/
end

Try / catch

begin
  pkg.output(out)
rescue FPM::InvalidPackageConfiguration => e
  raise unless e.message =~ /source_date_epoch of 0/
  pkg.attributes[:source_date_epoch] = '1'
  retry
end

Prevention

When it happens

Trigger: Running fpm --deb output with --source-date-epoch 0, or with --source-date-epoch-default picking up SOURCE_DATE_EPOCH=0 from the environment (common in reproducible-builds CI that normalizes to the epoch). Any nonzero value passes this particular check.

Common situations: CI pipelines exporting SOURCE_DATE_EPOCH=0 to make builds deterministic; templates that copy dpkg's 1970-01-01 convention; wrappers that read the env var blindly and pass it through.

Related errors


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