# [solved] nvidia-drivers not detecting Module.symvers file

## glenda_

no nvidia-drivers versions work, i have tried 440.31, 440.26, and 435.21. all give this same error

i made sure kernel is configured and compiled correctly for nvidia drivers as the wiki told me to

i have already done with the kernel: make modules && make oldconfig && make prepare, it was successful

it thinks Module.symvers is missing or does not contain exported symbols, but in fact it DOES exist in /usr/src/linux, and it seems to be a correctly formatted file, i don't know why it won't detect it

build log with error:

```
[32;01m * [39;49;00mPackage:    x11-drivers/nvidia-drivers-440.31

[32;01m * [39;49;00mRepository: gentoo

[32;01m * [39;49;00mMaintainer: jer@gentoo.org

[32;01m * [39;49;00mUSE:        X abi_x86_32 abi_x86_64 amd64 driver elibc_glibc kernel_linux kms multilib tools userland_GNU

[32;01m * [39;49;00mFEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox

>>> [1m[37mcfg-update-1.8.2-r1[0m[0m: Creating checksum index...

 [32;01m*[0m Determining the location of the kernel source code

 [32;01m*[0m Found kernel source directory:

 [32;01m*[0m     /usr/src/linux

 [32;01m*[0m Found sources for kernel version:

 [32;01m*[0m     5.3.9-gentoo-x86_64

 [32;01m*[0m Checking for suitable kernel configuration options...

[A[120C [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Checking for suitable kernel configuration options...

[A[120C [34;01m[ [32;01mok[34;01m ][0m

>>> Unpacking source...

>>> Unpacking NVIDIA-Linux-x86_64-440.31.run to /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work

>>> Unpacking nvidia-settings-440.31.tar.bz2 to /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work

>>> Source unpacked in /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work

>>> Preparing source in /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work ...

 [32;01m*[0m Applying nvidia-settings-linker.patch ...

[A[120C [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Applying nvidia-drivers-440.26-locale.patch ...

[A[120C [34;01m[ [32;01mok[34;01m ][0m

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work ...

 [32;01m*[0m Preparing nvidia module

make -j7 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' ARCH=x86_64 IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux CC=x86_64-pc-linux-gnu-gcc NV_VERBOSE=1 module 

make[1]: Entering directory '/usr/src/linux-5.3.9-gentoo'

test -e include/generated/autoconf.h -a -e include/config/auto.conf || (      \

echo >&2;                     \

echo >&2 "  ERROR: Kernel configuration is invalid.";      \

echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\

echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";   \

echo >&2 ;                     \

/bin/false)

make -f ./scripts/Makefile.build obj=/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel need-modorder=1

  ln -sf /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel/nvidia/nv-kernel.o_binary /var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel/nvidia/nv-kernel.o

The Module.symvers file is missing, or does not contain any

symbols exported from the kernel. This could cause the NVIDIA

kernel modules to be built against a configuration that does

not accurately reflect the actual target kernel.

The Module.symvers file check can be disabled by setting the

environment variable IGNORE_MISSING_MODULE_SYMVERS to 1.

make[2]: *** [/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel/Kbuild:191: module_symvers_sanity_check] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [Makefile:1626: _module_/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel] Error 2

make[1]: Leaving directory '/usr/src/linux-5.3.9-gentoo'

make: *** [Makefile:81: modules] Error 2

 [31;01m*[0m ERROR: x11-drivers/nvidia-drivers-440.31::gentoo failed (compile phase):

 [31;01m*[0m   emake failed

 [31;01m*[0m 

 [31;01m*[0m If you need support, post the output of `emerge --info '=x11-drivers/nvidia-drivers-440.31::gentoo'`,

 [31;01m*[0m the complete build log and the output of `emerge -pqv '=x11-drivers/nvidia-drivers-440.31::gentoo'`.

 [31;01m*[0m The complete build log is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/temp/build.log'.

 [31;01m*[0m The ebuild environment file is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/temp/environment'.

 [31;01m*[0m Working directory: '/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/kernel'

 [31;01m*[0m S: '/var/tmp/portage/x11-drivers/nvidia-drivers-440.31/work/'

```

it says i can disable the check by setting an environment variable... however running IGNORE_MISSING_MODULE_SYMVERS=1 before/with emerge has no effectLast edited by glenda_ on Sun Nov 10, 2019 8:14 pm; edited 1 time in total

----------

## NeddySeagoon

glenda_,

Welcome to Gentoo.

What does say for you?

```
$ grep UNUSED /usr/src/linux/.config

# CONFIG_TRIM_UNUSED_KSYMS is not set

# CONFIG_UNUSED_SYMBOLS is not set
```

You must export unused kernel symbols. nvidia-drivers will use some of them.

Use the search in the kernel to go to those settings and read the help.

If you change anything, you need to rebuild your kernel.

----------

## glenda_

 *NeddySeagoon wrote:*   

> glenda_,
> 
> Welcome to Gentoo.
> 
> What does say for you?
> ...

 

Setting those to =y fixed the problem, thank you!

----------

## archenroot

I know this is old thread, but I just installed new workstation with Gentoo and hit this error with following kernels.

andromeda /usr/src/linux # eselect kernel list

Available kernel symlink targets:

  [1]   linux-5.4.109-gentoo *

  [2]   linux-5.10.27-gentoo

  [3]   linux-5.12.4-gentoo

The problem is that these 2 mentioned options cannot be set at same time, I use genkernel with menuconfig and its impossible to achieve to set both following:

$ grep UNUSED /usr/src/linux/.config

# CONFIG_TRIM_UNUSED_KSYMS is not set

# CONFIG_UNUSED_SYMBOLS is not set

----------

## Ionen

Being unset is what's right, the requested grep was only to confirm this. I'm unsure how the comment of setting to =y was a solution as it'd make the situation worse.

If you are running into this problem despite unset, odds are the source pointed by /usr/src/linux (given your eselect, that'd be 5.4.109) is not a built/prepared kernel which is required by nvidia-drivers, i.e. perhaps you've been building 5.12.4? or 5.10.27? select the right one.

Edit: I might add that modules_prepare is not enough for nvidia-drivers, and so linux-mod.eclass may be misled that the source is usable (preferably should point to a fully built kernel so Modules.symvers is complete).Last edited by Ionen on Tue May 18, 2021 3:54 pm; edited 2 times in total

----------

## Hu

archenroot: please post the error messages you received, so that we can confirm you have the same problem.

----------

## archenroot

So following scenario:

I can only enable "Enable unused/obsolete exported symbols", after set to y there disappear submenu item "Trim unused exported kernel symbols" which to me is strange, why submenu item dissapear after main item is selected as yes.

So I have this state:

```
andromeda ~ # grep UNUSED /usr/src/linux/.config 

CONFIG_UNUSED_SYMBOLS=y
```

And while doing emerge nvidia-drivers I get following:

```
>>> Compiling source in /var/tmp/portage/x11-drivers/nvidia-drivers-465.27/work ...

 * Preparing nvidia module

make -j10 -l10 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux modules 

make[1]: Entering directory '/usr/src/linux-5.10.27-gentoo'

test -e include/generated/autoconf.h -a -e include/config/auto.conf || (      \

echo >&2;                     \

echo >&2 "  ERROR: Kernel configuration is invalid.";      \

echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\

echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";   \

echo >&2 ;                     \

/bin/false)

make -f ./scripts/Makefile.build obj=/var/tmp/portage/x11-drivers/nvidia-drivers-465.27/work/kernel \

single-build= \

need-builtin=1 need-modorder=1

scripts/Makefile.lib:8: 'always' is deprecated. Please use 'always-y' instead

The Module.symvers file is missing, or does not contain any

symbols exported from the kernel. This could cause the NVIDIA

kernel modules to be built against a configuration that does

not accurately reflect the actual target kernel.

The Module.symvers file check can be disabled by setting the

environment variable IGNORE_MISSING_MODULE_SYMVERS to 1.

make[2]: *** [/var/tmp/portage/x11-drivers/nvidia-drivers-465.27/work/kernel/Kbuild:197: module_symvers_sanity_check] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [Makefile:1810: /var/tmp/portage/x11-drivers/nvidia-drivers-465.27/work/kernel] Error 2

make[1]: Leaving directory '/usr/src/linux-5.10.27-gentoo'

make: *** [Makefile:80: modules] Error 2

 * ERROR: x11-drivers/nvidia-drivers-465.27::gentoo failed (compile phase):

 *   emake failed
```

If I have this config state:

```
andromeda ~ # grep UNUSED /usr/src/linux/.config 

# CONFIG_UNUSED_SYMBOLS is not set

# CONFIG_TRIM_UNUSED_KSYMS is not set
```

I receive this:

```
* These sources have not yet been prepared.

 * We cannot build against an unprepared tree.

 * To resolve this, please type the following:

 * 

 * # cd /usr/src/linux

 * # make oldconfig

 * # make modules_prepare

 * 

 * Then please try merging this module again.

 * ERROR: x11-drivers/nvidia-drivers-465.27::gentoo failed (setup phase):

 *   Kernel sources need compiling first
```

So it seems you are ritght, unselection is the right state. Thx for pointing this out.

But after running these commands from error message:

 * # cd /usr/src/linux

 * # make oldconfig

 * # make modules_prepare

I hit again this:

```
/bin/false)

make -f ./scripts/Makefile.build obj=/var/tmp/portage/x11-drivers/nvidia-drivers-465.27/work/kernel \

single-build= \

need-builtin=1 need-modorder=1

scripts/Makefile.lib:8: 'always' is deprecated. Please use 'always-y' instead

The Module.symvers file is missing, or does not contain any

symbols exported from the kernel. This could cause the NVIDIA

kernel modules to be built against a configuration that does

not accurately reflect the actual target kernel.

The Module.symvers file check can be disabled by setting the

environment variable IGNORE_MISSING_MODULE_SYMVERS to 1.
```

After some search I noticed it could be related to kernel version vs driver version issue.

Update: After testing multiple versions I found 390.141-r2 compilable while 450.102.04-r1, 460.67 and 465.27 wont compile,.

----------

## Ionen

 *archenroot wrote:*   

> But after running these commands from error message:
> 
>  * # cd /usr/src/linux
> 
>  * # make oldconfig
> ...

 

Refer to my edit from earlier post:

 *Ionen wrote:*   

> Edit: I might add that modules_prepare is not enough for nvidia-drivers, and so linux-mod.eclass may be misled that the source is usable (preferably should point to a fully built kernel so Modules.symvers is complete).

 

Build your kernel normally rather than only prepare (and without those trim/unused options), ensure that kernel is present at /usr/src/linux (selected), and it should be fine.

----------

## archenroot

Its working fine after those manual steps and full rebuild install even with latest drivers.

----------

