Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 615388 - x11-drivers/nvidia-drivers-340.102 - some kernels panic
Summary: x11-drivers/nvidia-drivers-340.102 - some kernels panic
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jeroen Roovers (RETIRED)
Depends on:
Reported: 2017-04-12 17:39 UTC by David Flogeras
Modified: 2017-09-27 12:27 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---

Patch to fix kernel panic on 4.9.x series kernels (nvidia-340-kernel-4.9-fix.patch,462 bytes, patch)
2017-04-12 17:49 UTC, David Flogeras
Details | Diff
kernel-4.9.x.patch (kernel-4.9.patch,458 bytes, patch)
2017-07-18 18:54 UTC, László Szalma
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Flogeras 2017-04-12 17:39:08 UTC
I hit this today after upgrading to the 4.9.x series using the nvidia-340 (legacy) drivers.  Basically after modprobing the nvidia driver, there is a kernel panic and in one case a completely unresponsive system.

And the patch in the aforementioned post fixes the issue.  Perhaps it could be added to the tree for others benefit.

Reproducible: Always
Comment 1 David Flogeras 2017-04-12 17:48:34 UTC
Pardon me, it was this post

With a slightly different patch. I'll explicitly attach the working patch for clarity.  It applies to both the 340.101 and 340.102 drivers.
Comment 2 David Flogeras 2017-04-12 17:49:24 UTC
Created attachment 469912 [details, diff]
Patch to fix kernel panic on 4.9.x series kernels

Patch from forum post in Comment #2
Comment 3 Richard Ash 2017-04-14 14:37:48 UTC
To confirm, adding this
Comment 4 Richard Ash 2017-04-14 15:24:57 UTC
To confirm, adding this patch to 
is necessary to have a working amd64 stable system with the offending period graphics hardware. None of the in-tree nvidia-drivers work with the current amd64 stable gentoo-sources kernels after gentoo-sources-4.4.39 without this patch. Despite originally being a 340.98 patch, it is required (not included) up to 340.102 (tested .101, .101-r1 and .102).

According to lspci, hardware in this system is
02:00.0 VGA compatible controller: NVIDIA Corporation G96 [GeForce 9400 GT] (rev a1)

Another symptom of missing this patch is an endless spew of kernel log errors including "driver nvidia is already registered" (hopefully this will help other people find this bug).
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2017-04-25 07:51:28 UTC
So is this about a kernel panic or a modprobe error or is it the usual "let's bunch up ten different agonies into one angry little ball" kind of bug report?
Comment 6 David Flogeras 2017-04-25 10:23:15 UTC
On the surface it manifests as a modprobe error with the "driver nvidia already registered" message.  However, I just wanted to state that it is more serious than that since it also can result in immediate kernel panics after the modprobe, and an unusable system; not just an annoyance that I cannot load my graphics stack.

No angry little ball, just trying to keep Gentoo great :)
Comment 7 László Szalma 2017-07-18 18:54:01 UTC
Created attachment 485568 [details, diff]

I confirm the problem in the first post. My config:

modprobe failed, X did not start.

The patch I attached is the same, but fixed to work when I put it in /etc/portage/patches/x11-drivers/nvidia-drivers-340.102-r1/kernel-4.9.patch

With this patch modprobe nvidia works, but I had to reboot after applying the patch.

X is working fine now.

My VGA is in an old ASUS laptop:

(lspci output):

01:00.0 VGA compatible controller: NVIDIA Corporation G98M [GeForce 9300M GS] (rev a1)

I hope it helps someone. I agree with David this (or some similar) patch should be included in the tree for other Gentoo users comfort! Thank you!
Comment 8 László Szalma 2017-07-25 14:19:23 UTC
I upgraded Gentoo on another machine, it is amd64 keywords this time, and the same problem came again. The attached patch fixed it, it works fine.

[ebuild   R    ] sys-kernel/gentoo-sources-4.9.34:4.9.34::gentoo  USE="-build -experimental -symlink" 0 KiB
[ebuild   R   ~] x11-drivers/nvidia-drivers-340.102-r1:0/340::gentoo  USE="X acpi multilib tools -pax_kernel -static-libs -uvm" ABI_X86="(64) -32 (-x32)" 0 KiB

03:00.0 VGA compatible controller: NVIDIA Corporation G94GL [Quadro FX 1800] (rev a1) (prog-if 00 [VGA controller])
        Subsystem: NVIDIA Corporation G94GL [Quadro FX 1800]

I suppose this problem affects many Gentoo users installing stable kernel and legacy nvidia-drivers for older Nvidia cards.

I can't say for sure this patch works for everyone, but the stable gentoo-sources and the unpatched nvidia-drivers-340.110 causes very ugly kernel panics and stability issues too (!).
Comment 9 László Szalma 2017-07-25 14:20:17 UTC
A suggest applying the patch in the tree OR masking nvidia-drivers-340.102 from installing on kernel-4.9 (or above)
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2017-07-25 15:43:53 UTC
(In reply to László Szalma from comment #9)
> A suggest applying the patch in the tree OR masking nvidia-drivers-340.102
> from installing on kernel-4.9 (or above)

I suggest you complain to Nvidia. This bug report doesn't even state an actual issue in the Summary yet. Or even a link to an upstream complaint.
Comment 11 László Szalma 2017-07-25 16:06:42 UTC
Dear Jeroen,

I have my problem solved by googling and using and this issue. My "complaint" is only for other users and the Gentoo community. I hope I helped to bring this issue closer to the solution.

I found this thread:

I hope this will be good for "upstream complaint". I suggest to change the issue title accordingly, as I can't edit it, for example: "x11-drivers/nvidia-drivers-340.102 - builds but fails to load (and work) with linux-4.9"

Thanks for your reply, please be patient we are on the same side :)
Comment 12 László Szalma 2017-07-25 18:21:23 UTC
This patch is used in Ubuntu/Debian

This is the same as the attached. There might be some other useful stuff there.
Comment 14 josef.95 2017-09-26 10:07:08 UTC
This upstream bug is for me solved with the new nvidia-drivers-304.137 release (and probably  340.104 too?! :))

Comment 15 Jeroen Roovers (RETIRED) gentoo-dev 2017-09-27 12:27:35 UTC
Presumed fixed.