Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

RPM uninstall fails on Amazon Linux 2023 with %preun scriptlet failed, exit status 1 because the %systemd_preun macro expands to invalid shell code when systemd-rpm-macros is not declared as a build dependency.

Changes

  • Uncommented BuildRequires: systemd-rpm-macros in rhel-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec
  • Uncommented BuildRequires: systemd-rpm-macros in suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec

Both spec files use %systemd_preun in their %preun section but had the required build dependency commented out, causing macro expansion to fail during package build.

Build Infrastructure Note

Build images must have systemd-rpm-macros package installed for rpmbuild to succeed with this change.

Original prompt

This section details on the original issue you should resolve

<issue_title>Uninstall from amazon linux 2023</issue_title>
<issue_description>This is the place to report a reproducible bug, documentation error or feature request for ProxySQL.

Support questions will not be answered here. For community support, use the Google forum: https://groups.google.com/forum/#!forum/proxysql

If you are submitting a reproducible bug report, please provide:

  • A clear description of the issue
  • ProxySQL version
  • OS version
  • The steps to reproduce the issue
  • The full ProxySQL error log (default location: /var/lib/proxysql/proxysql.log)

If this is a crashing bug, please also include:

  • The package used to install ProxySQL
  • The compressed proxysql binary
  • The compressed core dump (Note: if you're worried it may contain sensitive data, please contact us for information on sharing it securely: https://proxysql.com/contact-us/)

If the above information is not provided, this issue is likely to be closed.

Please use markdown to format any code or SQL: https://guides.github.com/features/mastering-markdown/

Thank you!


When uninstalling proxysql from RPM package proxysql-3.0.5-1.aarch64 and error happens and the uninstall fails

  • 3.0.5
  • amazon linux 2023, up to date

  • install proxysql from RPM dnf install proxysql
  • unistall proxysql dns remove proxysql

[root@ip-10-32-35-73 ~]# dnf remove proxysql
Dependencies resolved.
=============================================================================================================================================================================================================================================
 Package                                                  Architecture                                            Version                                                    Repository                                                 Size
=============================================================================================================================================================================================================================================
Removing:
 proxysql                                                 aarch64                                                 3.0.5-1                                                    @proxysql                                                 139 M

Transaction Summary
=============================================================================================================================================================================================================================================
Remove  1 Package

Freed space: 139 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                     1/1
  Running scriptlet: proxysql-3.0.5-1.aarch64                                                                                                                                                                                            1/1
/var/tmp/rpm-tmp.YmLxQl: line 2: fg: no job control
error: %preun(proxysql-3.0.5-1.aarch64) scriptlet failed, exit status 1

Error in PREUN scriptlet in rpm package proxysql
  Verifying        : proxysql-3.0.5-1.aarch64                                                                                                                                                                                            1/1

Failed:
  proxysql-3.0.5-1.aarch64

Error: Transaction failed

Investigations show that the BuildRequires line in docker/images/proxysql/rhel-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec should be un-commented, but for that to work the build images would also need systemd-rpm-macros insatlled</issue_description>

Comments on the Issue (you are @copilot in this section)

@renecannao Thank you for the report. Assigning to @mirostauder

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Summary by CodeRabbit

  • Chores
    • Enabled systemd-rpm-macros as an active build dependency in RHEL and SUSE package specifications to support proper system integration during the build process.

This fixes the uninstall failure on Amazon Linux 2023 and other RHEL-based
distributions. The %systemd_preun macro requires systemd-rpm-macros to be
declared as a build dependency.

Fixes uninstall error: "%preun scriptlet failed, exit status 1"
- Uncommented BuildRequires in rhel-compliant spec file
- Uncommented BuildRequires in suse-compliant spec file

Note: Build images must have systemd-rpm-macros package installed.

Co-authored-by: renecannao <[email protected]>
Copilot AI changed the title [WIP] Fix uninstall process for ProxySQL on Amazon Linux 2023 Fix RPM uninstall failure by enabling systemd-rpm-macros BuildRequires Jan 28, 2026
Copilot AI requested a review from renecannao January 28, 2026 16:08
@matt-horwood-mayden
Copy link

this will fail to build, the build images would also need systemd-rpm-macros insatlled

@renecannao
Copy link
Contributor

@CodeRabbit review

@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Two RPM spec files had a commented-out BuildRequires: systemd-rpm-macros line uncommented to enable this build dependency during the build process for both RHEL-compliant and SUSE-compliant Docker image builds.

Changes

Cohort / File(s) Summary
RPM Spec BuildRequires
docker/images/proxysql/rhel-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec, docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec
Uncommented BuildRequires: systemd-rpm-macros directive in both RHEL-compliant and SUSE-compliant RPM spec files, enabling systemd macro support during package build.

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A macro uncommented, so simple and neat,
systemd-rpm now makes the build complete,
Two specs aligned with a single small tweak,
Uninstalls shall work, no more errors to speak!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: uncommenting the BuildRequires for systemd-rpm-macros to fix RPM uninstall failures.
Linked Issues check ✅ Passed The PR changes directly address issue #5335 by uncommenting BuildRequires: systemd-rpm-macros in both RHEL and SUSE spec files to fix the %preun scriptlet failure on Amazon Linux 2023.
Out of Scope Changes check ✅ Passed All changes are scoped to uncommenting the systemd-rpm-macros BuildRequires lines in the two spec files, directly addressing the linked issue with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/uninstall-amazon-linux-2023

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@renecannao
Copy link
Contributor

Update on Complete Solution

This PR correctly addresses the spec file requirement by uncommenting BuildRequires: systemd-rpm-macros, which is necessary for proper RPM uninstallation on Amazon Linux 2023 and other RHEL-based distributions.

However, as noted by other commenters, this is only part of the complete solution. The Docker build images used to create these RPM packages must also have the systemd-rpm-macros package installed, or the builds will fail.

I've created a detailed issue in the docker-images repository that outlines the required changes:
ProxySQL/docker-images#15

The fix requires updating the Dockerfiles for all RHEL-based (CentOS, AlmaLinux, Fedora) and OpenSUSE build images to install the systemd-rpm-macros package.

Once those changes are implemented and the new build images are published, the complete solution will be:

  1. This spec file change (PR Fix RPM uninstall failure by enabling systemd-rpm-macros BuildRequires #5336)
  2. Updated build images with systemd-rpm-macros installed
  3. Rebuilt RPM packages using the updated build images

This will fully resolve the uninstallation failures on Amazon Linux 2023 and other systemd-based RHEL distributions.

renecannao added a commit to ProxySQL/docker-images that referenced this pull request Feb 3, 2026
This change adds the systemd-rpm-macros package to all RHEL-based and
OpenSUSE-based Docker build images. This is required for proper RPM
package uninstallation on Amazon Linux 2023 and other systemd-based
RHEL distributions, as the %systemd_preun macro in the RPM spec files
requires this package to be available in the build environment.

Fixes #15

Related to:
- ProxySQL issue sysown/proxysql#5335
- ProxySQL PR sysown/proxysql#5336
@mirostauder mirostauder added this to the Release 3.0.6 milestone Feb 5, 2026
@renecannao
Copy link
Contributor

@mirostauder : please test this

@mirostauder mirostauder force-pushed the copilot/uninstall-amazon-linux-2023 branch from 60bdc6f to b099ff5 Compare February 6, 2026 09:21
@mirostauder mirostauder force-pushed the copilot/uninstall-amazon-linux-2023 branch from b099ff5 to ada28f0 Compare February 6, 2026 10:10
@mirostauder
Copy link
Collaborator

retest this please

@mirostauder mirostauder marked this pull request as ready for review February 7, 2026 21:40
@mirostauder
Copy link
Collaborator

retest this please

1 similar comment
@mirostauder
Copy link
Collaborator

retest this please

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uninstall from amazon linux 2023

4 participants