nvidia-drivers-378.09 fails to build FATAL: modpost: GPL-incompatible module nvidia-drm.ko uses GPL-only symbol 'mutex_destroy'

Hello. I have this hard stop error building nvidia-drivers 378.09
I use rt kernel 4.8.14_p9 with CONFIG_DEBUG_MUTEXES disabled.

Bump!

Same issue here. Trying to build x11-drivers/nvidia-drivers-381.22 on Gentoo for kernel version 4.4.6.

The end of the build that contains the error:

...<snip>...
  x86_64-pc-linux-gnu-ld -m elf_x86_64   -r -o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-drv.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-utils.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-crtc.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-encoder.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-connector.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-gem.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-fb.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-modeset.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-fence.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-linux.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nvidia-drm-helper.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm/nv-pci-table.o 
(cat /dev/null;   echo kernel//var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia.ko;   echo kernel//var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-uvm.ko;   echo kernel//var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-modeset.ko;   echo kernel//var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-drm.ko;) > /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/modules.order
x86_64-pc-linux-gnu-ld -r -o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-interface.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-frontend.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-instance.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-acpi.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-chrdev.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-cray.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-dma.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-gvi.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-i2c.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-mempool.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-mmap.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-p2p.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-pat.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-procfs.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-usermap.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-vm.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-vtophys.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/os-interface.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/os-mlock.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/os-pci.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/os-registry.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/os-usermap.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-modeset-interface.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-pci-table.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-kthread-q.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv-kthread-q-selftest.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nv_uvm_interface.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia/nvlink_linux.o
x86_64-pc-linux-gnu-ld -r -o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-modeset/nv-modeset-interface.o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/nvidia-modeset/nvidia-modeset-linux.o
make -f ./scripts/Makefile.modpost
  find /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$
 | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m  -i ./Module.symvers -I /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/Module.symvers  -o /var/tmp/portage/x11-drivers/nvidia-drivers-381.22/work/kernel/Module.symvers -S  -w  -s -T -
FATAL: modpost: GPL-incompatible module nvidia-drm.ko uses GPL-only symbol 'mutex_destroy'
make[2]: *** [scripts/Makefile.modpost:91: __modpost] Error 1
make[1]: *** [Makefile:1388: modules] Error 2
make[1]: Leaving directory '/usr/src/linux-4.4.6-gentoo'
make: *** [Makefile:81: modules] Error 2
 * ERROR: x11-drivers/nvidia-drivers-381.22::gentoo failed (compile phase):
 *   emake failed
 *

Let me know what other information you need to get this resolved.

TIA. Look forward to getting this resolved.

Simply apply the following patch to the Linux kernel sources to censor once and for all the GPL dictators:

diff -durN linux-4.2.0/include/linux/export.h linux-4.2.0-patched/include/linux/export.h
--- linux-4.2.0/include/linux/export.h	2015-08-30 20:34:09.000000000 +0200
+++ linux-4.2.0-patched/include/linux/export.h	2015-08-31 16:35:20.620645230 +0200
@@ -69,14 +69,14 @@
 	__EXPORT_SYMBOL(sym, "")
 
 #define EXPORT_SYMBOL_GPL(sym)					\
-	__EXPORT_SYMBOL(sym, "_gpl")
+	__EXPORT_SYMBOL(sym, "")
 
 #define EXPORT_SYMBOL_GPL_FUTURE(sym)				\
-	__EXPORT_SYMBOL(sym, "_gpl_future")
+	__EXPORT_SYMBOL(sym, "")
 
 #ifdef CONFIG_UNUSED_SYMBOLS
 #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
-#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
+#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused")
 #else
 #define EXPORT_UNUSED_SYMBOL(sym)
 #define EXPORT_UNUSED_SYMBOL_GPL(sym)

Greetings dinosaur_,

And, thanks for the prompt reply.

However, as this is a situation involving the combination of different licensing for two sets of codebases, I think the proper resolution here is not to hack on the Linux kernel with changes that:

A.) Will never be accepted upstream.
B.) You will have to continually do for each and every new kernel that is built, and
C.) Will leave the end-users with no viable options as they do not know how to build a kernel.

 Now, if you have followed the threads on the forums of the various distros, you may find that someone has already posted a patch on Pastebin for changes to cut into version 367.35 of the nvidia-driver package for Linux kernel versions >=4.7.0.  You can find the patch at https://pastebin.com/cw1tncgm and here is the quick diff for the patch:
diff -Naur a/kernel/nvidia-drm/nvidia-drm-fb.c b/kernel/nvidia-drm/nvidia-drm-fb.c
--- a/kernel/nvidia-drm/nvidia-drm-fb.c	2016-08-20 21:02:56.220661347 -0300
+++ b/kernel/nvidia-drm/nvidia-drm-fb.c	2016-08-20 21:08:56.420667987 -0300
@@ -31,6 +31,7 @@
 #include "nvidia-drm-gem.h"
 
 #include <drm/drm_crtc_helper.h>
+#include <linux/version.h>
 
 static void nvidia_framebuffer_destroy(struct drm_framebuffer *fb)
 {
@@ -113,8 +114,13 @@
      *
      * We don't support any planar format, pick up first buffer only.
      */
+    
+    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+        gem = drm_gem_object_lookup(file, cmd->handles[0]);
+    #else
+        gem = drm_gem_object_lookup(dev, file, cmd->handles[0]);
+    #endif
 
-    gem = drm_gem_object_lookup(dev, file, cmd->handles[0]);
 
     if (gem == NULL)
     {
diff -Naur a/kernel/nvidia-drm/nvidia-drm-gem.c b/kernel/nvidia-drm/nvidia-drm-gem.c
--- a/kernel/nvidia-drm/nvidia-drm-gem.c	2016-08-20 21:02:56.220661347 -0300
+++ b/kernel/nvidia-drm/nvidia-drm-gem.c	2016-08-20 21:10:34.160669788 -0300
@@ -27,6 +27,7 @@
 #include "nvidia-drm-priv.h"
 #include "nvidia-drm-ioctl.h"
 #include "nvidia-drm-gem.h"
+#include <linux/version.h>
 
 static struct nvidia_drm_gem_object *nvidia_drm_gem_new
 (
@@ -407,8 +408,13 @@
     int ret = -EINVAL;
 
     mutex_lock(&dev->struct_mutex);
+    
+    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+        gem = drm_gem_object_lookup(file, handle);
+    #else
+        gem = drm_gem_object_lookup(dev, file, handle);
+    #endif
 
-    gem = drm_gem_object_lookup(dev, file, handle);
 
     if (gem == NULL)
     {
diff -Naur a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
--- a/kernel/nvidia-uvm/uvm_linux.h	2016-08-20 21:02:56.220661347 -0300
+++ b/kernel/nvidia-uvm/uvm_linux.h	2016-08-20 21:06:33.380665350 -0300
@@ -554,12 +554,13 @@
     INIT_RADIX_TREE(tree, GFP_NOWAIT);
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
 static bool radix_tree_empty(struct radix_tree_root *tree)
 {
     void *dummy;
     return radix_tree_gang_lookup(tree, &dummy, 0, 1) == 0;
 }
-
+#endif
 
 #if !defined(NV_USLEEP_RANGE_PRESENT)
 static void __sched usleep_range(unsigned long min, unsigned long max)
So, can we get these changes (or their appropriate equivalent) into the nvidia-driver packages?

Thanks again for your time and attention to this issue.  I look forward to hearing from you again soon.

I was just giving you a fix, for yourself (not to submit upstream: they are GPL fascists and won’t accept it anyway), which you can apply to the kernels you compile on your machines and will prevent any such issue with stupid licensing (*) in the future (and with any driver, not just NVIDIA’s).

Of course, NVIDIA will have to implement a wrapper function to “fix” this (non) issue, just to please the GPL facists… But I resolved this problem years ago with such patches I made for myself and that I’m sharing with you.

(*) I’ll add that there’s no software patent in Europe anyway, so “copyrighting” an API such as what is done in the Linux kernel is illegal in EU too. Also, imagine that Microsoft starts doing the same thing, and copyrights function calls in their DLLs, to prevent any non-Microsoft licensed software to use them; the GPL folks would be the first victim and Open Source would pretty much stop working on Windows ! Such a principle is total, abyssal, stupidity from Linux kernel developers (and Linus himself for a start).

Hi Group,

Today when I tried to install the NVIDIA Driver with my Fedora-28, I got exactly the same issue

It is:
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘mutex_destroy’

How can I solve it ?

Of course I can patch source code, but once I run NVIDIA-Linux-x86_64-396.54.run again
all my changes are overwritten

Also, when i run
/usr/bin/nvidia-installer

It appears to miss some argument, which i cannot guess

So whats the best instructions to solve it ?
Can you specify detailled patch and rerun instructions ?

Thank you

Patching shouldn’t be necessary. Are you running a debug kernel? if so, switch to a non-debug kernel.

Hi Generix.
Thank you for your help!
I switched to non-debug kernel and could proceed.
However, it did not finish

In GUI it says:
Ling could not load nvidia-drm module

then trying:

insmod /usr/lib/modules/4.17.11-200.fc28.x86_64/extra/nvidia-drm.ko.xz
insmod: ERROR: could not insert module /usr/lib/modules/4.17.11-200.fc28.x86_64/extra/nvidia-drm.ko.xz: Unknown symbol in module

in dmsg i see

[ 554.298790] nvidia_drm: Unknown symbol nvKmsKapiGetFunctionsTable (err 0)

modprobe nvidia-drm
modprobe: ERROR: could not insert ‘nvidia_drm’: No such device

lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)

Whats wrong now ?

Thank you!

In dmesg I see:

[ 4560.827564] NVRM: The NVIDIA GPU 0000:01:00.0 (PCI ID: 10de:1c82)
NVRM: installed in this system is not supported by the
NVRM: NVIDIA 396.54 driver release.
NVRM: Please see ‘Appendix A - Supported NVIDIA GPU Products’
NVRM: in this release’s README, available on the operating system
NVRM: specific graphics driver download page at www.nvidia.com.

But according to the supported list i believe, i have this one:

GeForce GTX 1050 Ti 1C82 H

Guenther

The unresolved symbol message points to leftovers from a previous driver install.
You shouldn’t use the .run installer anyways. Uninstall it using the --uninstall option, see if modules are left and remove, the use rpmfusion to install the driver:
[url]https://rpmfusion.org/Configuration[/url]
[url]https://rpmfusion.org/Howto/NVIDIA[/url]

Hi Generix,

Thank you for helping again. The Problem with the missing linking symbol is gone.

This appears to be my last error:

Referring und reading

http://download.nvidia.com/XFree86/Linux-x86_64/396.54/README/supportedchips.html

I find this supported card

“GeForce GTX 1050 Ti 1C82 H”

But dmesg tells me:

[ 4560.827564] NVRM: The NVIDIA GPU 0000:01:00.0 (PCI ID: 10de:1c82)
NVRM: installed in this system is not supported by the
NVRM: NVIDIA 396.54 driver release.
NVRM: Please see ‘Appendix A - Supported NVIDIA GPU Products’
NVRM: in this release’s README, available on the operating system

10de:1c82 is not supported ?

Which information is in error ?

I am using NVIDIA-Linux-x86_64-396.54.run installer.

[root@localhost ~]# nvidia-installer -v

nvidia-installer: version 396.54 (buildmeister@swio-display-x64-rhel04-14) Wed Aug 15 00:22:39 PDT 2018
The NVIDIA Software Installer for Unix/Linux.

Does this match to the supportedchips.html ?

The driver 396 is the right one for your card.
Three possiblities come to my mind

  • Driver bug
  • Running in a VM using passthrough
  • Faked, reflashed old graphics card. What brand is it?
    Please post the output of
    sudo lspci -vn -d 10de:*

Please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post will reveal a paperclip icon.

This “not supported” error can also occur if there’s some system-level problem that prevents the GPU from responding to reads. A bug report log would hopefully paint a clearer picture of what’s going wrong.

Hi
please find attached the requested information

[root@localhost ~]# lspci -vn -d 10de:*
01:00.0 0300: 10de:1c82 (rev a1) (prog-if 00 [VGA controller])
Subsystem: 10de:0000
Flags: fast devsel, IRQ 18, NUMA node 0
Memory at fc000000 (32-bit, non-prefetchable)
Memory at d8000000 (64-bit, prefetchable)
Memory at d4000000 (64-bit, prefetchable)
I/O ports at dc00
Expansion ROM at 000c0000 [disabled]
Capabilities: [60] Power Management version 3
Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [78] Express Endpoint, MSI 00
Capabilities: [b4] Vendor Specific Information: Len=14 <?> Capabilities: [100] Virtual Channel Capabilities: [128] Power Budgeting <?>
Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
Kernel modules: nouveau, nvidia_drm, nvidia

01:00.1 0403: 10de:0bee (rev a1)
Subsystem: 10de:0000
Flags: bus master, fast devsel, latency 0, IRQ 19, NUMA node 0
Memory at fea7c000 (32-bit, non-prefetchable)
Capabilities: [60] Power Management version 3
Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [78] Express Endpoint, MSI 00
Kernel driver in use: snd_hda_intel

On the Box its written in big letters:
Amptron Graphic card
And GTX1050TI-4GD5/128BIT on a small sticker.

Hovering does not work. I will send the bug report to linux-bugs@nvidia.com

Thank you

I’m sorry, but this is most likely a fake:
Subsystem: 10de:0000
That’s no sane subsystem ID, never heard of Amptron.

If it has an old VGA connector, this is one more hint for being a fake. Standard Pascal type cards like a 1050ti don’t have one.

It has an VGA Connector, too.
Thank you for your support!