bokumin.org

Github

How to solve the problem of OpenSUSE not recognizing GPU after kernel update

This article is a translation of the following my article:

 

 

* Translated automatically by Google.
* Please note that some links or referenced content in this article may be in Japanese.
* Comments in the code are basically in Japanese.

 

by bokumin

 

How to solve the problem of OpenSUSE not recognizing GPU after kernel update

 

* Due to changes in Kbuild merged in kernel 6.13-rc1, Nvidia driver compilation now fails. You can use the solution in this article for versions up to 6.12, but for later versions, use nouveau (2025/10/31)

 

Introduction

 

When updating the kernel on OpenSUSE TumbleWeed, a problem occurred where nvidia-smi was not recognized.
I plugged the HDMI into the graphics card and started the text base. The point is that it is functioning as a hardware, but cannot be recognized or controlled by the NVIDIA driver software layer.
I tried reinstalling the nvidia driver once, but the result was the same.

 

$ nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

 

環境

 

・OpenSUSE TumbleWeed(Linux kernel 6.12.8)
・Geforce GTX 670(NVIDIA 470.256.02)

 

The installation method is posted in a previous article, so I hope you find it helpful.

 

 

Things I tried

 

Run sudo make in the directory where the NVIDIA 470.256.02 driver source code is located

 

cd /usr/src/kernel-modules/nvidia-470.256.02-default/
sudo make

 

The following error was observed.

 

/usr/src/kernel-modules/nvidia-470.256.02-default/nvidia-drm/nvidia-drm-drv.c:171:6: error: 'const struct drm_mode_config_funcs' has no member named 'output_poll_changed'
171 | .output_poll_changed = nv_drm_output_poll_changed,
    | ^~~~~~~~~~~~~~~~~~~
/usr/src/kernel-modules/nvidia-470.256.02-default/nvidia-drm/nvidia-drm-drv.c:171:28: error: initialization of 'struct drm_atomic_state *(*)(struct drm_device *)' from incompatible pointer type 'void (*)(struct drm_device *)' [-Wincompatible-pointer-types]
171 | .output_poll_changed = nv_drm_output_poll_changed,
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

According to the error content, the DRM driver specifications were changed in Linux kernel 6.12, and the output_poll_changed member structure was deleted from the drm_mode_config_funcs structure.
The NVIDIA 470.256.02 driver was written based on the specifications of an old kernel, so it seems that it can no longer be compiled with newer kernels.

 

Solution

 

We will correct the part where the error of /usr/src/kernel-modules/nvidia-470.256.02-default/nvidia-drm/nvidia-drm-drv.c occurs (line 171).
*I think it will work if you simply comment out line 171, but I’m writing it as an article anyway ()

 

First, add the following to the beginning of the file.

 

#include <linux/version.h>

 

Modify the problem code part as follows.

 

#if LINUX_VERSION_CODE < KERNEL_VERSION(6,12,0)
.output_poll_changed = nv_drm_output_poll_changed,
#endif

 

Function definitions are also modified conditionally.

 

#if LINUX_VERSION_CODE < KERNEL_VERSION(6,12,0)
static void nv_drm_output_poll_changed(struct drm_device *dev) {
    //中は省略
}
#endif

 

Once the modifications are complete, it’s time to build the module.

 

cd /usr/src/kernel-modules/nvidia-470.256.02-default/
sudo make

 

*At this time, a warning regarding BTF generation (“Skipping BTF generation…”) will appear, but you can safely ignore it.

 

Install the built module manually.
At this time, if you have an old nvidia module, it is better to delete it in advance.

 

# 古いモジュールの削除(あれば)
sudo rm -f /lib/modules/$(uname -r)/kernel/drivers/video/nvidia*.ko

# 新しいモジュールのコピー
sudo cp nvidia.ko nvidia-modeset.ko nvidia-drm.ko nvidia-uvm.ko nvidia-peermem.ko /lib/modules/$(uname -r)/kernel/drivers/video/

# 依存関係の更新
sudo depmod -a

# モジュールのロード
sudo modprobe nvidia

 

If no errors have been seen so far, use the command below to check if the driver has been installed correctly.

 

sudo reboot

# 再起動後、ドライバーが認識されているか確認
nvidia-smi

 

nvidia-smi
Thu Jan  9 09:34:18 2025       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.256.02   Driver Version: 470.256.02   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 N/A |                  N/A |
| 30%   30C    P8    N/A /  N/A |      1MiB /  1995MiB |     N/A      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

 

 

Conclusion

 

The problem of rebuilding NVIDIA drivers due to kernel version upgrades is a common problem for Linux users. Especially if you’re using a rolling release distribution like Tumbleweed, which I use, kernel updates occur frequently and graphics driver adjustments may be necessary.
Like this problem, driver builds often fail due to changes in the kernel API. Be especially careful if you are using an older version of NVIDIA’s driver, but in most cases it can be resolved by adding a conditional branch as in this case.

 

I hope this helps people who are having similar problems. If you encounter problems with your graphics driver after updating the kernel, we recommend that you carefully check the error messages and take action while being aware of kernel and driver compatibility.

 

End