# Trouble starting X with nvidia graphics card

## g4c9z

I've installed my Gentoo base system with stage3-i686-20100126.tar.bz2, and now I'm trying to get X working, following the The X Server Configuration HOWTO.  When I try to run startx, I get a black screen, which I can only get out of by pressing Ctrl+Alt+F1 to go back to the other virtual terminal.  There, I see errors about being unable to load modules:

First I tried with the default open source nv module (I have an NVidia GEForce4 MX400 SE graphics card), and got these errors:

(EE) Failed to load module "vesa" (module does not exist, 0)

(EE) Failed to load module "fbdev" (module does not exist, 0)

Then I tried setting up the nvidia-drivers module according to the Gentoo Linux nVidia Guide, and the above errors went away, to be replaced with being unable to load dri and dri2.  From my Xorg.0.log:

...

(II) LoadModule: "dri"

(WW) Warning, couldn't open module dri

(II) UnloadModule: "dri"

(EE) Failed to load module "dri" (module does not exist, 0)

(II) LoadModule: "dri2"

(WW) Warning, couldn't open module dri2

(II) UnloadModule: "dri2"

(EE) Failed to load module "dri2" (module does not exist, 0)

(II) LoadModule: "nvidia"

(II) Loading /usr/lib/xorg/modules/drivers//nvidia_drv.so

...

I don't understand why it would be trying to load these modules, because I have them both commented out in the Xorg.conf I'm using:

```
Section "Module"

        Load  "record"

#       Load  "dri2"

#       Load  "dri"

        Load  "glx"

        Load  "dbe"

        Load  "extmod"

EndSection

```

Also, whether or not I use the nvidia-drivers package, I get this note repeated 4 times:

expected keysym, got XF86Touchpad Toggle : line 122 of inet

That's also confusing, because I don't have a touchpad, or even a laptop.

At first I just tried just using startx without an xorg.conf, like the Xorg guide suggests, but then the NVidia guide suggested modifying it, so I modified the one I had generated with:

```
Xorg -configure
```

I haven't installed a window manager or display manager or configured my /etc/rc.conf for that, because the guide didn't say I need to to test it.  I thought that might be explaining the black screen, but it doesn't explain the errors.

I have hal installed and it runs (it wasn't installed at first, because I didn't set USE=hal until I realized it wasn't), and I rebuilt xorg-server with hal support.  That removed several other "Failed to load module" errors, but not these ones.

Does anyone have any clues about what I can try next?  I suspect the problem is specific to my graphics card... but I did have Gentoo installed years ago with the same hardware, and I have Ubuntu working on it currently.

This might be a bug in Gentoo, so if no one can figure out what's wrong, I guess I'll report it.  But I thought there might be something I'm doing wrong that I don't know enough about to debug.

----------

## kevstar31

Post your make.conf,  full xorg.conf, the output of lspci and your kernel config in a paste bin.

http://pastebin.com/

----------

## NathanZachary

With the newer versions of X, you don't want to have a full xorg.conf.  For instance, the only thing in my xorg.conf is:

```

Section "Device"

  Identifier "nVidia Inc. GeForce 6800 GT OC"

  Driver     "nvidia"

  VideoRam   262144

EndSection

```

----------

## g4c9z

kevstar31: I put the info you requested here:

http://pastebin.com/KD6fZB38

NathanZachary: I tried booting with a simpler xorg.conf, removing from it all but the following:

```
Section "Device"

   Identifier  "Card0"

   Driver      "nvidia"

   VendorName  "nVidia Corporation"

   BoardName   "NV17 [GeForce4 MX 440]"

   BusID       "PCI:2:0:0"

EndSection

```

I got exactly the same errors.  I'm not sure why my generated file doesn't specify the video ram, or why it says "Card0" instead of a full identifier.  Could that be a clue?

----------

## Etal

Could you try this?

```
$ X &

<switch back to the console and press enter>

$ DISPLAY=:0 xterm
```

For me, if I just run "X", nothing is shown until I actually run an applications on it - maybe your startx isn't starting any applications?

----------

## kevstar31

In make.conf

Change

 *Quote:*   

> INPUT_DEVICES="evdev vesa"
> 
> VIDEO_CARDS="nvidia nv"

 

To

 *Quote:*   

> INPUT_DEVICES="evdev keyboard mouse"
> 
> VIDEO_CARDS="nvidia nv vesa"

 

Disable all the configuration options below:

 *Quote:*   

> 
> 
> CONFIG_FB_VESA=y
> 
> CONFIG_FB_EFI=y
> ...

 

Use make menuconfig or genkernel --menuconfig and hit / to search for these configuration options

The frame buffer does not work with the nvidia drivers.

----------

## g4c9z

AM088: That worked!  I didn't have xterm installed at first, though, because the guide didn't say I needed it - I just did emerge xorg-server.  Once I emerged xterm and did as you suggested, I got an xterm.

However, that still doesn't explain the aforementioned error messages I'm still getting.  kevstar31, I tried your suggestion, and the dri and touchpad error messages were still there.  Also, the Nvidia guide mentions compiling a framebuffer in your kernel - why would it do that if you aren't supposed to?  Also, in order to disable CONFIG_FRAMEBUFFER_CONSOLE, I also had to deselect Direct Rendering Manager (DRI) from Device Drivers -> Graphics Support in my kernel - I'm not sure if that's relevant.

I ran emerge --newuse --update --deep -a world after making the changes you suggested, to recompile X with the new drivers.  And yes, I copied the new kernel to /boot.

What causes these dri drivers to attempt to load?  It seems that the fact that they're not in xorg.conf is not enough to prevent them from being loaded...

----------

## Etal

I just used xterm as an example, you could have used any other graphical program.

As for the dri modules,  don't worry about them - you don't need it - nvidia has all the necessary stuff in its own module. The reason you get this is that it is usually supposed to start by default, but because you don't have any drivers that actually use it, it didn't get compiled. Just be sure you ran "eselect opengl set nvidia" to take advantage of the nvidia driver.

----------

## NathanZachary

Oh, that portion of the X HOWTO certainly needs to be updated.  One needs to have a graphical environment of some type installed if one used xorg-server instead of xorg-x11.  Otherwise, there is essentially nothing to start.

----------

## Etal

 *NathanZachary wrote:*   

> Oh, that portion of the X HOWTO certainly needs to be updated.  One needs to have a graphical environment of some type installed if one used xorg-server instead of xorg-x11.  Otherwise, there is essentially nothing to start.

 

Yeah, it used to be that xterm, twm and friends were pulled in with xorg-x11, but that changed a few months ago.

----------

## NathanZachary

I will look into updating that guide sometime in the very near future to have a warning about this issue.  Thanks for bringing it to my attention.  :Smile: 

----------

## BigAl

Hi,

I'm having similar problems to the OP - installed gentoo as normal, but startx & the like don't work. nvidia-drivers-190.53-r1 are installed without problem with gentoo-sources-2.6.32-r7.

VIDEO_CARDS="nvidia vesa":

Everything (startx, xdm, kde, etc) works perfectly, except xorg uses the vesa driver -> poor graphics

VIDEO_CARDS="nvidia nv":

- startx kills the computer -> physical reboot needed, though you can see + move the mouse cursor (which looks to be of the right screen resolution)

- running xdm semi-works; the screen is mostly black with a few blue lines vaguely resembling the desired kdm login screen, and the mouse is usable.

- Xorg log file: http://paste.pocoo.org/show/183492/

VIDEO_CARDS="nvidia":

- startx just prints out the Xorg log to the screen, nothing else works.

- Xorg log file: http://paste.pocoo.org/show/183508/

Other information:

- http://paste.pocoo.org/show/183490/  - emerge --info

- http://paste.pocoo.org/show/183495/ - output of 'cat .config | egrep -i 'vesa|nv' | wgetpaste'

- The nvidia driver is modprobed fine and working, opengl has been set ot use it. 

Not sure what I'm doing wrong - never had issues with xorg/nvidia for many a year since I used to enter panic mode everytime I went into xorg.conf. 

I assume my problem is simply to force xorg to use the nvidia driver somehow instead of vesa/nv/nothing? If I put my own xorg.conf into /etc/X11/ will it be used by xorg? In the past I've used far fewer USE flags than I have this time, could that be causing issues? Tempted to reinstall with only necessary use flags... Or shall I try to use older versions of nvidia-drivers or xorg?

----------

## BigAl

Actually nevermind, hmm seems a potential problem is that desptie using gentoo-sources-2.6.32-r7, Xorg and prolly other things still thinks I'm using 2.6.33 (downgraded) - despite eselect showing the correct kernel is being used. Weird!

----------

## NathanZachary

I have submitted a bug report with the proposed changes made to the X Server Configuration guide.

----------

