Skip to content

Remove unneeded packages from the Collector image.#2970

Open
ovalenti wants to merge 8 commits intomasterfrom
ovalenti/orphaner
Open

Remove unneeded packages from the Collector image.#2970
ovalenti wants to merge 8 commits intomasterfrom
ovalenti/orphaner

Conversation

@ovalenti
Copy link
Contributor

@ovalenti ovalenti commented Feb 24, 2026

Description

Our base image contains some packages that are not needed by Collector. This PR introduces 'orphaner', a tool able to use the RPM dependency graph to list all packages that are not part of Collector deps. Then we uninstall them.

We don't use the available python/perl tools because they have dependencies themselves.
'orphaner' uses only librpm.

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

Testing done
With this change, on ubi9, the Collector image archive decreases size from 106MB to 92MB.
Notable libraries going away:

  • libbz2
  • libblkid
  • gio / glib / gmodule / gobject
  • gmp
  • gnutls
  • gss / krb5
  • json-c
  • smartcols
  • systemd
  • udev
  • xml2
  • and some fonts

@ovalenti ovalenti self-assigned this Feb 24, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 27.38%. Comparing base (a9ed8fe) to head (9ab7fd2).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2970   +/-   ##
=======================================
  Coverage   27.38%   27.38%           
=======================================
  Files          95       95           
  Lines        5427     5427           
  Branches     2548     2548           
=======================================
  Hits         1486     1486           
  Misses       3214     3214           
  Partials      727      727           
Flag Coverage Δ
collector-unit-tests 27.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ovalenti ovalenti force-pushed the ovalenti/orphaner branch 3 times, most recently from 2d2880a to 8fdac91 Compare February 25, 2026 09:09
@ovalenti ovalenti marked this pull request as ready for review February 26, 2026 17:05
@ovalenti ovalenti requested review from a team and rhacs-bot as code owners February 26, 2026 17:05
@rhacs-bot rhacs-bot requested a review from a team February 26, 2026 17:05
microdnf -y clean all && \
rpm --verbose -e --nodeps $(rpm -qa 'curl' '*rpm*' '*dnf*' '*libsolv*' '*hawkey*' 'yum*' 'libyaml*' 'libarchive*') && \
rm -rf /var/cache/dnf /var/cache/yum
rpm --verbose -e --nodeps $(rpm -qa $(/orphaner bash curl elfutils-libelf tbb c-ares openssl-libs libcap-ng libuuid libstdc++ libcurl-minimal)) && \
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a notable effort, but I have to tell there's another way. Instead of starting from ubi-minimal and removing packages, you can start from ubi-micro which is much slimmer base (it can't get any slimmer for the time being) and install only necessary packages.

It's a tiny bit involved how to install RPMs into ubi-micro, but solvable. Would you be interested to try that out?

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.

3 participants