470.223.02 - akmod fails to build driver after kernel update to 6.8.4 (Fedora 39)

Dell Precision M4700 (Quadro K1000M)

Previous kernel was 6.7.11

After installing the new 6.8 kernel, akmod fails to build the driver, complaining about DRM_UNLOCKED being undeclared

2024/04/06 21:12:06 akmodsbuild:   gcc -Wp,-MMD,/tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/.nvidia-drm-gem.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=branch -fno-jump-tables -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -O2 -fno-allow-store-data-races -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -falign-functions=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -fconserve-stack -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=2048 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-overflow -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-restrict -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -g -I/tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/common/inc -I/tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64 -Wall -MD -Wno-cast-qual -Wno-error -Wno-format-extra-args -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"470.223.02\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -Werror=undef -DNV_SPECTRE_V2=0 -DNV_KERNEL_INTERFACE_LAYER -I/tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm -UDEBUG -U_DEBUG -DNDEBUG -DNV_BUILD_MODULE_INSTANCES=0  -DMODULE  -DKBUILD_BASENAME='"nvidia_drm_gem"' -DKBUILD_MODNAME='"nvidia_drm"' -D__KBUILD_MODNAME=kmod_nvidia_drm -c -o /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-gem.o /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-gem.c  
2024/04/06 21:12:06 akmodsbuild: In file included from /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-drv.c:60:
2024/04/06 21:12:06 akmodsbuild: /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-drv.c:748:40: error: ‘DRM_UNLOCKED’ undeclared here (not in a function); did you mean ‘VM_LOCKED’?
2024/04/06 21:12:06 akmodsbuild:   748 |                       DRM_RENDER_ALLOW|DRM_UNLOCKED),
2024/04/06 21:12:06 akmodsbuild:       |                                        ^~~~~~~~~~~~
2024/04/06 21:12:06 akmodsbuild: ./include/drm/drm_ioctl.h:155:26: note: in definition of macro ‘DRM_IOCTL_DEF_DRV’
2024/04/06 21:12:06 akmodsbuild:   155 |                 .flags = _flags,                                        \
2024/04/06 21:12:06 akmodsbuild:       |                          ^~~~~~
2024/04/06 21:12:06 akmodsbuild: make[3]: *** [scripts/Makefile.build:243: /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-drv.o] Error 1
2024/04/06 21:12:06 akmodsbuild: make[3]: *** Waiting for unfinished jobs....
2024/04/06 21:12:06 akmodsbuild: /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-crtc.c: In function ‘plane_req_config_update’:
2024/04/06 21:12:06 akmodsbuild: /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-crtc.c:89:9: warning: unused variable ‘ret’ [-Wunused-variable]
2024/04/06 21:12:06 akmodsbuild:    89 |     int ret = 0;
2024/04/06 21:12:06 akmodsbuild:       |         ^~~
2024/04/06 21:12:06 akmodsbuild: /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-crtc.c: In function ‘nv_drm_plane_atomic_set_property’:
2024/04/06 21:12:06 akmodsbuild: /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64/nvidia-drm/nvidia-drm-crtc.c:371:32: warning: unused variable ‘nv_drm_plane_state’ [-Wunused-variable]
2024/04/06 21:12:06 akmodsbuild:   371 |     struct nv_drm_plane_state *nv_drm_plane_state =
2024/04/06 21:12:06 akmodsbuild:       |                                ^~~~~~~~~~~~~~~~~~
2024/04/06 21:12:06 akmodsbuild: make[2]: *** [/usr/src/kernels/6.8.4-200.fc39.x86_64/Makefile:1939: /tmp/akmodsbuild.BtIEQCzc/BUILD/nvidia-470xx-kmod-470.223.02/_kmod_build_6.8.4-200.fc39.x86_64] Error 2
2024/04/06 21:12:06 akmodsbuild: make[1]: *** [Makefile:252: __sub-make] Error 2
2024/04/06 21:12:06 akmodsbuild: make[1]: Leaving directory '/usr/src/kernels/6.8.4-200.fc39.x86_64'
2024/04/06 21:12:06 akmodsbuild: make: *** [Makefile:80: modules] Error 2
2024/04/06 21:12:06 akmodsbuild: error: Bad exit status from /var/tmp/rpm-tmp.yBpuad (%build)
2024/04/06 21:12:06 akmodsbuild: 
2024/04/06 21:12:06 akmodsbuild: RPM build errors:
2024/04/06 21:12:06 akmodsbuild:     Bad exit status from /var/tmp/rpm-tmp.yBpuad (%build)

470.223.02 is outdated, current version is 470.239.06.

The version 470.239.06 is not available actually for Fedora 39 so I used drm_ioctl.h from the previous version kernel 6.7.11-200.fc39.x86_64 and the build was succeed.

This is just a workaround to build kmod-nvidia-470xx-6.8.4-200.fc39.x86_64-470.223.02-2.fc39.x86_64

The entries for the build in the drm_ioctl.h file are for DRM_UNLOCKED :

 * @DRM_UNLOCKED:
 *
 * Whether &drm_ioctl_desc.func should be called with the DRM BKL held
 * or not. Enforced as the default for all modern drivers, hence there
 * should never be a need to set this flag.
 *
 * Do not use anywhere else than for the VBLANK_WAIT IOCTL, which is the
 * only legacy IOCTL which needs this.
 */
DRM_UNLOCKED		= BIT(4),
/**

Regards

1 Like

My man!

I pulled that declaration from the previous kernel’s header file and inserted into the current kernel’s and the akmod was able to build successfully.

Grazie mille!

FWIW - I was running into the same problem building nvidia drivers for kernel 6.8.5-201. I booted into the previous kernel just fine. I was about to apply the workaround when I remembered that I initially installed the proprietary Nvidia drivers on this system (i.e. not from dnf/yum)

So I went and downloaded version 470.239.06 from Nvidia’s website. I installed the new proprietary driver then the new kernel modules were built successfully. Now my system boots normally.

Regards

well, I guess my system isn’t in as good of shape as I would have hoped.

whenever I install updates I need to reinstall the proprietary Nvidia drivers. It’s a straightforward process, but it’s really annoying to have to boot into the previous kernel, drop to CLI mode, reinstall the drivers, then boot back into GUI mode.

Now I’m wondering if I should install the drivers from rpmfusion so at least the new kernel will fail to build and I’m not left with a system with a blank screen (because I’m blacklisting the nouveau driver as per the Nvidia instructions)

I am using Fedora on my old Lenovo P50 workstation, currently without any ambitions in kernel or driver development. I am using the nvidia legacy drivers as they support my video card. The Fedora update procedure I settled on after getting burned with legacy akmod driver build is as follows:

  • check for updates with dnf list --upgrades and think about the list.
  • Then upgrade via dnf upgrade from a terminal window, not relying on the upgrade-on-reboot feature.
  • If kernel (or the nvidia driver) is upgraded, take extra care to check if the nvidia driver built successfully (check /lib/modules/<version>/extra/nvidia-470xx) Note that the akmods build runs after the upgrade procedure completed - check its progress, e.g. with top, and only if/after it did complete successfully and produced the new modules, reboot. Otherwise try solving the problem and if you need to reboot, select the previous kernel in grub menu until you can resolve the problem.

This time, patching the source as noted above was the easiest and least intrusive fix, knowing that I may need to repeat the procedure on the next kernel update. For the record - akmods logs are in /var/log/akmods, referring to specific build logs in /var/cache/akmods/nvidia-470xx .

FYI for those following this thread:

nvidia-470xx-470.239.06 has been pushed to RPMFusion. New kernel updates auto-build the kmod appropriately once more.

https://bugzilla.rpmfusion.org/show_bug.cgi?id=6904

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.