# PBM: Core dump modprobing nvidia driver

## VinzC

Hi again. This thread follows a previous of mine, where I as struggling to find a suitable driver for my video card, a GF108GLM.

Now I've found one, namely nvidia-driver-340.102, I run into another issue: module panic.

```
Sep  2 15:11:14 finn kernel: [12585.405371] ------------[ cut here ]------------

Sep  2 15:11:14 finn kernel: [12585.405380] WARNING: CPU: 0 PID: 19048 at fs/proc/generic.c:345 proc_register+0xe3/0x110

Sep  2 15:11:14 finn kernel: [12585.405382] proc_dir_entry 'driver/nvidia' already registered

Sep  2 15:11:14 finn kernel: [12585.405383] Modules linked in: nvidia(PO+) bnep x86_pkg_temp_thermal intel_powerclamp coretemp b43 mac80211 kvm_in

tel ssb pcspkr wl(PO) btusb btrtl btbcm btintel bluetooth e1000e bcma xts tg3 sky2 igb e1000 hid_microsoft hid_logitech_dj hid_logitech hid_apple 

ohci_hcd uhci_hcd

Sep  2 15:11:14 finn kernel: [12585.405438] CPU: 0 PID: 19048 Comm: modprobe Tainted: P        W  O    4.9.34-gentoo #19

Sep  2 15:11:14 finn kernel: [12585.405440] Hardware name: Dell Inc. Latitude E6530/07Y85M, BIOS A11 03/12/2013

Sep  2 15:11:14 finn kernel: [12585.405442]  ffffc9000b53fb60 ffffffff81392568 ffffc9000b53fbb0 0000000000000000

Sep  2 15:11:14 finn kernel: [12585.405448]  ffffc9000b53fba0 ffffffff810a3636 0000015981393f86 ffff88021f0ef640

Sep  2 15:11:14 finn kernel: [12585.405453]  ffff880225004900 ffff88022010e445 ffff880225004938 ffff88022010e3c0

Sep  2 15:11:14 finn kernel: [12585.405457] Call Trace:

Sep  2 15:11:14 finn kernel: [12585.405466]  [<ffffffff81392568>] dump_stack+0x4d/0x65

Sep  2 15:11:14 finn kernel: [12585.405472]  [<ffffffff810a3636>] __warn+0xc6/0xe0

Sep  2 15:11:14 finn kernel: [12585.405477]  [<ffffffff810a369a>] warn_slowpath_fmt+0x4a/0x50

Sep  2 15:11:14 finn kernel: [12585.405483]  [<ffffffff812499d3>] proc_register+0xe3/0x110

Sep  2 15:11:14 finn kernel: [12585.405487]  [<ffffffff81249b11>] proc_mkdir_data+0x61/0x90

Sep  2 15:11:14 finn kernel: [12585.405491]  [<ffffffff81249b4e>] proc_mkdir_mode+0xe/0x10

Sep  2 15:11:14 finn kernel: [12585.405699]  [<ffffffffa0e64848>] nv_register_procfs+0x38/0x1a0 [nvidia]

Sep  2 15:11:14 finn kernel: [12585.405836]  [<ffffffffa014d291>] nvidia_init_module+0x291/0x793 [nvidia]

Sep  2 15:11:14 finn kernel: [12585.405966]  [<ffffffffa014d7a8>] ? nv_drm_init+0x15/0x15 [nvidia]

Sep  2 15:11:14 finn kernel: [12585.406107]  [<ffffffffa014d7f9>] init_module+0x51/0x92 [nvidia]

Sep  2 15:11:14 finn kernel: [12585.406113]  [<ffffffff81000408>] do_one_initcall+0x38/0x140

Sep  2 15:11:14 finn kernel: [12585.406121]  [<ffffffff811b42dc>] ? __vunmap+0x7c/0xc0

Sep  2 15:11:14 finn kernel: [12585.406138]  [<ffffffff811cde0d>] ? kmem_cache_alloc_trace+0x14d/0x1b0

Sep  2 15:11:14 finn kernel: [12585.406144]  [<ffffffff811b4379>] ? vfree+0x29/0x70

Sep  2 15:11:14 finn kernel: [12585.406150]  [<ffffffff81173215>] do_init_module+0x5a/0x1c8

Sep  2 15:11:14 finn kernel: [12585.406158]  [<ffffffff8111b676>] load_module+0x1e56/0x2320

Sep  2 15:11:14 finn kernel: [12585.406161]  [<ffffffff811189a0>] ? __symbol_put+0x40/0x40

Sep  2 15:11:14 finn kernel: [12585.406168]  [<ffffffff811e0001>] ? do_sendfile+0x321/0x380

Sep  2 15:11:14 finn kernel: [12585.406172]  [<ffffffff811e4fe4>] ? kernel_read_file_from_fd+0x44/0x70

Sep  2 15:11:14 finn kernel: [12585.406181]  [<ffffffff8111bd2a>] SYSC_finit_module+0xba/0xc0

Sep  2 15:11:14 finn kernel: [12585.406185]  [<ffffffff8111bd49>] SyS_finit_module+0x9/0x10

Sep  2 15:11:14 finn kernel: [12585.406190]  [<ffffffff817e1de0>] entry_SYSCALL_64_fastpath+0x13/0x94

Sep  2 15:11:14 finn kernel: [12585.406199] ---[ end trace cdd568cc262633aa ]---

Sep  2 15:11:14 finn kernel: [12585.406202] NVRM: failed to register procfs!

Sep  2 15:11:14 finn kernel: [12585.406249] NVRM: request_mem_region failed for 16M @ 0xf5000000. This can

Sep  2 15:11:14 finn kernel: [12585.406249] NVRM: occur when a driver such as rivatv is loaded and claims

Sep  2 15:11:14 finn kernel: [12585.406249] NVRM: ownership of the device's registers.

Sep  2 15:11:14 finn kernel: [12585.406257] nvidia: probe of 0000:01:00.0 failed with error -1

Sep  2 15:11:14 finn kernel: [12585.407605] NVRM: The NVIDIA probe routine failed for 1 device(s).

Sep  2 15:11:14 finn kernel: [12585.407606] NVRM: None of the NVIDIA graphics adapters were initialized!

Sep  2 15:11:14 finn kernel: [12585.407607] [drm] Module unloaded
```

I have found a similar topic and applied the patch mentioned by ChrisJumper but it doesn't help.

Thanks in advance for any hint/suggestion.

```
Portage 2.3.6 (python 3.4.5-final-0, default/linux/amd64/13.0/desktop, gcc-5.4.0, glibc-2.23-r4, 4.9.34-gentoo x86_64)

=================================================================

System uname: Linux-4.9.34-gentoo-x86_64-Intel-R-_Core-TM-_i5-3230M_CPU_@_2.60GHz-with-gentoo-2.3

KiB Mem:     8118132 total,   6454496 free

KiB Swap:    8703996 total,   8703996 free

Timestamp of repository gentoo: Thu, 24 Aug 2017 13:00:01 +0000

sh bash 4.3_p48-r1

ld GNU ld (Gentoo 2.28 p1.2) 2.28

ccache version 3.2.4 [enabled]

app-shells/bash:          4.3_p48-r1::gentoo

dev-lang/perl:            5.24.1-r2::gentoo

dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo

dev-util/ccache:          3.2.4::gentoo

dev-util/cmake:           3.7.2::gentoo

dev-util/pkgconfig:       0.28-r2::gentoo

sys-apps/baselayout:      2.3::gentoo

sys-apps/openrc:          0.28::gentoo

sys-apps/sandbox:         2.10-r3::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo

sys-devel/automake:       1.11.6-r1::gentoo, 1.15-r2::gentoo

sys-devel/binutils:       2.28-r2::gentoo

sys-devel/gcc:            5.4.0-r3::gentoo

sys-devel/gcc-config:     1.7.3::gentoo

sys-devel/libtool:        2.4.6-r3::gentoo

sys-devel/make:           4.2.1::gentoo

sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)

sys-libs/glibc:           2.23-r4::gentoo

Repositories:

gentoo

    location: /portage.d/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

local

    location: /portage.d/overlays/local

    masters: gentoo

crossdev

    location: /portage.d/overlays/crossdev

    masters: gentoo

    priority: 10

Installed sets: @electronics, @themes, @xfce4, @xorg-test

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"

DISTDIR="/portage.d/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LANG="en_GB.utf8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j3"

PKGDIR="/portage.d/packages/x86_64-pc-linux-gnu"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"

PORTAGE_TMPDIR="/portage.d/tmp"

USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gnutls gpm gtk iconv ipv6 jpeg lcms libnotify lzma mad mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp opus pam pango pcre pdf png policykit ppds qt3support readline sdl seccomp session spell ssl startup-notification svg tcpd theora threads tiff truetype udev udisks unicode upower usb v4l vorbis wxwidgets x264 xattr xcb xml xv xvid zeroconf zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 ssse3 sse3 sse4 sse4_1 sse4_2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput synaptics wacom evdev" KERNEL="linux" L10N="en fr be" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en fr fr_FR fr_BE" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="arm aarch64 i386 x86_64" QEMU_USER_TARGETS="arm aarch64 i386 x86_64" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="vesa nouveau nvidia" XFCE_PLUGINS="clock power trash" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

----------

## krinn

I use a vanilla kernel myself (LTS 4.4.78  ), if you cannot adapt the nvidia-drivers to your kernel, what if you adapt the kernel to the drivers?

https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.86.tar.xz

I know you need download/build... but it would help you at end: answering to "do i need a patch for my kernel?"

----------

## VinzC

Thanks for the suggestion, krinn.  I'm currently trying Manjaro's kernel config, 4.9 kernel (EDIT: not 4.4, where was my mind!) I'll try the vanilla one once I'm done testing this one.

But what about emerge =vanilla-sources-4.4 instead?

----------

## Jaglover

I've got help from nVidia forums in past, the developers know best: https://devtalk.nvidia.com/default/board/98/linux/

----------

## Hu

 *VinzC wrote:*   

> But what about emerge =vanilla-sources-4.4 instead?

 As a minor point, as written your command (1) asks for the original 4.4 series release (from Linus), not one of the later 4.4 series stable releases (from Greg KH, or whoever might take over that task for the 4.4 line); and (2) fails in a current Portage tree because only very recent releases from each series are available.  I have no comment on the underlying idea of using Portage to fetch/install sources for a 4.4-series stable kernel.

----------

## VinzC

Thanks for your insights Hu. My bad, my current version of portage indeed reports vanilla-sources-83, not *-86. I don't why I thought I read *-86. I'm confused.

----------

## VinzC

Wait!

There's something interesting going on now! I have compiled my gentoo kernel with MANJARO's 4.9 kernel config — it's powered by Nouveau. Ok, it took 2 full hours and there are gazillions of drivers I don't need but now my laptop doesn't freeze anymore when I resume from hibernate. Nor do I have a black screen after resuming from suspend!

This is definitely great news as it simply means I was not clever enough to compile a working kernel on my own with Nouveau. I'd happily give up on nVidia if I can make Nouveau work like in Arch/Manjaro.

My question now is: as I really have no idea what and where I messed up in my kernel config, is there a set of recommendation as to compiling a working kernel with Nouveau, i.e. suspend and hibernate?

----------

## ct85711

Well, what you can do, is copy manjaro kernel's config over and gradually trim down the excess crud.  By transfering it over, you having a starting point for a working kernel,  and can work on removing what you don't need.  One thing I would recommend you do, is first build manjaro's config as is on your system and make sure it works on gentoo (so you know it's the kernel specifically, and not something else).  Then go back and recompile it, slowly removing some the the un-needed parts (I say slowly, so you can help narrow down the critical parts).

----------

## VinzC

 *ct85711 wrote:*   

> Well, what you can do, is copy manjaro kernel's config over and gradually trim down the excess crud.  By transfering it over, you having a starting point for a working kernel,  and can work on removing what you don't need.  One thing I would recommend you do, is first build manjaro's config as is on your system and make sure it works on gentoo (so you know it's the kernel specifically, and not something else).  Then go back and recompile it, slowly removing some the the un-needed parts (I say slowly, so you can help narrow down the critical parts).

 

Well, I did exactly that but in the hope there's a more straightforward way. Thanks for confirming my intuition then  :Smile:  . What I can tell is that Manjaro's kernel config is fully functional under Gentoo. What I did is copy the kernel config (approximately the same build number 4.9.34 for Gentoo, 4.9.39 for Manjaro) and run 

```
make oldconfig
```

The only questions I was asked for were about Gentoo support, which are part of Gentoo patchset I presume.

There's just one problem that's still present: when I close the lid while X is active and then reopen it, the screen kind of powers on briefly (so I can see the screensaver for one-two seconds) then turns black. I still can switch to a text console with Ctrl+Alt+F1, for instance. But as soon as I get back to X (tty7) the screen is black, as if it were powered off. However there's no more freeze resuming from hibernate — so far at least.

----------

## Hu

You might find the kernel build targets localmodconfig or localyesconfig useful.  Those are documented as building a kernel that has everything you currently loaded, but dropping all the features you do not have loaded.  If your loaded module set is sufficient for the machine to work, then the generated configuration should also be sufficient.  It might not be the smallest possible sufficient configuration, but it will get you close without extensive trial and error.

----------

## VinzC

 *Hu wrote:*   

> You might find the kernel build targets localmodconfig or localyesconfig useful.  Those are documented as building a kernel that has everything you currently loaded, but dropping all the features you do not have loaded.  If your loaded module set is sufficient for the machine to work, then the generated configuration should also be sufficient.  It might not be the smallest possible sufficient configuration, but it will get you close without extensive trial and error.

 

Thanks Hu, that is *exactly* what I was about to ask for. I didn't know such thing existed as I've been sticking to what I know about building kernel since 2004... well, not particularly clever for a Gentoo'er I admit but... well   :Embarassed:  .

----------

