Skip to content

Conversation

slp
Copy link
Contributor

@slp slp commented Jun 25, 2025

When building on RHEL-based systems make sure we install the mesa version from the COPR, which enables the virtio driver and has the patches to force alignment to 16K (needed for GPU acceleration on macOS, but harmless to other systems).

We also need to add "--nobest" to "dnf update" to ensure it doesn't get frustrated by being unable to install the mesa package from appstream.

Summary by Sourcery

Update container image build scripts to install and maintain a specific COPR-provided mesa package for reliable GPU acceleration, preserve COPR repos during cleanup, and add the --nobest flag to dnf updates to prevent package resolution issues.

Build:

  • Enable COPR and pin mesa-vulkan-drivers to a fixed version on Fedora builds
  • Stop removing COPR repository files during cleanup to retain pinned repo entries
  • Add --nobest to dnf update in build_rag.sh to avoid package resolution failures

Copy link
Contributor

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

The PR updates container image build scripts to pin and lock a COPR-provided mesa-vulkan-drivers version on RHEL/Fedora-based images, adjusts repository cleanup, and adds the “--nobest” flag to DNF updates for RHEL builds.

Flow diagram for DNF update in build_rag.sh with --nobest flag

flowchart TD
    A[Start update_python] --> B{Is dnf available?}
    B -- Yes --> C[dnf update -y --allowerasing --nobest]
    C --> D[dnf install python, pip, devel, pkgs]
    D --> E{Is python3.11?}
    E -- Yes --> F[Symlink python3.11 to python3]
    E -- No --> G[End]
    F --> G
    B -- No --> H[Skip dnf update]
    H --> G
Loading

File-Level Changes

Change Details Files
Pin and lock COPR-provided mesa-vulkan-drivers version
  • Enable slp/mesa-libkrun-vulkan COPR for Fedora
  • Install mesa-vulkan-drivers at version 25.0.7-100.fc42
  • Add dnf versionlock for the pinned package
  • Refactor install logic to handle non-Fedora systems
container-images/scripts/build_llama_and_whisper.sh
Preserve COPR repos during cleanup
  • Remove the deletion of _copr: entries in rm_non_ubi_repos
container-images/scripts/build_llama_and_whisper.sh
Allow DNF to install non-best packages
  • Add “--nobest” flag to dnf update in build_rag.sh
container-images/scripts/build_rag.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@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.

Summary of Changes

Hello @slp, 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 enhances the container image build process by ensuring specific, patched Mesa drivers are consistently installed on RHEL-based systems for optimal GPU acceleration. Additionally, it improves the reliability of package updates by making dnf more resilient to dependency conflicts.

Highlights

  • Mesa Version Pinning for RHEL: On RHEL-based systems, the dnf_install_mesa function in build_llama_and_whisper.sh now explicitly installs and version-locks mesa-vulkan-drivers-24.2.8-103.el9 from the slp/mesa-krunkit COPR. This ensures the correct Mesa driver, which includes virtio support and 16K alignment patches, is used for GPU acceleration, particularly relevant for macOS.
  • Improved DNF Update Robustness: The dnf update command in build_rag.sh has been updated to include the --nobest flag. This modification prevents dnf from failing due to dependency resolution issues, especially when unable to install certain packages (like mesa from appstream), allowing the update process to proceed by skipping problematic packages.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @slp - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@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 effectively addresses the need to pin the mesa version from a COPR repository on RHEL-based systems and to use the --nobest flag for dnf update to prevent conflicts. The changes align well with the stated objectives. My primary feedback concerns the precise application of dnf versionlock to ensure only the intended packages are pinned, preventing potential issues with future package updates.

@@ -100,9 +100,12 @@ dnf_install_mesa() {
if is_rhel_based; then
dnf copr enable -y slp/mesa-krunkit "epel-9-$uname_m"
add_stream_repo "AppStream"
dnf install -y mesa-vulkan-drivers-24.2.8-103.el9 "${vulkan_rpms[@]}"
dnf versionlock mesa-vulkan-drivers-24.2.8-103.el9 "${vulkan_rpms[@]}"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The dnf versionlock command is used to pin specific packages to specific versions. While mesa-vulkan-drivers-24.2.8-103.el9 is correctly specified for version locking, including ${vulkan_rpms[@]} in the same command will attempt to versionlock each of those packages (vulkan-headers, vulkan-loader-devel, etc.) to their currently installed versions. The pull request description focuses on pinning the mesa version. Unless these other vulkan_rpms also need to be explicitly locked to their current state (which can hinder future updates), it's best to only apply versionlock to the mesa-vulkan-drivers package as intended by the PR description.

Suggested change
dnf versionlock mesa-vulkan-drivers-24.2.8-103.el9 "${vulkan_rpms[@]}"
dnf versionlock mesa-vulkan-drivers-24.2.8-103.el9

@slp slp marked this pull request as draft June 25, 2025 11:31
@slp
Copy link
Contributor Author

slp commented Jun 25, 2025

I've just noticed the previous commit has switched to building on F42 by default. Let's put this one on hold for the moment.

@ericcurtin
Copy link
Member

@slp @rhatdan we do need a solution though:

#1595

If we released container images today, macOS support would be broken, we have at least two options:

  1. Go back to UBI9.
  2. Stay on Fedora:42 but @slp rebuilds the forked mesa for Fedora 42, (and 43, 44, when they get released if the changes haven't made it from upstream yet). If we are rebuilding @slp please pick up the Asahi changes from Fedora rawhide, means we can stop building a separate container image for Asahi.

@rhatdan
Copy link
Member

rhatdan commented Jun 25, 2025

Can we get the mesa stuff updated for Fedora 42 or is the a reason to stick with ubi9?

When building on Fedora systems make sure we install the
mesa version from the COPR, which has the patches to force
alignment to 16K (needed for GPU acceleration on macOS, but
harmless to other systems).

We also need to add "--nobest" to "dnf update" to ensure it
doesn't get frustrated by being unable to install the mesa package
from appstream.

Signed-off-by: Sergio Lopez <[email protected]>
@slp slp force-pushed the pin-copr-mesa branch from f671e53 to 385a992 Compare June 26, 2025 10:10
@slp slp marked this pull request as ready for review June 26, 2025 10:17
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @slp - I've reviewed your changes - here's some feedback:

  • The new branch uses ["${ID}" = "fedora"] for COPR enablement but no longer handles RHEL-based systems as before—consider reintroducing the EL‐9 COPR enablement or adjusting the condition to cover RHEL similarly.
  • Hardcoding the mesa-vulkan-drivers version (25.0.7-100.fc42) will require manual updates for every bump; consider defining it as a variable or sourcing it from a central config to simplify future maintenance.
  • The script invokes dnf versionlock but doesn’t install the dnf-plugins-core package, which provides the versionlock plugin—ensure that plugin dependency is in place before locking versions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new branch uses `["${ID}" = "fedora"]` for COPR enablement but no longer handles RHEL-based systems as before—consider reintroducing the EL‐9 COPR enablement or adjusting the condition to cover RHEL similarly.
- Hardcoding the mesa-vulkan-drivers version (25.0.7-100.fc42) will require manual updates for every bump; consider defining it as a variable or sourcing it from a central config to simplify future maintenance.
- The script invokes `dnf versionlock` but doesn’t install the `dnf-plugins-core` package, which provides the versionlock plugin—ensure that plugin dependency is in place before locking versions.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@slp
Copy link
Contributor Author

slp commented Jun 26, 2025

Stay on Fedora:42 but @slp rebuilds the forked mesa for Fedora 42, (and 43, 44, when they get released if the changes haven't made it from upstream yet). If we are rebuilding @slp please pick up the Asahi changes from Fedora rawhide, means we can stop building a separate container image for Asahi.

I've created a new COPR with a patched F42 mesa. I couldn't pick up the Asahi changes because would have meant switching to 25.1.x, and I haven't had the time to test it properly yet. I think it's safer to wait a bit first.

We should also see if it'd be possible to get the patch into mainline Fedora.

@rhatdan
Copy link
Member

rhatdan commented Jun 26, 2025

LGTM

@rhatdan rhatdan merged commit aa1e4f1 into containers:main Jun 26, 2025
25 of 29 checks passed
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