Skip to content

Conversation

@renecannao
Copy link
Contributor

Summary

Fixes the RPM packaging issue in openSUSE 16 where RPM v4.20.1 automatically generates a group(proxysql) dependency, causing installation failures.

Problem

The RPM spec file used useradd -r -U in the %post scriptlet, which triggered automatic group(proxysql) dependency generation in newer RPM versions. Since no package provides this virtual dependency, installation fails with:

Problem: 1: nothing provides 'group(proxysql)' needed by the to be installed proxysql-3.0.3-1.x86_64

Solution

Migrated to systemd-sysusers approach following openSUSE packaging guidelines:

  • Added systemd-sysusers configuration (proxysql.conf) for proper user/group creation
  • Updated RPM spec with correct macros:
    • Added %sysusers_requires and %sysusers_generate_pre macros
    • Modified %install section to install sysusers file
    • Removed manual useradd command from %post scriptlet
    • Added sysusers file to %files section

Changes

  • New file: docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.conf
  • Modified: docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec

This ensures compatibility with openSUSE 16's stricter dependency management while maintaining the same functionality.

Fixes: #5183

…ency

This commit resolves the packaging issue where RPM v4.20.1 in openSUSE 16
automatically creates a 'group(proxysql)' dependency when detecting useradd
commands in %post scriptlets, causing installation failures.

Problem:
- RPM spec file used 'useradd -r -U' in %post scriptlet
- This triggered automatic 'group(proxysql)' dependency generation
- No package provides this virtual dependency, causing install to fail

Solution:
- Added systemd-sysusers configuration file (proxysql.conf) for user/group creation
- Updated RPM spec to use proper openSUSE packaging guidelines:
  * Added %sysusers_requires and %sysusers_generate_pre macros
  * Modified %install section to install sysusers file
  * Removed manual useradd command from %post scriptlet
  * Added sysusers file to %files section

Changes:
- New file: docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.conf
- Modified: docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec

This follows openSUSE packaging guidelines for user/group management and
ensures compatibility with newer RPM versions' stricter dependency handling.

Fixes: #5183
@gemini-code-assist
Copy link

Summary of Changes

Hello @renecannao, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical RPM packaging issue specific to openSUSE 16, where the 'proxysql' package failed to install due to an automatically generated, unresolvable 'group(proxysql)' dependency. The fix involves a strategic shift from manual user creation to leveraging 'systemd-sysusers', a standard and robust method for managing system users and groups in modern Linux distributions. This ensures proper user provisioning and package compatibility with stricter dependency management systems.

Highlights

  • RPM Packaging Fix: Addresses an issue in openSUSE 16 where RPM v4.20.1 automatically generated a 'group(proxysql)' dependency, leading to installation failures.
  • Systemd-sysusers Adoption: Migrated the user/group creation mechanism from manual 'useradd' commands to the 'systemd-sysusers' approach, aligning with openSUSE packaging guidelines.
  • Spec File Updates: Modified the 'proxysql.spec' file to include '%sysusers_requires' and '%sysusers_generate_pre' macros, install the new 'proxysql.conf' during '%install', and remove the problematic 'useradd' call from '%post'.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses the RPM packaging issue for openSUSE by replacing the manual useradd command with the systemd-sysusers mechanism. This is the modern and recommended approach to prevent automatic dependency issues. The implementation is mostly correct, but I have two suggestions for the proxysql.spec file to improve its robustness and adherence to packaging best practices.


# systemd-sysusers macros for proper user/group handling
%sysusers_requires
%sysusers_generate_pre %{name}.conf $name %{name}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In the %sysusers_generate_pre macro, the second argument $name appears to be a shell variable, which might be unset during the execution of the %pre scriptlet. This could lead to incorrect user creation. It should likely be the RPM macro %{name} to ensure the package name proxysql is used for the user name, consistent with the third argument for the group name.

%sysusers_generate_pre %{name}.conf %{name} %{name}

%{_bindir}/*
%{_sysconfdir}/systemd/system/%{name}.service
%{_sysconfdir}/systemd/system/%{name}-initial.service
%{_sysusersdir}/%{name}.conf

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to openSUSE packaging guidelines, files in /usr/lib/sysusers.d should be marked as configuration files. This prevents user customizations from being overwritten on package upgrades. You should mark this file with %config(noreplace) to align with this best practice and be consistent with other configuration files in this spec file.

%config(noreplace) %{_sysusersdir}/%{name}.conf

@renecannao
Copy link
Contributor Author

@mirostauder Could you please verify that this PR fixes the openSUSE packaging issue?

The changes implement systemd-sysusers for user/group creation instead of using useradd in the %post scriptlet, which should resolve the automatic group(proxysql) dependency problem in RPM v4.20.1.

The solution follows openSUSE packaging guidelines by:

  • Adding a sysusers configuration file
  • Using proper %sysusers_requires and %sysusers_generate_pre macros
  • Removing the problematic useradd command from %post

Please test this on your openSUSE 16 environment and let us know if it resolves the installation issue. Thanks!

- Fix shell variable issue in %sysusers_generate_pre macro
  Use %{name} instead of $name to ensure proper RPM macro expansion

- Mark sysusers file as %config(noreplace) in %files section
  Protects user customizations from being overwritten on package upgrades
  Follows openSUSE packaging guidelines

These improvements increase robustness and adherence to packaging best practices.
@sonarqubecloud
Copy link

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opensuse16 rpm packaging - nothing provides 'group(proxysql)'

3 participants