NVIDIA drivers cannot be installed because of real-time kernel

DKMS make.log for nvidia-570.124.04 for kernel 6.8.0-57-generic (x86_64)
Pzt 07 Nis 2025 10:26:29 +03
Makefile:63: WARNING: Unable to locate the compiler x86_64-linux-gnu-gcc-12 from CONFIG_CC_VERSION_TEXT in the kernel configuration.
make[1]: Entering directory '/usr/src/linux-headers-6.8.0-57-generic'
make --no-print-directory -C /usr/src/linux-headers-6.8.0-57-generic \
-f /usr/src/linux-headers-6.8.0-57-generic/Makefile modules
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  You are using:           tcc version 0.9.27 (x86_64 Linux)
make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia/570.124.04/build need-builtin=1 need-modorder=1 
The kernel you are installing for is a PREEMPT_RT kernel!

The NVIDIA driver does not support real-time kernels. If you 
are using a stock distribution kernel, please install 
a variant of this kernel that does not have the PREEMPT_RT 
patch set applied; if this is a custom kernel, please 
install a standard Linux kernel.  Then try installing the 
NVIDIA kernel module again.

*** Failed PREEMPT_RT sanity check. Bailing out! ***

make[3]: *** [/var/lib/dkms/nvidia/570.124.04/build/Kbuild:290: preempt_rt_sanity_check] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/usr/src/linux-headers-6.8.0-57-generic/Makefile:1925: /var/lib/dkms/nvidia/570.124.04/build] Error 2
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-57-generic'
make: *** [Makefile:115: modules] Error 2

Hi and welcome. You are it appears not the only one. One suggestion that solved the issue for someone was this:

I cannot install any NVIDIA driver because of kernel is real-time.

Brave A.I. search engine via mojeek suggests:

" Nvidia Driver Real-Time Kernel

Installing the NVIDIA driver on a system running a real-time kernel can be challenging due to incompatibilities between the NVIDIA driver and the PREEMPT_RT patch set applied to the real-time kernel.

To address this issue, one workaround involves setting the IGNORE_PREEMPT_RT_PRESENCE environment variable to 1 before installing the NVIDIA driver. This variable overrides the NVIDIA driver's detection of the PREEMPT_RT patch and allows the installation to proceed.

Here are the steps to follow:

  1. Set the IGNORE_PREEMPT_RT_PRESENCE environment variable:
export IGNORE_PREEMPT_RT_PRESENCE=1
  1. Download the latest NVIDIA driver from the NVIDIA website.
  2. Make the downloaded driver executable:
chmod +x *.run
  1. Run the driver installation script with sudo :
sudo ./NVIDIA-Linux-x86_64-*.run
  1. Verify the installation by checking the NVIDIA X Server Settings utility.

Additionally, if you are using APT to install the driver, you might need to add the contrib and non-free repositories and install necessary packages such as dkms , kernel headers , and build-essential before proceeding with the installation.

If you continue to face issues, consider using an alternative graphics driver like the open-source nouveau driver, which may be more compatible with real-time kernels.

Remember that these workarounds may not be officially supported by NVIDIA, and compatibility issues may still arise."

Welcome to the Forum!

You could try it with uninstalling the Nvidia Driver and install it new. To do that:

  1. sudo apt purge nvidia*
  2. sudo apt autoremove (But please look in the List of the deleting Objects before You delete them)
  3. sudo apt install nvidia-driver-570 nvidia-dkms-570

And if the 570 shouldn't work, You could replace the 570 with an older Version and try it with that.

I tried but error didin't change.
Is there a way to turn off or change kernel into that isn't real time?

I already tried these, doesn't work.

How are you installing the Nvidia Driver that you are running into this?

Use this method:

sudo apt remove --purge '^nvidia-.*'

Add the Repository, first:

sudo add-apt-repository ppa:graphics-drivers/ppa

Clear apt cache before installing fresh and update your sources due to the added repository:

sudo apt clean && sudo apt update

sudo apt install nvidia-driver-570 nvidia-dkms-570

Error is still same, NVIDIA driver doesn't support real-time kernel. So I cannot install.

Zorin OS does not include a Real-Time kernel by default, nor PREEMPT-RT package. Did you install this RT Kernel?
If so, what was your source?

I didin't installed any RT kernel, OS is fresh. I just downloaded lastest iso from zorin OS website and flashed USB with balena-etcher and installed as dual boot with win10.

Hmmm, another package may have pulled it in as a dependency, for som AV software...
Or you may be using a Low-Latency kernel, which the packaging is treating as an RT kernel, though it is not.
What is your terminal output for:

uname -a

Try using Ventoy instead of Balena Etcher.

Linux box-Dell-G15-5515 6.8.0-57-generic #59~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Mar 19 17:07:41 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Could it be that maybe some Kernel Files are damaged. At least the one's who are needed now? Maybe a Reinstallation of the Kernel Modules could help. What would be the Command for this? Honestly I don't know this. I would guess it is sudo apt reinstall linux-kernel-headers* linux-kernel-modules*?

I agree. Let's try

sudo apt install linux-image-6.8.0-57-generic linux-headers-6.8.0-57-generic linux-modules-6.8.0-57-generic linux-modules-extra-6.8.0-57-generic

1 Like

There was no problem in kernel modules. Somehow dkms thinks PREEMPT_DYNAMIC as PREEMPT_RT. I have also set "preempt=none" inside file /etc/default/grub at paramater GRUB_CMDLINE_LINUX_DEFAULT="quiet splash preempt=none" but it doesn't work.

When you ran the above command, what was the terminal output?
When you rebooted, did you select that kernel from grub menu > Advanced Options?

It said everything is newest version, so there was no changes.

Hmmm, so the kernel is defaulting to something that matches your hardware, I think... This is an unusual case. It will need further research.