Skip to content

.deb package postinst script fails during Docker build due to missing systemd (regression in 1.300060.0b1248-1) #1895

@erees-embarkvet

Description

@erees-embarkvet

Description

The .deb package installation fails during Docker image builds because the postinst script attempts to interact with systemd, which is not available in the Docker build context.

  • Version affected: 1.300060.0b1248-1
  • Last known working version: 1.300059.0b1207-1

The apparent cause is the addition of a postinst script to the .deb package.

Steps to Reproduce

Minimal reproducible Dockerfile:

ARG PLATFORM=linux/amd64
FROM --platform=$PLATFORM debian:bookworm-20250929-slim AS base

ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt --assume-yes --no-install-recommends install wget ca-certificates
RUN wget -nv https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb
RUN dpkg -i amazon-cloudwatch-agent.deb

Build command:

docker build -f Dockerfile .

Expected Behavior

The .deb package should install successfully during Docker builds, similar to:

  • How version 1.300059.0b1207-1 installed without issues
  • How the .rpm package can be installed with rpm -i --noposttrans (as shown in your official LocalStack AL2 Dockerfile)

Actual Behavior

The build fails with:

dpkg: error processing package amazon-cloudwatch-agent (--install):
 installed amazon-cloudwatch-agent package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 amazon-cloudwatch-agent

Setting up amazon-cloudwatch-agent (1.300060.0b1248-1) ...
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
unknown init system

Environment

  • Host OS: macOS (Docker Desktop), Linux
  • Docker build context: Ubuntu 24.04, Debian bookworm
  • Package: amazon-cloudwatch-agent.deb from https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/
  • First observed: ~October 10, 2025

Current Workaround

We're currently working around this by removing the postinst script before configuring the package:

RUN wget -nv https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb \
    && dpkg --unpack ./amazon-cloudwatch-agent.deb \
    && rm -f /var/lib/dpkg/info/amazon-cloudwatch-agent.postinst \
    && dpkg --configure amazon-cloudwatch-agent

This mirrors the approach used in the RPM-based Dockerfiles with --noposttrans.

Notes

  • Version 1.300059.0b1207-1 worked correctly in Docker builds
  • Note: version 1.300060.0b1248-1 does not appear to have a corresponding GitHub release, which made it slightly more difficult to identify the cause.
  • The official .rpm package handles this case with rpm -i --noposttrans
  • The agent binaries install correctly and work when started manually in the container
  • This is purely a Docker build-time issue; runtime operation is unaffected

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions