There’s been problem with NVIDIA driver on my computer running Fedora 31 ever since the kernel has hit version 5.4.*. The issue is that the NVIDIA driver version 435.21, which is installed from rpmfusion-nonfree, can’t be built with kernel 5.4.

Here is the version of the akmod-nvidia package:

[root@watamem ~]# dnf info akmod-nvidia
Last metadata expiration check: 1:48:11 ago on Sun 02 Feb 2020 08:13:26 PM AEDT.
Installed Packages
Name         : akmod-nvidia
Epoch        : 3
Version      : 435.21
Release      : 1.fc31
Architecture : x86_64
Size         : 22 k
Source       : nvidia-kmod-435.21-1.fc31.src.rpm
Repository   : @System
From repo    : rpmfusion-nonfree
Summary      : Akmod package for nvidia kernel module(s)
URL          : http://www.nvidia.com/
License      : Redistributable, no modification permitted
Description  : This package provides the akmod package for the nvidia kernel modules.

And here is what happened when I tried to build the NVIDIA driver:

[root@watamem ~]# akmods --kernel 5.4.15-200.fc31.x86_64
Checking kmods exist for 5.4.15-200.fc31.x86_64            [  OK  ]
Building and installing nvidia-kmod                        [FAILED]
Building rpms failed; see /var/cache/akmods/nvidia/435.21-1-for-5.4.15-200.fc31.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.

I checked the 35.21-1-for-5.4.15-200.fc31.x86_64.failed.log and it mention:

...
The Module.symvers file is missing, or does not contain any
symbols exported from the kernel. This could cause the NVIDIA
kernel modules to be built against a configuration that does
not accurately reflect the actual target kernel.
The Module.symvers file check can be disabled by setting the
environment variable IGNORE_MISSING_MODULE_SYMVERS to 1.
...

So I tried to build the driver by setting IGNORE_MISSING_MODULE_SYMVERS to 1 as suggested. It was still a no go!

[root@watamem ~]# view /var/cache/akmods/nvidia/435.21-1-for-5.4.15-200.fc31.x86_64.failed.log
[root@watamem ~]# IGNORE_MISSING_MODULE_SYMVERS=1 akmods --kernel 5.4.15-200.fc31.x86_64
Checking kmods exist for 5.4.15-200.fc31.x86_64            [  OK  ]
Building and installing nvidia-kmod                        [FAILED]
Building rpms failed; see /var/cache/akmods/nvidia/435.21-1-for-5.4.15-200.fc31.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.

I’ve looked up online to see if other people have experienced the same thing. To my surprise, there was was nobody reporting NVIDIA driver on Fedora. There was some references to this issue reported by people running Gentoo. However, no suggestions fixed the issue I’ve had.

My up-to-now solution has been to just stick to loading kernel 5.3.15-300.fc31.x86_64 on boot, while waiting for rpmfusion to release a new version of akmod-nvidia driver. Well, it turned out that a newer version (440.44-1.fc31.x86_64) has been available for quite sometimes already. The reason I didn’t see it because I didn’t have RPM Fusion Nonfree Updates x86_64 repository enabled!

On my machine, I need to set enabled=1 to enable the RPM Fusion Nonfree Updates in /etc/yum.repos.d/rpmfusion-nonfree-updates.repo:

[rpmfusion-nonfree-updates]
name=RPM Fusion for Fedora $releasever - Nonfree - Updates
#baseurl=http://download1.rpmfusion.org/nonfree/fedora/updates/$releasever/$basearch/
metalink=https://mirrors.rpmfusion.org/metalink?repo=nonfree-fedora-updates-released-$releasever&arch=$basearch
enabled=1
enabled_metadata=1
type=rpm-md
gpgcheck=1
repo_gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever

Then all I need to do is to just update the packages and rebuild the NVIDIA driver.

[root@watamem yum.repos.d]# dnf update -y
...
[root@watamem yum.repos.d]# dnf info akmod-nvidia
Last metadata expiration check: 0:12:59 ago on Sun 02 Feb 2020 11:16:29 PM AEDT.
Installed Packages
Name         : akmod-nvidia
Epoch        : 3
Version      : 440.44
Release      : 1.fc31
Architecture : x86_64
Size         : 22 k
Source       : nvidia-kmod-440.44-1.fc31.src.rpm
Repository   : @System
From repo    : rpmfusion-nonfree-updates
Summary      : Akmod package for nvidia kernel module(s)
URL          : http://www.nvidia.com/
License      : Redistributable, no modification permitted
Description  : This package provides the akmod package for the nvidia kernel modules.

[root@watamem yum.repos.d]# akmods --kernel 5.4.15-200.fc31.x86_64
Checking kmods exist for 5.4.15-200.fc31.x86_64            [  OK  ]
Building and installing nvidia-kmod

I should mention that I didn’t really need to manually build the driver in the above step. I installed NVIDIA driver using Akmod instead of using DKMS, so the NVIDIA driver will be automatically compiled for me upon booting up if it were missing.

Well, I’m happy to report that NVIDIA 440.44 can indeed be built with kernel 5.4.* on Fedora 31 (again).