Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to include akmod to compose #4983

Open
karuboniru opened this issue May 31, 2024 · 8 comments
Open

Failed to include akmod to compose #4983

karuboniru opened this issue May 31, 2024 · 8 comments

Comments

@karuboniru
Copy link

Describe the bug

Different from the ublue way, I am trying to include akmod-nvidia during the rpm-ostree compose image step. But I failed with:

akmod-nvidia.post: Building /usr/src/akmods/nvidia-kmod-550.78-1.fc40.src.rpm for kernel 6.8.11-300.fc40.x86_64
akmod-nvidia.post: Installing /usr/src/akmods/nvidia-kmod-550.78-1.fc40.src.rpm
akmod-nvidia.post: Building target platforms: x86_64
akmod-nvidia.post: Building for target x86_64
akmod-nvidia.post: setting SOURCE_DATE_EPOCH=1714089600
akmod-nvidia.post: warning: Could not canonicalize hostname: f4ba1ea9c96d
akmod-nvidia.post: error: Failed build dependencies:
akmod-nvidia.post: 	/usr/bin/kmodtool is needed by nvidia-kmod-3:550.78-1.fc40.x86_64
akmod-nvidia.post: 	gcc is needed by nvidia-kmod-3:550.78-1.fc40.x86_64
akmod-nvidia.post: 	kernel-devel-uname-r = 6.8.11-300.fc40.x86_64 is needed by nvidia-kmod-3:550.78-1.fc40.x86_64
akmod-nvidia.post: 	xorg-x11-drv-nvidia-kmodsrc = 3:550.78 is needed by nvidia-kmod-3:550.78-1.fc40.x86_64
akmod-nvidia.post: 
akmod-nvidia.post: RPM build warnings:
akmod-nvidia.post:     Could not canonicalize hostname: f4ba1ea9c96d

I believe all those "missing dependencies" are actually present in the system as it should be direct dependency from akmods. It seems that things in post step just don't see them.

Reproduction steps

  1. Add this file and corresponding *.repo to a rpm-ostree compose project
  2. Compose the tree with rpm-ostree compose image ...

Expected behavior

I was expecting that the akmods could be installed to the image.

Actual behavior

It failed in akmod-nvidia.post

System details

rpm-ostree:
 Version: '2024.6'
 Git: 1dda51b264eec8003eb6032f1f41844754ec163b
 Features:
  - rust
  - compose
  - container
  - fedora-integration

Additional information

Maybe at the stage of akmod-nvidia.post, the whole rpmdb is not ready? Or this usecase will never be supported? Or even if I could workaround the dependency issue there would be more issues behind (as I can think of, the akmod-nvidia.post will install the newly built kmods as rpm, and I am unsure if this is possible in rpm-ostree case

@COM8
Copy link

COM8 commented Jun 14, 2024

I run into the same error as you. The problem is as follows:

  1. During compose you install akmod-nvidia.
  2. akmod-nvidia will run as part of the %post section during RPM install the build of nvidia-kmod which defines gcc, kernel-devel-uname-r and some others. 3. Although they might be already installed on the system (I suspect) the RPM DB is not yet updated to reflect them being installed, leading to the system thinking they are not and then failing.
  3. I'm currently working on a patched akmod-nvidia RPM that is able to be installed during OSTree compose. This involves moving nvidia-kmod BuildRequires into akmod-nvidia Requires definitions.

In my eyes this is not the optimal solution since I would expect rpm-ostree compose handling this as it's done on all other systems as well. This would then allow installation of any other akmod kernel module during compose as well without having to patch it first.

@COM8
Copy link

COM8 commented Jun 17, 2024

Here is a fixed RPM that works during rpm-ostree compose: https://github.com/COM8/nvidia-kmod

@travier
Copy link
Member

travier commented Jun 17, 2024

rpm-ostree will not pull BuildRequires dependencies as those are only installed when the package is built, not on normal installations.

@travier travier closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
@COM8
Copy link

COM8 commented Jun 17, 2024

@travier I'm fine with closing this, but this is not the point.

The point is, you define something as Requires or even Requires(post) in an RPM spec. Then, inside the %post section of that RPM, you call rpmbuild (e.g. the process that happens during an akmod install) and there it fails to find the RPM dependency you previously defined as Requires(post) during the BuildRequires check of the RPM you are building.

@travier
Copy link
Member

travier commented Jun 17, 2024

Ah, I think I understand what you meant now.

@travier travier reopened this Jun 17, 2024
@mtalexan
Copy link
Contributor

@COM8
Is rpm-ostree compose not properly handling Requires(post): dependencies so they're not present in the system when they should be? Or is rpm-ostree compose failing to provide the proper environment so that a %post scriptlet can see the dependencies it called out as Requires(post)?

As I understand it, on a normal system an akmod specfile basically just ends up listing the src RPM's BuildRequires as Requires(post) of itself, then uses the %post scriptlet to run rpmbuild. Obviously somethign with that is broken here, but is it that dependencies were completely missing being installed, or that those dependencies weren't visible to the %post scriptlet?

@COM8
Copy link

COM8 commented Nov 28, 2024

Things are installed on the system if you specify them via Requires(post) or Requires before your package. But I suspect the RPM database is not yet updated when the %post section is invoked.

This leads to other RPM-builds triggered from within %post like akmod builds not detecting dependencies correctly - although they are here.

Since I discovered this I'm happily using my own (patched) version of nvidia driver (https://github.com/rpmfusion/nvidia-kmod/blob/master/nvidia-kmod.spec) and it works.

@mtalexan
Copy link
Contributor

mtalexan commented Nov 28, 2024

Thanks for the clarification. I unfortunatly have half a dozen drivers that as of Fedora 41 are all akmods now, so forking them all doesn't quite work for me.

So the issue sounds like the rpmdb is being wiped at the wrong time by rpm-ostree. It needs to wait until after all scriptlets have run rather than doing it right after the installs and before the scriptlets. Presumably this same issue could affect other things that use something as late as %posttrans too.
Or possibly more accurately, they need to modify the bwrap environment they run the scriptlets in to allow access to the rpmdb.

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

No branches or pull requests

4 participants