Nvidia driver and linux-git

Hi!

I am running Debian Sid, linux-image 3.10-2-amd64 is installed , nvidia-driver 319.49 is installed and working. My problem : I am building my own kernel with some extra options not included in the stock images but the linux driver won’t install even if patched with following patch :http://sourceforge.net/projects/openpctv/files/sources/nvidia-319.49_kernel-3.11.patch/download

On building the Nvidia driver I get this error :

/data/Kernel/linux-git/arch/x86/include/asm/uaccess_64.h: In function ‘copy_from_user’:
/data/Kernel/linux-git/arch/x86/include/asm/uaccess_64.h:62:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (likely(sz == -1 || sz >= n))
^
include/linux/compiler.h:152:40: note: in definition of macro ‘likely’
# define likely(x) __builtin_expect(!!(x), 1)
^
In file included from include/drm/drm_crtc.h:32:0,
from include/drm/drmP.h:701,
from /tmp/selfgz11318/NVIDIA-Linux-x86_64-319.49/kernel/nv-drm.c:19:
include/linux/fb.h: In function ‘__fb_pad_aligned_buffer’:
include/linux/fb.h:650:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < s_pitch; j++)
^
/tmp/selfgz11318/NVIDIA-Linux-x86_64-319.49/kernel/nv-drm.c: At top level:
/tmp/selfgz11318/NVIDIA-Linux-x86_64-319.49/kernel/nv-drm.c:109:15: error: ‘drm_fasync’ undeclared here (not in a function)
.fasync = drm_fasync,
^
/tmp/selfgz11318/NVIDIA-Linux-x86_64-319.49/kernel/nv-drm.c: In function ‘nv_alloc_os_descriptor_handle’:
/tmp/selfgz11318/NVIDIA-Linux-x86_64-319.49/kernel/nv-drm.c:205:9: error: void value not ignored as it ought to be
ret = drm_gem_private_object_init(nvl->drm, &nv_obj->base, size);
^
make[3]: *** [/tmp/selfgz11318/NVIDIA-Linux-x86_64-319.49/kernel/nv-drm.o] Erreur 1
make[2]: *** [module/tmp/selfgz11318/NVIDIA-Linux-x86_64-319.49/kernel] Erreur 2
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make[1]: *** [module] Erreur 1
make: *** [module] Erreur 2
-> Error.
ERROR: Unable to build the NVIDIA kernel module.
ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

Any help will be welcome.

Regards

mahashakti89

I got the same error with 325.15 drivers on 3.12-rc1 kernel. Anyone have a patch for this? :D

It looks like you can just remove that line, as fasync doesn’t appear to be used anywhere in the driver. You also need to hack the module license to be GPL, otherwise other compile errors will occur.

EDIT: Yes, this works. (At least with my NVS5400M)

And how to do that?

I’m using this for 325.15

http://leigh123linux.fedorapeople.org/pub/patches/kernel_v3.11.patch

For some reason, with this patch my system freezes when starting lightdm. I also noticed some BUG errors about nvidia in system log.

I also use lightdm (lightdm-gtk) with Cinnamon DE.

$ dmesg |grep -i nvidia
[    3.230240] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    3.263334] [drm] Initialized nvidia-drm 0.0.0 20130102 for 0000:01:00.0 on minor 0
[    3.263493] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  325.15  Wed Jul 31 18:50:56 PDT 2013
[    4.572957] nvidia 0000:01:00.0: irq 44 for MSI/MSI-X
[    4.583995] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.0/0000:01:00.1/sound/card1/input14
[    4.584074] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/0000:01:00.1/sound/card1/input15
[    4.584156] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/0000:01:00.1/sound/card1/input16
[    4.584231] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/0000:01:00.1/sound/card1/input17

I’m getting this:

[ 1529.952627] [drm] Initialized drm 1.1.0 20060810
 [ 1529.976862] ------------[ cut here ]------------
 [ 1529.976868] Kernel BUG at ffffffff813ab51e [verbose debug info unavailable]
 [ 1529.976870] invalid opcode: 0000 [#1] PREEMPT SMP 
 [ 1529.976873] Modules linked in: nvidia(O+) drm snd_hrtimer pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) bnep rfcomm bluetooth nfsd auth_rpcgss binfmt_misc oid_registry exportfs nfs_acl nfs lockd sunrpc fscache dm_crypt joydev hid_dr ff_memless snd_hda_codec_hdmi snd_hda_codec_realtek rc_winfast snd_hda_intel tuner_simple tuner_types snd_hda_codec tda9887 tda8290 snd_hwdep tea5767 snd_pcm_oss snd_mixer_oss snd_pcm tuner snd_seq_dummy snd_page_alloc snd_seq_oss snd_seq_midi snd_seq_midi_event cx8800 snd_rawmidi snd_seq psmouse ppdev cx88xx btcx_risc tveeprom videobuf_dma_sg videobuf_core rc_core v4l2_common videodev media snd_seq_device snd_timer serio_raw parport_pc snd i2c_algo_bit lpc_ich soundcore eeprom i2c_viapro max6650 it87 hwmon_vid coretemp lp parport usb_storage hid_a4tech uvesafb hid_generic usbhid hid r8169 mii pata_jmicron
Sep 17 14:23:13 c2d-desktop kernel: [ 1529.976922] CPU: 0 PID: 18777 Comm: modprobe Tainted: G           O 3.12.0-rc1-core2duo #1
[ 1529.976924] Hardware name: Gigabyte Technology Co., Ltd. P35-DS3L/P35-DS3L, BIOS F4 08/13/2007
 [ 1529.976926] task: ffff880221bbb900 ti: ffff8800c86b6000 task.ti: ffff8800c86b6000
 [ 1529.976928] RIP: 0010:[<ffffffff813ab51e>]  [<ffffffff813ab51e>] lock_policy_rwsem_read+0x1b/0x3c
 [ 1529.976935] RSP: 0018:ffff8800c86b7c70  EFLAGS: 00010246
 [ 1529.976937] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000000bfebfbff
 [ 1529.976939] RDX: ffff88022fc00000 RSI: 0000000000000001 RDI: 0000000000000000
 [ 1529.976940] RBP: ffff8800c86b7c88 R08: ffff8801d21a2fb8 R09: ffff8801d21a2fbc
 [ 1529.976942] R10: ffff88022701a240 R11: 0000000000000001 R12: 0000000000000000
 [ 1529.976944] R13: ffff88021f9d9808 R14: 0000000000000001 R15: ffffffffa0f008d0
 [ 1529.976946] FS:  00007f99a13fe740(0000) GS:ffff88022fc00000(0000) knlGS:0000000000000000
 [ 1529.976948] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 [ 1529.976949] CR2: 00007f99a0c42000 CR3: 00000001c6696000 CR4: 00000000000007f0
 [ 1529.976951] Stack:
 [ 1529.976952]  ffffffff813ac2f3 ffff8801d21a2fc8 ffff8802201fc008 ffff8800c86b7c98
 [ 1529.976955]  ffffffffa0bd4b80 ffff8801d21a2fb8 ffffffffa0ba78ab ffff8801d21a2fc0
 [ 1529.976958]  ffffffffa0719f19 ffff8802201fc008 ffff8800c86b7d28 0000000000000000
 [ 1529.976961] Call Trace:
 [ 1529.976965]  [<ffffffff813ac2f3>] ? cpufreq_get+0x23/0x4c
 [ 1529.977004]  [<ffffffffa0bd4b80>] os_get_cpu_frequency+0xb/0x13 [nvidia]
 [ 1529.977004]  [<ffffffffa0ba78ab>] _nv012283rm+0x9/0x21 [nvidia]
 [ 1529.977004]  [<ffffffffa0719f19>] ? _nv000795rm+0x2a9/0xe98 [nvidia]
 [ 1529.977004]  [<ffffffffa06ef44e>] ? _nv000798rm+0x98/0xdb [nvidia]
 [ 1529.977004]  [<ffffffffa0bafa5e>] ? rm_init_rm+0x24/0x7e [nvidia]
 [ 1529.977004]  [<ffffffffa0f8f09a>] ? nvidia_init_module+0x9a/0x6a4 [nvidia]
 [ 1529.977004]  [<ffffffffa0f8f000>] ? 0xffffffffa0f8efff
 [ 1529.977004]  [<ffffffff81000276>] ? do_one_initcall+0x8e/0x128
 [ 1529.977004]  [<ffffffff8104f3b6>] ? __blocking_notifier_call_chain+0x4c/0x5a
 [ 1529.977004]  [<ffffffff81080bbc>] ? load_module+0x1b37/0x1e34
 [ 1529.977004]  [<ffffffff8107e37e>] ? copy_module_from_fd+0x106/0x106
 [ 1529.977004]  [<ffffffff81080f4d>] ? SyS_init_module+0x94/0xa1
 [ 1529.977004]  [<ffffffff814aa392>] ? system_call_fastpath+0x16/0x1b
 [ 1529.977004] Code: 0f ab 3e 5d c3 55 48 89 e5 5d e8 f2 7e e8 ff c3 48 63 ff 48 c7 c0 d0 e6 00 00 48 8b 14 fd 70 0f 89 81 48 8b 04 10 48 85 c0 75 02 <0f> 0b 55 48 c7 c7 e0 e6 00 00 8b 40 44 48 89 e5 48 03 3c c5 70 
 [ 1529.977004] RIP  [<ffffffff813ab51e>] lock_policy_rwsem_read+0x1b/0x3c
 [ 1529.977004]  RSP <ffff8800c86b7c70>
 [ 1529.977416] ---[ end trace 27c078ed71ff2443 ]---

The leigh123linux patch seems to be working for me. This is on Arch x86_64, kernel 3.12.0-1-00009-gde0bc3d-dirty, and gnome:

[gun@loriburk gun]$ dmesg |grep -i nvidia
[    2.373808] [drm] Initialized nvidia-drm 0.0.0 20130102 for 0000:01:00.0 on minor 0
[    2.373812] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  325.15  Wed Jul 31 18:50:56 PDT 2013
[    6.103580] nvidia 0000:01:00.0: irq 48 for MSI/MSI-X
[    7.026605] NVRM: on the primary VGA device. The NVIDIA Linux graphics driver

Looking at the output you forgot to apply the patch.

Am I the only one here having issue with this 3.12 patch? I still can’t get the patched driver to work. Can’t load a module on 3.12 kernel at all. I’m getting the same Kernel BUG everytime.

How are you applying the patch?
I tried using 3.12-rc2. Patch does not like it. And I got a nice call trace…

I downloaded the patch file, and then I do this:
sh NVIDIA-Linux-x86_64-325.15.run --apply-patch kernel_3.11.patch
That makes a new NVIDIA-Linux-x86_64-325.15-custom.run file that I then run and install without a problem (DKMS module builds without a problem on 3.12-rcX kernels). But when I do: sudo service lightdm start … then my PC freezes, and then I can only reboot it with a button or with a CTRL+ALT+SYSRQ+RSEIUB.

hmmm. I installed 325 from xorg-edgers. Then went to /usr/lib/dkms/325/source and applied the patch there. I am rebuilding 3.12-rc2 with a few additions to see what happens…
Also, this is a GT 630M with bumblebee…

I did an install of Ubuntu GNOME 13.10 Beta 1 recently on a Toshiba P50 laptop. Surprisingly enough nouveau works, but I wanted to switch to the NVIDIA driver. I added the xorg-edgers repository and installed 325.15 along with bumblebee. This worked, but optirun would not work, so I posted over in the bumblebee forums and hopped on their IRC for support:

The thread I posted there is below:

https://github.com/Bumblebee-Project/Bumblebee/issues/483

Basically, in order to get bumblebee’s bbswitch to work, I had to install the latest 3.12-rc3 kernel from the deb sources and manually patch the files from the xorg-edgers package (I believe the line numbers are slightly different – the patch failed when I initially tried to place it in the /usr/src/nvidia-325-325.15 patches folder).

The nv.c & nv-drm.c files to patch should be located in: /usr/src/nvidia-325-325.15. After this, I installed the 3.12-rc3 kernel using:

sudo dpkg -i linux-*.deb

and at that point the nvidia.ko module compiled correctly. Now you should have a working dkms/nvidia driver that will work for the latest kernels. :)

Don’t know what changed in linux kernel, but patch 325.15 driver is working OK on 3.12-rc3 kernel.

on the last apt-get upgrade (with xorg-edgers) i’ve noticed nvidia-325 was upgraded too, although there are non new betas available, guess they have patched it or something…

as i recall there’s been a couple of times when nvidia drivers compiled right out of the box with newest kernels if downloaded from xorg-edgers while the vanilla package directly from nvidia didn’t.

The xorg-edgers version added the patches needed for the 3.11 kernel, but not the one for the 3.12 kernel as of yesterday when I tried it, which is why I had to insert the #if statements manually in the code as I explained in my earlier post to get it to work under 3.12-rc3.

Pls. Help me
How I can patch?

I did:

[i]kodzero@Pollux:~/Загрузки$ chmod +x NVIDIA-Linux-x86_64-319.60.run kodzero@Pollux:~/Загрузки$ chmod +x nvidia-319.49_kernel-3.11.patch kodzero@Pollux:~/Загрузки$ sh NVIDIA-Linux-x86_64-319.60.run --apply-patch nvidia-319.49_kernel-3.11.patch
Verifying archive integrity… OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 319.60…
can’t find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|diff -uNr a/kernel/nv.c b/kernel/nv.c
|— a/kernel/nv.c 2013-08-14 10:27:46.000000000 +0800

+++ b/kernel/nv.c 2013-09-06 20:03:59.930725559 +0800

File to patch: NVIDIA-Linux-x86_64-319.60.run
NVIDIA-Linux-x86_64-319.60.run: No such file or directory
Skip this patch? [y] n
File to patch: NVIDIA-Linux-x86_64-319.60-cudtom.run
NVIDIA-Linux-x86_64-319.60-cudtom.run: No such file or directory
Skip this patch? [y] n
File to patch: /home/kodzero/Загрузки/NVIDIA-Linux-x86_64-319.60.run
/home/usr/Заkodzero/Загрузки/NVIDIA-Linux-x86_64-319.60.run: No such file or directory
Skip this patch? [y] n
File to patch:
Skip this patch? [y] y
Skipping patch.
1 out of 1 hunk ignored
can’t find file to patch at input line 16
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|diff -uNr a/kernel/nv-drm.c b/kernel/nv-drm.c
|— a/kernel/nv-drm.c 2013-08-14 10:27:46.000000000 +0800

+++ b/kernel/nv-drm.c 2013-09-06 19:54:28.334749465 +0800

File to patch: NVIDIA-Linux-x86_64-319.60.run
NVIDIA-Linux-x86_64-319.60.run: No such file or directory
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
can’t find file to patch at input line 41
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|diff -uNr a/kernel/nv-linux.h b/kernel/nv-linux.h
|— a/kernel/nv-linux.h 2013-08-14 10:27:46.000000000 +0800

+++ b/kernel/nv-linux.h 2013-09-06 19:36:15.998795150 +0800

File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
Failed to apply patch file “/home/kodzero/Загрузки/nvidia-319.49_kernel-3.11.patch”.
kodzero@Pollux:~/Загрузки$ chmod 777 NVIDIA-Linux-x86_64-319.60.run
kodzero@Pollux:~/Загрузки$ sh NVIDIA-Linux-x86_64-319.60.run --apply-patch nvidia-319.49_kernel-3.11.patch
Verifying archive integrity… OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 319.60…
can’t find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|diff -uNr a/kernel/nv.c b/kernel/nv.c
|— a/kernel/nv.c 2013-08-14 10:27:46.000000000 +0800

+++ b/kernel/nv.c 2013-09-06 20:03:59.930725559 +0800

File to patch: ^CSignal caught, cleaning up
[/i]

What I must do for putching?
Kernel 3.11, Debian.

As of the latest kernel source releases (3.12.0-rc4+), it was mentioned that there should be no need for the license correction patch; however, I was still receiving the “[drm error]” upon the module build process of the past three NVidia driver releases. Finally I had pulled, built and installed the latest kernel source (3.12.0-rc6+) and then patched it w/ the patch provided by https://devtalk.nvidia.com/member/1883197/ to correct the DRM issue (A couple hunks failed, some successful and enough). I am not a great developer, and obviously nor do I now care enough ^ :) to identify the exact patch code that worked, but here is the process for tonight’s latest with Debian (LMDE) - Maybe someone will whittle down the patch and remove the failed hunks or identify the kernel/module discrepancy for a kernel patch. If anyone cannot duplicate, I’ll repeat my install and provide the log for identifying the failed hunks, because the successful hunks were enough for me to get going, even w/ DKMS):

FIRST: I am running Debian, so I’d rather not mess with the Ubuntu packages, and prefer to install from source whenever possible [bl33d1ng 3dg3]!

I pulled the latest linux kernel via version control git pointing to: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git

If anyone wants me to write up a HowTo for pulling and building the kernel, let me know, but I left all that out because this is nVIDIA’s forum: Basically I just copied my uname -a-config from previous source to new source root = .config, then make menuconfig’d and removed all the nVIDIA related framebuffers under Device Drivers > ETC. Then built linux-image, linux-headers, and linux-source w/ make-kpkg…

Then I downloaded the latest nVIDIA driver for my GTX 660, which as of tonight is:

[GO PICK YOUR OWN!!!]
http://us.download.nvidia.com/XFree86/Linux-x86_64/331.17/NVIDIA-Linux-x86_64-331.17.run

DOWNLOAD THE PATCH:

http://sourceforge.net/projects/openpctv/files/sources/nvidia-319.49_kernel-3.11.patch/download

THEN:

         sudo chown -x NVIDIA-Linux-x86_64-331.17.run
         sudo ./NVIDIA-Linux-x86_64-331.17.run --extract-only
         cd NVIDIA-Linux-x86_64-331.17

PUT THE PATCH IN ROOT DIRECTORY OF THE EXTRACTED DRIVER:

         mv ~/Downloads/download ~/Downloads/NVIDIA-Linux-x86_64-331.17/nvidia-drm.patch
         cd ~/Downloads/NVIDIA-Linux-x86_64-331.17/
         sudo patch -p1 < nvidia-drm.patch

[GOT SOME SUCCESSFUL AND SOME HUNKS FAILED]

RESTARTED WITH XSERVER DISABLED, OR YOU CAN SWITCH SHELL AND KILL WINDOW COMPOSITOR/X

INSTALLED THE CUSTOM/MODIFIED DRIVER:

         cd ~/Downloads/NVIDIA-Linux-x86_64-331.17/
         sudo ./nvidia-installer

[CHOSE DKMS MODULE BUILD = IT WORKED - 32 BIT LIBRARIES = COOL - EVERYTHING INSTALLED!]

         sudo update-initramfs -u -k all
         sudo reboot

OKAY mahashakti89 (I know you’ll be good)