Unable to build nvidia-kmod

Since last few updates, I am unable to use NVidia drivers anymore, tho for the last few months everything was OK and they were able to build every time kernel was updated.

Logs says that it cannot find kmodtool, but the akmods package is installed on my system.

Terminal output:

Checking kmods exist for 5.19.14-200.fc36.x86_64           [  OK  ]
Building and installing nvidia-kmod                        [FAILED]
Building rpms failed; see /var/cache/akmods/nvidia/515.76-1-for-5.19.14-200.fc36.x86_64.failed.log for details

Hint: Some kmods were ignored or failed to build or install.
You can try to rebuild and install them by by calling
'/usr/sbin/akmods --force' as root.

Build logs:

2022/10/09 16:38:58 akmods: Building RPM using the command '/sbin/akmodsbuild --kernels 5.19.14-200.fc36.x86_64 /usr/src/akmods/nvidia-kmod.latest'
warning: user mockbuild does not exist - using root
warning: group mock does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mock does not exist - using root
Installing /usr/src/akmods/nvidia-kmod.latest
Building target platforms: x86_64
Building for target x86_64
setting SOURCE_DATE_EPOCH=1663718400
error: Failed build dependencies:
	/app/bin/kmodtool is needed by nvidia-kmod-3:515.76-1.fc36.x86_64

RPM build warnings:
    user mockbuild does not exist - using root
    group mock does not exist - using root
    user mockbuild does not exist - using root
    group mock does not exist - using root
2022/10/09 16:38:58 akmodsbuild: * Rebuilding /usr/src/akmods/nvidia-kmod.latest for kernel(s) 5.19.14-200.fc36.x86_64: warning: user mockbuild does not exist - using root
2022/10/09 16:38:58 akmodsbuild: warning: group mock does not exist - using root
2022/10/09 16:38:58 akmodsbuild: warning: user mockbuild does not exist - using root
2022/10/09 16:38:58 akmodsbuild: warning: group mock does not exist - using root
2022/10/09 16:38:58 akmodsbuild: Installing /usr/src/akmods/nvidia-kmod.latest
2022/10/09 16:38:58 akmodsbuild: Building target platforms: x86_64
2022/10/09 16:38:58 akmodsbuild: Building for target x86_64
2022/10/09 16:38:58 akmodsbuild: setting SOURCE_DATE_EPOCH=1663718400
2022/10/09 16:38:58 akmodsbuild: error: Failed build dependencies:
2022/10/09 16:38:58 akmodsbuild: /app/bin/kmodtool is needed by nvidia-kmod-3:515.76-1.fc36.x86_64
2022/10/09 16:38:58 akmodsbuild: 
2022/10/09 16:38:58 akmodsbuild: RPM build warnings:
2022/10/09 16:38:58 akmodsbuild: user mockbuild does not exist - using root
2022/10/09 16:38:58 akmodsbuild: group mock does not exist - using root
2022/10/09 16:38:58 akmodsbuild: user mockbuild does not exist - using root
2022/10/09 16:38:58 akmodsbuild: group mock does not exist - using root
2022/10/09 16:38:58 akmodsbuild: 
2022/10/09 16:38:58 akmods: Building rpms failed; see /var/cache/akmods/nvidia/515.76-1-for-5.19.14-200.fc36.x86_64.failed.log for details

Nothing there seems to match what happens for me.
How did you install the nvidia driver.
From nvidia.com or from rpmfusion using dnf?

If you installed from rpmfusion and did the normal install with sudo dnf install akmod-nvidia the system should automatically build and install the kmod-nvidia package for your kernel.

Please post the result of dnf list installed *nvidia*

I’ve installed from rpmfusion with standard sudo dnf install akmod-nvidia and it always worked as intended.

Command result:

Error: No matching Packages to list

If you did the above and got the below response then it seems either you entered the command wrong or the packages are not installed. Alternatively you might need to modify that command to dnf list installed '*nvidia*' to prevent shell expansion of the glob if you are entering the command in a location where you have something with ‘nvidia’ in the name.

I would expect that the build dependencies should be /usr/bin/kmodtool rather than /app/bin/kmodtooll, This suggests that someone or something has modified the standard rpm macros or created additional rpm macro files to override some of the standard rpm macros.

For now you can create a symbolic link

sudo mkdir -p /apt/bin
sudo ln -s /usr/bin/kmodtool /apt/bin/kmodtool

Well, after one more kernel update my machine completely broke and there was no video output anymore. I reinstalled system and everything goes back to normal since then. I guess system got corrupted somehow at some point.

Alternatively you might need to modify that command to dnf list installed '*nvidia*' to prevent shell expansion of the glob if you are entering the command in a location where you have something with ‘nvidia’ in the name.

That was last output, before reinstall:

Installed Packages
akmod-nvidia.x86_64                 3:515.76-1.fc36   @rpmfusion-nonfree-updates
nvidia-gpu-firmware.noarch          20220913-140.fc36 @updates                  
nvidia-settings.x86_64              3:515.76-3.fc36   @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia.x86_64          3:515.76-1.fc36   @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-cuda-libs.x86_64
                                    3:515.76-1.fc36   @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-kmodsrc.x86_64  3:515.76-1.fc36   @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-libs.x86_64     3:515.76-1.fc36   @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-power.x86_64    3:515.76-1.fc36   @rpmfusion-nonfree-updates