Skip to content

🐛 Fix cache path to avoid /var/cache/dnf conflict - #2835

Merged
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
ericahinkleRH:fix-cache-path-conflict
Jul 28, 2026
Merged

🐛 Fix cache path to avoid /var/cache/dnf conflict#2835
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
ericahinkleRH:fix-cache-path-conflict

Conversation

@ericahinkleRH

@ericahinkleRH ericahinkleRH commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Problem

On RHEL-based container images, operator-controller and catalogd pods crash on startup with:

chmod /var/cache/dnf: operation not permitted

This happens because:

  1. Default cache path is /var/cache (operator-controller) or /var/cache/ (catalogd)
  2. RHEL base images contain /var/cache/dnf owned by root
  3. Pods run as non-root (UID 1001)
  4. EnsureEmptyDirectory() tries to chmod root-owned directories, which fails

Solution

Change default cache paths to component-specific subdirectories to avoid conflicts with system directories:

  • operator-controller: /var/cache/var/cache/operator-controller
  • catalogd: /var/cache//var/cache/catalogd

Changes

cmd/operator-controller/main.go

  • Line 184: Update --cache-path default from /var/cache to /var/cache/operator-controller

cmd/catalogd/main.go

  • Line 132: Update --cache-dir default from /var/cache/ to /var/cache/catalogd

Both changes follow the same pattern: use a component-specific subdirectory under /var/cache/ to avoid conflicts with system directories like /var/cache/dnf.

Testing

  • Build and deploy with new defaults
  • Verify both operator-controller and catalogd pods start successfully on RHEL-based images
  • Verify cache operations work correctly for both components
  • Confirm no conflicts with existing system directories in /var/cache/

Related: OCPBUGS-89330

Copilot AI review requested due to automatic review settings July 27, 2026 19:16
@openshift-ci
openshift-ci Bot requested review from OchiengEd and fgiudici July 27, 2026 19:16
@netlify

netlify Bot commented Jul 27, 2026

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit dcb78f5
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6a67b2286ae03b0008319f9f
😎 Deploy Preview https://deploy-preview-2835--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates operator-controller’s default filesystem cache directory to avoid permission errors on RHEL-based images where /var/cache/dnf exists and is root-owned, causing startup failure when the cache directory is being emptied.

Changes:

  • Change the --cache-path flag default from /var/cache to /var/cache/operator-controller.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ericahinkleRH ericahinkleRH changed the title Fix cache path to avoid /var/cache/dnf conflict 🐛 Fix cache path to avoid /var/cache/dnf conflict Jul 27, 2026
The default cache path was /var/cache, which can cause chmod failures
when running as non-root (UID 1001) on container images that contain
/var/cache/dnf owned by root (e.g., RHEL-based images).

EnsureEmptyDirectory() attempts to chmod entries in the cache directory
to make them writable before deletion, but non-root users cannot chmod
root-owned directories, resulting in:
  'chmod /var/cache/dnf: operation not permitted'

Change default from /var/cache to /var/cache/operator-controller to
avoid conflicts with system directories in base images.

Fixes: https://issues.redhat.com/browse/OCPBUGS-89330
@ericahinkleRH
ericahinkleRH force-pushed the fix-cache-path-conflict branch from 8bc8480 to dcb78f5 Compare July 27, 2026 19:31
Copilot AI review requested due to automatic review settings July 27, 2026 19:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread cmd/catalogd/main.go
@ericahinkleRH

Copy link
Copy Markdown
Contributor Author

Hello @fgiudici @OchiengEd,

Could someone approve the workflow runs so the tests can kick off?

Thanks!

@rashmigottipati rashmigottipati left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

approved the workflow runs.

@tmshort

tmshort commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

/approve

The alternative would be to update the Helm charts to allow modification of the arguments, so that we can render new arguments into the manifests. This is a much simpler fix, and avoids other potential directories that might be owned by root, regardless of the k8s host.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 28, 2026
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 28, 2026
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rashmigottipati, tmshort

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 4deb390 into operator-framework:main Jul 28, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants