Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

is_redhat() misses Rocky/Alma/CentOS Stream/Oracle Linux lsb_release IDs -> pkg dies "OS/Provider not supported"

Open Beginner friendly
#1,661 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
perl

Research direction

Look at Rex::Commands::Gather::is_redhat to see the @redhat_clones list and the regex matching. The issue mentions specific files: Rex::Hardware::Host::get_operating_system and Rex::Pkg->get. Start by adding the missing OS names to the list and fixing the comparison to be exact. Test by installing lsb_release on a Rocky/Alma system and running the provided rex command to verify pkg works.

Written by the indexing model from the issue text.

Description

Rex version: 1.16.1 (is_redhat unchanged on master)

Problem

On current RHEL rebuilds the OS detection depends on whether lsb_release is installed:

  • Without lsb_release, Rex::Hardware::Host::get_operating_system falls through to /etc/redhat-release and returns Redhat, so everything works.
  • With lsb_release, it returns lsb_release -s -i verbatim (only SUSE and ManjaroLinux are normalised). The IDs current rebuilds report there are not in @redhat_clones in Rex::Commands::Gather::is_redhat:
lsb_release -s -i source is_redhat
Rocky redhat-lsb-core 4.1 (Rocky 8/9) 0
RockyLinux EPEL lsb_release 3.2 0
AlmaLinux both 0
CentOSStream redhat-lsb-core 4.1 0
OracleLinux EPEL lsb_release 3.2 0

Because of that, Rex::Pkg->get does not map the host to Redhat. It tries Rex::Pkg::Rocky (and so on), and dies:

OS not supported (Rocky)
OS/Provider not supported

So any pkg / update_package_db call breaks on a Rocky/Alma host as soon as someone installs redhat-lsb-core or EPEL's lsb_release.

Second issue: the OS name is used as an unanchored, unescaped regex

if ( grep { /$os/i } @redhat_clones ) {

$os is the pattern and the list entries are the subjects. So a detected name matches whenever it is a substring of any entry: RedHatEnterprise only works because it is a substring of RedHatEnterpriseServer, and Red, Server or Enterprise would also return 1. Regex metacharacters in $os are interpreted rather than matched literally.

Suggested fix

  1. Add Rocky, RockyLinux, AlmaLinux, CentOSStream and OracleLinux (and RedHatEnterprise, which redhat-lsb-core 4.1 reports on RHEL 9) to @redhat_clones.
  2. Compare exactly: grep { lc($_) eq lc($os) } @redhat_clones.
  3. Optionally, make the detection independent of lsb_release by falling back to /etc/os-release ID / ID_LIKE (ID_LIKE contains rhel on all of the above). This would cover future rebuilds without a list change.

Items 1 and 2 are a small, safe change. Item 3 is the durable one.

Reproduce

# Rocky Linux 9
dnf install -y redhat-lsb-core   # or EPEL's lsb_release
rex -H rocky9 -e 'say get_operating_system(); say is_redhat() ? 1 : 0; pkg "curl", ensure => "present"'
# Rocky / 0 / OS/Provider not supported

(Found in Rex::GPU, which now works around it by not calling pkg on these hosts.)

Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RexOps/Rex

All issues in RexOps/Rex

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.