# Cannot start Xorg. could not insert 'nvidia' no such device.

## notCarl

I am trying to get a fresh installed set up. My current problem has to do with my nvidia drivers I believe. When I try to run x.org with $startx I get a "mod probe: ERROR: could not insert 'nvidia' : no such device.

Then Using config file..

using config directory..

using system config..

I am new to Gentoo and expect my .conf files to be riddled with errors.

Here is my /etc/portage/make.conf

https://paste.pound-python.org/show/UYty50Oag7NP50MUTUaA/

I have an intel i5 and an nvidia gtx 970 if that matters.

Here is my /etc/X11/xorg.conf

https://paste.pound-python.org/show/2ga7g8Tjz09mmceoC0HD/

----------

## Buffoon

Probably some driver in kernel grabbed the card and nvidia driver cannot load. No telling, you haven't provided Xorg log nor kernel config nor dmesg.

----------

## notCarl

xorg log:  https://paste.pound-python.org/show/CORChvVnXefjJ1UQGWe5/

Kernel .conf:  https://paste.pound-python.org/show/s1pGkxmI9VwV86joXTkE/

I unfortunately don't know what the dmesg is that I should be looking for

----------

## Buffoon

You should follow Gentoo nVidia wiki.

----------

## notCarl

Been going through the Xorg and Nvidia Wiki word for word during my free time the last few days.

----------

## Zucca

Hi.

Install wgetpaste if you haven't already.

Then run

```
wgetpaste -c dmesg
```

... and give us the link.

----------

## notCarl

here is the dmesg link:  https://paste.pound-python.org/show/ai8UWiYloo8i94Q4LhR7/

----------

## Zucca

Well, there you have it:

```
[    7.622773] NVRM: The NVIDIA probe routine was not called for 1 device(s).

[    7.622775] NVRM: This can occur when a driver such as: 

               NVRM: nouveau, rivafb, nvidiafb or rivatv 

               NVRM: was loaded and obtained ownership of the NVIDIA device(s).

[    7.622776] NVRM: Try unloading the conflicting kernel module (and/or

               NVRM: reconfigure your kernel without the conflicting

               NVRM: driver(s)), then try loading the NVIDIA kernel module

               NVRM: again.

[    7.622778] NVRM: No NVIDIA graphics adapter probed!

[    7.622779] [drm] Module unloaded
```

Check that you don't have those conflicting modules loaded.

You may blacklist them or remove completely by reconfiguring your kernel and compiling it.

----------

## NeddySeagoon

notCarl,

The nVidia binary blob driver will not load if a kernel framebuffer driver has grabbed the video device.

More exactly, it will to coexist with a  framebuffer driver that sets up the hardware.

In the framebuffer part of the kernel setup, almost everything must be off.

CONFIG_FB_NVIDIA=m will prevent the nVida kernel module loading.

CONFIG_FB_VESA=y used to work for me, with dire warnings from the nVidia driver.

CONFIG_FB_EFI=y may work. I don't have an EFI system to test. 

# CONFIG_FB_SIMPLE is not set might work too as it does not do any hardware setup.

All the other Framebuffer hardware drivers in that kernel menu must be off.

You also have CONFIG_DRM_NOUVEAU=m.  That's the open source kernel module for your card.

If that loads before the binary blob kernel module, the same thing happens.

In particular, it sets up the video card and gives you a nice framebuffer console.

CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y tells that you have your display in portrait mode.

If that's correct, fine.

----------

## Buffoon

CONFIG_FB_EFI=y works, FWIW.

----------

## russK

I agree with Neddy and Buffoon,

As a reference, I have a working box with nvidia,

My kernel .config has this for _FB,

zgrep _FB_ /proc/config.gz:  https://paste.pound-python.org/show/E2zmWEvJmx9KTI50kSt8/

And I have this:

```
 $ zgrep -i nouveau /proc/config.gz 

# CONFIG_DRM_NOUVEAU is not set

```

HTH

----------

## notCarl

I believe I may have made some progress, but I have a new error now. "could not insert 'nvidia' : Unknown symbol in module, or unknown parameter.

After lots of searching online, I found a thread with similar problems and the problem was that an old kernel was being loaded.

I used $uname -a, and the kernel I'm using is version #1 last built on Friday September 30th. I have definitely rebuilt my kernel many times since then with make menuconfig and then rebuilding by following the wiki. All the steps found on the wiki for rebuilding are below.

$make && make modules_install

$mount /boot

$make install

$grub-mkconfig -o /boot/grub/grub.cfg

Is uname -a showing a date of september 30th a sign that I am still using my first kernel build and not using the new ones after I've added/removed driver configurations?

Here is dmesg: https://paste.pound-python.org/show/NLSGwVNmeOPjqxMY3s6R/

kernel cfg: https://paste.pound-python.org/show/aOwRmgrRAAcsEcJQ4BlX/

make.conf: https://paste.pound-python.org/show/4b7DhPlikeJQuVgK5w9l/

xorg log: https://paste.pound-python.org/show/yvCRp4r6qHfBeXBlb1so/

----------

## NeddySeagoon

notCarl,

```
[    0.000000] Linux version 4.4.21-gentoo (root@livecd) (gcc version 4.9.3 (Gentoo 4.9.3 p1.5, pie-0.6.4) ) #1 SMP Fri Sep 30 11:22:39 CDT 2016
```

That's an end of September kernel build that in use.  

Lets check some file dates and times to see what's actually happening. 

Sight of 

```
ls -l /boot
```

and the content of grub.cfg might be useful too.

First of all, there are two ways to 

```
cd /usr/src/<kernel>
```

One is 

```
cd /usr/src/linux
```

That depends on the linux symlink pointing to the right place.

```
$ ls -l /usr/src/

total 48

lrwxrwxrwx  1 root root   18 Oct 10 16:24 linux -> linux-4.8.1-gentoo

drwxr-xr-x 26 root root 4096 Sep 30 23:21 linux-4.6.0-gentoo

drwxr-xr-x 26 root root 4096 Oct 10 17:01 linux-4.8.1-gentoo
```

For users building out of kernel kernel modules. The link must be correct as its followed by the out of kernel modules to know which kernel to build against.

Its quite common to deliberately build nvidia-drivers against one kernel while you run another.

Think kernel upgrades. Is your symlink correct?

If not, fix it, rebuild and reinstall your kernel, then 

```
emerge -1 nvidia-drivers
```

so you know that nvida-drivers is built against the right kernel.

Test here and look at uname -a after the reboot.

With the symlink sorted out, if you are still running an old kernel. Proceed as follows.

```
cd /usr/src/linux

ls -l .config
```

make note of the file date and time.  A kernel build starts with this file. It must be the oldest of all the files we will examine.

If its Sep 30, you have not been configuring this kernel, or if you have, the changes have not been saved.

Next 

```
ls -l arch/x86/boot/bzImage
```

This is your kernel binary.  If all is well it will be newer than the .config file.

If not, it does not belong to the .config above.  That suggests the kernel build failed and you didn't notice. Hence there is an old file here.

This file, or one of its copies, gets installed to /boot.

Do 

```
ls -l /boot
```

 Is there a file with the same timestamp within a few seconds?

If not, the install failed.  Is /boot full ?

Try 

```
df -h

df -ih 
```

running out of space or i-nodes is a very bad thing.

Is this the right boot?

You should see directories for grub and lost+found if you have a separate boot partition.

lost+found will be missing if /boot is a directory on your root filesystem.

----------

## Buffoon

In addition to what Neddy said, if Gentoo is your sole OS I'd recommend not to rely on grub-mkconfig, control it manually instead.

----------

## notCarl

I listed my system link and it is pointing to an old kernel, and i see the kernel with todays date below it. That almost sounds like good news. However! I went through most of your steps before making any wgetpaste links, and I think I made a mistake mounting my /boot directory. No disk space is even close to being full, but my lost+found and boot are both in my / directory and the boot directory is empty when i $ls -l /boot. Am I doomed?

here is my df -h

https://paste.pound-python.org/show/PMYKc9Fhwp2ro6vCjwHH/

----------

## Buffoon

Empty /boot means your boot partition is not mounted.

----------

## notCarl

Would this fstab config give any clue to why my boot isn't mounted on startup ?

https://paste.pound-python.org/show/SpwLE4vJNJQoLPzsK3g8/

----------

## Buffoon

There is no need to mount /boot at boot time, this is why Gentoo default is noauto. You need to mount it though when you upgrade your kernel.

----------

## notCarl

Alright. I see now that it is normal for /boot to not mount on startup.  

Here is my ls -l /boot

https://paste.pound-python.org/show/2C6fltllDPHD0wVX3COn/

Grub.cfg: https://paste.pound-python.org/show/n8xVRhMelJOvli9Zk873/

here is my ls -l /usr/src: https://paste.pound-python.org/show/KZa8NVwb7T57Zl0cjtZG/

It lists the more current kernel, however when i use eselect kernel list it only shows [1] linux-4.4.21-gentoo * 

I also see in the wiki that I can either USE="symlink" or I can set it manually. Are these the correct steps?

----------

## NeddySeagoon

notCarl,

```
-rw-r--r-- 1 root root  5091680 Oct 10 01:33 vmlinuz-4.4.21-gentoo
```

Is the kernel you need to boot.  At least, its your newest kernel.

There is no matching initrd, but if the kernel is configured properly, that's OK.

Your ls -l /usr/src is correct.

linux-4.4.21-gentoo is your only kernel. linux is a link to your kernel.  Its name never changes, unlike the real kernel directory.

In /boot, you have three kernels

```
-rw-r--r-- 1 root root  4951072 Sep 30 11:22 kernel-genkernel-x86_64-4.4.21-gentoo

-rw-r--r-- 1 root root  5091680 Oct 10 01:33 vmlinuz-4.4.21-gentoo

-rw-r--r-- 1 root root  5091680 Oct 10 00:07 vmlinuz-4.4.21-gentoo.old
```

The default Grub entry, starting at line 92 in your pastebin, boots kernel-genkernel-x86_64-4.4.21-gentoo, which is your Sep 30 kernel.

The first two entries in the Advanced Submenu also boot that kernel.

You need to boot the third entry in the Advanced Submenu.

There may be a problem. Grubs autoblackmagic has made that boot entry read.

Line 161 ...

```
      echo   'Loading Linux 4.4.21-gentoo ...'

      linux   /vmlinuz-4.4.21-gentoo root=UUID=9ea1f55f-2284-4010-af49-25842c2e8b8e ro  

      echo   'Loading initial ramdisk ...'

      initrd   /initramfs-genkernel-x86_64-4.4.21-gentoo

```

but that initrd belongs to your original kernel.  Its modules will not match your new kernel.

If you need an intrd to boot, you need a new one. If not, comment out

```
       echo   'Loading initial ramdisk ...'

      initrd   /initramfs-genkernel-x86_64-4.4.21-gentoo

```

so your kernel does not get confused.

----------

## notCarl

Thanks for the help so far.

 I followed your steps and made sure to comment those two lines in the 3rd event to load the kernel, but the problem remains. Can I build a new initramfs file for my newest kernel or do I have to rebuild the kernel again? Is there a reason I have 3 kernels in my /boot but only one initramfs? I imagine this error was caused when I kept making adjustments and rebuilding my kernel without using $mount /boot

----------

## NeddySeagoon

notCarl,

When you build a kernel manually, you don't get an initrd.

When you use genkernel, left to its own devices, it will build an initrd too.

You can tell genkernel just to build an initrd but I've never used genkernel, so I don't know the command.

You can also build into your kernel everything needed to boot, so no modules need to be loaded to be able to mount root.

----------

## russK

notCarl,

In addition to the good pointers already given ...

nvidia generally won't be in the initrd, it can live in /lib after the kernel pivots from the initrd to your real root.

If 'uname -r' matches 'eselect kernel show' and 'ls -l /usr/src', it's generally OK to 'emerge nvidia-drivers' and then 'modprobe nvidia'

HTH

----------

## notCarl

Spent a good while following guides making an initramfs filesystem in my /usr/src/ as well as an initrd script. Unfortunately the guide gave me filler code that wont do much. I tried to use this new initrd in place of the 3rd entry of advanced submenu but I'm still loading the september kernel

Is it necessary that the grub menu boots my original september kernel in the paste bin and then in the first two entries in the Advanced Submenu?

That's three times for the same kernel, is that normal?

Would it be possible and easier for me to rebuild a kernel as well as rebuild my grub.cfg to avoid this mess with my duplicate initrd and the same kernel being loaded repeatedly in the grub.cfg?

----------

## NeddySeagoon

notCarl,

When grub loads, it displays a menu.  You choose the kernel to load at that time.

If it makes it easier, edit the grub.cfg with useful kernel names.

At line 111 from your pastebin, which starts

```
submenu 'Advanced options for Gentoo GNU/Linux' 
```

Change it to read, 

```
submenu 'My New Kernel is Inside this Menu'
```

At line 150 change 

```
menuentry 'Gentoo GNU/Linux, with Linux 4.4.21-gentoo'

```

to read,

```
menuentry 'Choose This Menu Item and Press Enter'
```

That will give you instructions on the Grub menu screen.

You only have 

```
 set timeout=5
```

5 seconds to start using the keyboard at the grub menu before your Sep 30 kernel is automatically booted.

If you need longer, change the timeout at lines 83 and 87.

If you use a bluetooth keyboard, you probably can't interact with the Grub menu, since bluetooth won't work until the kernel is loaded, which is too late.

In that case, more drastic edits are called for if a non bluetooth keyboard cannot be used.

----------

## notCarl

Thank you for the tip, Neddy. Changing the grub menu text helped me find the correct kernel and I was able to boot and confirm that the new kernel was being used with $uname -a

What can I do to get this kernel to be the default kernel that is chosen when I boot the system? I find myself rebooting my system dozens of times during long sessions of learning and trouble shooting, and being able to avoid going through the GRUB menu to boot the most recent kernel would be great.

All tips are appreciated, even if it means directing me to another informational source on GRUB.

I'm sure this is an easy fix for an experienced user, and I do feel silly lol. Thanks for tolerating my noob questions and not telling me to go install Ubuntoo or Hannah Montanna Linux.

----------

## NeddySeagoon

notCarl,

There are three ways.  I hate to point you to editing grub.cfg but ...

line 18 of your grub.cfg says 

```
set default="0"
```

This controls the kernel entry booted if you do nothing at the menu.  grub counts from 0.

It also has a way of remembering the default as the last kernel you selected.

I don't know how as I don't use that feature, I've just seen it when I've been reading the docs.

Finally, you could remove all the unused kernels and initrd from /boot, so only the files you need are there then have grub write a new grub.cfg.

It would only have a single entry.

You have no reason to feel silly.  Asking questions is all a part of the learning experience.

Keep in mind that the only silly question is the one you don't ask, as you never get it answered.

Be on your guard for silly answers though  :)

----------

