Skip to content

Build Images Need systemd-rpm-macros for Proper RPM Uninstall Support #15

@renecannao

Description

@renecannao

Issue Description

The RPM spec files for ProxySQL have been updated to uncomment BuildRequires: systemd-rpm-macros to fix uninstallation failures on Amazon Linux 2023 and other RHEL-based distributions. However, the build images used to create these RPM packages also need to have the systemd-rpm-macros package installed, or the builds will fail.

Problem Details

When building RPM packages for RHEL-based distributions (CentOS, AlmaLinux, Fedora, OpenSUSE), the %systemd_preun macro requires the systemd-rpm-macros package to be available in the build environment. Without this package, the macro expands to invalid shell code, causing uninstallation to fail with errors like:

/var/tmp/rpm-tmp.YmLxQl: line 2: fg: no job control

This is related to PR #5336 in the main ProxySQL repository: sysown/proxysql#5336
And the corresponding issue: sysown/proxysql#5335

Required Changes

The following Docker build images need to be updated to install the systemd-rpm-macros package:

For RHEL-based distributions (CentOS, AlmaLinux, Fedora):

Add systemd-rpm-macros to the package installation command.

Current code in RHEL-based Dockerfiles:

# gcc & build tools
RUN yum install -y \
	make cmake automake bison flex \
	git patch \
	bzip2 tar wget \
	gcc gcc-c++ \
	libtool \
	rpm-build \
	python3 \
	pkg-config

Required change:

# gcc & build tools
RUN yum install -y \
	make cmake automake bison flex \
	git patch \
	bzip2 tar wget \
	gcc gcc-c++ \
	libtool \
	rpm-build \
	python3 \
	pkg-config \
	systemd-rpm-macros

Affected files:

  1. build-images/build-centos9/Dockerfile
  2. build-images/build-centos10/Dockerfile
  3. build-images/build-almalinux8/Dockerfile
  4. build-images/build-almalinux9/Dockerfile
  5. build-images/build-almalinux10/Dockerfile
  6. build-images/build-fedora41/Dockerfile
  7. build-images/build-fedora42/Dockerfile
  8. build-images/build-fedora43/Dockerfile

For OpenSUSE-based distributions:

Add systemd-rpm-macros to the package installation command.

Current code in OpenSUSE Dockerfiles:

# gcc & build tools
RUN zypper install -y \
    make cmake automake bison flex \
    git patch \
    bzip2 gzip tar wget \
    gcc gcc-c++ \
    rpm-build \
    python3 \
    libtool \
    pkg-config

Required change:

# gcc & build tools
RUN zypper install -y \
    make cmake automake bison flex \
    git patch \
    bzip2 gzip tar wget \
    gcc gcc-c++ \
    rpm-build \
    python3 \
    libtool \
    pkg-config \
    systemd-rpm-macros

Affected files:

  1. build-images/build-opensuse15/Dockerfile
  2. build-images/build-opensuse16/Dockerfile

Impact

Without these changes:

  1. RPM builds will fail when BuildRequires: systemd-rpm-macros is uncommented in the spec files
  2. Users will continue to experience uninstallation failures on Amazon Linux 2023 and other RHEL-based distributions
  3. The fix in PR #5336 in the main ProxySQL repository will be incomplete

Solution

Update all affected Dockerfiles to install the appropriate systemd-rpm-macros package for their respective distributions. After updating the build images, rebuild and publish the Docker images, then rebuild the ProxySQL RPM packages using the updated images.

Verification

After implementing these changes, verify that:

  1. The Docker images build successfully
  2. ProxySQL RPM packages can be built using these images
  3. The built packages can be installed and uninstalled without errors on Amazon Linux 2023 and other RHEL-based distributions
  4. The %preun scriptlet executes correctly during uninstallation

Additional Notes

This is a critical fix for users on Amazon Linux 2023 and other systemd-based RHEL distributions who are experiencing uninstallation failures. The change is minimal and only adds a required dependency for proper RPM package functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions