# [SOLVED] Yet Another Nvidia Driver Problem

## Eightscer

Hello!  :Very Happy:   As you can probably tell, I'm pretty new to Gentoo and after three attempts I have successfully been able to install Gentoo through the handbook. Of course, it wouldn't be that simple to simply install xorg and KDE without running into what seems to be a common problem with computers that use the Nvidia graphics card... 

Right now I have hit a major roadblock that has stumped me for at least a week now   :Crying or Very sad:  , and no amount of googling and searching forum posts have saved me yet, so I have decided to post here.

The issue is that after installing xorg, I have used the proprietary nvidia-drivers to set up the xorg.conf file, but attempting to startx will give me a "no screens found" error.

I have ran "glxinfo | grep render" to see if the nvidia card is working but gives the "Error: unable to open display" error as well. I had previously been able to install SDDM and got KDE to work, but I quickly removed it because there was no way I could return to the terminal and every time I tried to log out the computer would freeze.

I have tried countless times to reinstall the drivers, reinstall xorg, emerge @module-rebuild, etc. but nothing has worked. No matter what order I follow or what the wiki tells me, I always get the same issues as described above.

I used genkernel to configure my kernel settings since I'm new to Gentoo (and Linux) in general. I made sure to follow the instructions here https://forums.gentoo.org/viewtopic-t-1013132.html and here https://wiki.gentoo.org/wiki/NVidia/nvidia-drivers#Testing_the_card, meaning that I have changed everything of the kernel that I needed to supposedly make this work (at least, I THINK so - I had recompiled the kernel and double checked to make sure if I enabled / disabled everything listed in the two links above).

I'm not going to give up yet. I'm running a new ThinkPad T580 laptop with the specs below:

Processor : 8th Generation Intel® Core™ i7-8650U Processor with vPro (1.90GHz, up to 4.20GHz with Turbo Boost, 8MB Cache)

Operating System : Windows 10 Home 64

Operating System Language : Windows 10 Home 64 English

Display : 15.6" UHD (3480 x 2160) IPS anti-glare

Memory : 32 GB (16 + 16) DDR4 2400MHz

Graphic Card : NVIDIA GeForce MX150 2GB GDDR5

Camera : IR & 720p HD Camera with microphone

Keyboard : Keyboard - US English

Security Chip : Hardware dTPM

TPM Setting : Hardware dTPM2.0 Enabled

First Hard Drive : 1 TB Solid State Drive, PCIe-NVMe OPAL2.0 M.2

System Expansion Slots : Smart Card Reader

Front Battery : 4 cell Li-Ion 32Wh

Rear Battery : 6 cell Li-Ion 72Wh Cylindrical

Power Cord : 65W AC Adapter (2pin) - USB Type C

Wireless : Intel Dual Band 8265 Wireless AC (2 x 2) & Bluetooth 4.1 with vPro

vPro Certified Model : vPro Certified

Display Panel : 15.6" UHD (3840x2160), slim flat IPS, No Touch, with IR-Camera, with Mic, with WLAN, No WWAN

Base : NVIDIA GeForce MX150 2GB

Language Pack : Publication-English

Any help would be greatly appreciated. I'm not necessarily the brightest when it comes to using Linux (considering I'm a total newbie), so I would be grateful if the instructions are simple to follow, line by line.

If there is any other technical information that you guys want me to post, I'll try to figure it out. Hopefully this thread will help others in the same situation that I've been in for several sleepless nights now...   :Sad: 

Thanks so much,   :Smile: 

-EightLast edited by Eightscer on Sat Mar 16, 2019 12:59 am; edited 1 time in total

----------

## hhfeuer

This might be an Optimus (hybrid graphics) notebook which requires additional setup.

https://devtalk.nvidia.com/default/topic/1022670/linux/official-driver-384-59-with-geforce-1050m-doesn-t-work-on-opensuse-tumbleweed-kde/post/5203910/#5203910

Please post the output of lspci -nn (as root) and pastebin a dmesg output.

----------

## Verdazil

Eightscer, сan you load the nvidia kernel module after boot as described in the guide https://wiki.gentoo.org/wiki/NVidia/nvidia-drivers?

One of the common mistakes when installing a proprietary nvidia driver is building a module with one kernel and trying to boot with another.

----------

## Eightscer

 *hhfeuer wrote:*   

> This might be an Optimus (hybrid graphics) notebook which requires additional setup.
> 
> https://devtalk.nvidia.com/default/topic/1022670/linux/official-driver-384-59-with-geforce-1050m-doesn-t-work-on-opensuse-tumbleweed-kde/post/5203910/#5203910
> 
> Please post the output of lspci -nn (as root) and pastebin a dmesg output.

 

Thanks for replying!

Here is the link to the dmesg output on pastebin:

https://pastebin.com/zgP8ACTv

And below is the output for lspci -nn:

00:00.0 Host bridge [0600]: Intel Corporation Device [8086:5914] (rev 08)

00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:5917] (rev 07)

00:04.0 Signal processing controller [1180]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem [8086:1903] (rev 08)

00:08.0 System peripheral [0880]: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model [8086:1911]

00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller [8086:9d2f] (rev 21)

00:14.2 Signal processing controller [1180]: Intel Corporation Sunrise Point-LP Thermal subsystem [8086:9d31] (rev 21)

00:16.0 Communication controller [0780]: Intel Corporation Sunrise Point-LP CSME HECI #1 [8086:9d3a] (rev 21)

00:16.3 Serial controller [0700]: Intel Corporation Device [8086:9d3d] (rev 21)

00:1c.0 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 [8086:9d10] (rev f1)

00:1c.6 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 [8086:9d16] (rev f1)

00:1d.0 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 [8086:9d18] (rev f1)

00:1d.2 PCI bridge [0604]: Intel Corporation Device [8086:9d1a] (rev f1)

00:1f.0 ISA bridge [0601]: Intel Corporation Device [8086:9d4e] (rev 21)

00:1f.2 Memory controller [0580]: Intel Corporation Sunrise Point-LP PMC [8086:9d21] (rev 21)

00:1f.3 Audio device [0403]: Intel Corporation Sunrise Point-LP HD Audio [8086:9d71] (rev 21)

00:1f.4 SMBus [0c05]: Intel Corporation Sunrise Point-LP SMBus [8086:9d23] (rev 21)

00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (4) I219-LM [8086:15d7] (rev 21)

02:00.0 3D controller [0302]: NVIDIA Corporation GP108M [GeForce MX150] [10de:1d10] (rev a1)

04:00.0 Network controller [0280]: Intel Corporation Wireless 8265 / 8275 [8086:24fd] (rev 78)

07:00.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01)

08:00.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01)

08:01.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01)

08:02.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01)

09:00.0 System peripheral [0880]: Intel Corporation JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] [8086:15bf] (rev 01)

3f:00.0 USB controller [0c03]: Intel Corporation Device [8086:15c1] (rev 01)

40:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd Device [144d:a808]

----------

## hhfeuer

Yes, it's an Optimus notebook. The kernel is fine, all drivers and firmware are up and running, so you can continue with the config from the mentioned thread.

- xorg-server has to be compiled with USE="glamor", I think that use flag is standard now but better check using

```
emerge -pv xorg-server
```

- copy/paste the xorg.conf from the post and change in the nvidia device section

```
BusID          "PCI:1:0:0"
```

to

```
BusID          "PCI:2:0:0"
```

- add the xrandr commands to your display manager or ~/.xinitrc, depending on how you start your Xserver, the arch forums link in the post explains the config files for various DMs

- switch to nvidia opengl using

```
eselect opengl set nvidia
```

and reboot.

- if everything works, add the kernel parameter for anti-tear

----------

## Eightscer

 *Verdazil wrote:*   

> Eightscer, сan you load the nvidia kernel module after boot as described in the guide https://wiki.gentoo.org/wiki/NVidia/nvidia-drivers?
> 
> One of the common mistakes when installing a proprietary nvidia driver is building a module with one kernel and trying to boot with another.

 

I'm fairly sure that I only have one kernel installed (which might be a bad idea, I don't know), so I am certain that isn't an issue.

I'm able to "modprobe nvidia" and "lsmod | grep nvidia" does give an output:

```
eightscer ~ # lsmod | grep nvidia

nvidia_drm             45056  0

nvidia_modeset       1056768  1 nvidia_drm

nvidia              17190912  1 nvidia_modeset

drm_kms_helper        188416  2 nvidia_drm,i915

drm                   520192  4 drm_kms_helper,nvidia_drm,i915

i2c_core               81920  7 videodev,drm_kms_helper,i2c_algo_bit,igb,nvidia,i915,drm

```

The nvidia-drivers wiki page does specify that to automatically load the module on every boot up the files /etc/modules-load.d/video.conf (and I think /etc/modules-load.d/video.conf as well, again I don't know) must have "nvidia" written into it, but those files do not exist for me. Do I have to manually make those files, or did I do something dumb and forgot a step somewhere?  :Confused: 

----------

## Eightscer

 *hhfeuer wrote:*   

> Yes, it's an Optimus notebook. The kernel is fine, all drivers and firmware are up and running, so you can continue with the config from the mentioned thread.
> 
> - xorg-server has to be compiled with USE="glamor", I think that use flag is standard now but better check using
> 
> ```
> ...

 

Upon emerging, it seemed to be a reinstall with the use flag you mentioned among others. I think that's ok.

 *Quote:*   

> - copy/paste the xorg.conf from the post and change in the nvidia device section
> 
> ```
> BusID          "PCI:1:0:0"
> ```
> ...

 

I could not find the line under Section "Device" in xorg.conf, so I added it.

 *Quote:*   

> - add the xrandr commands to your display manager or ~/.xinitrc, depending on how you start your Xserver, the arch forums link in the post explains the config files for various DMs

 

I am using startx to boot KDE, and added the following lines to the very top of ~/.xinitrc:

```
xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto
```

So now, based off of what I had setup while following a YouTube video about a week ago, my ~/.xinitrc now looks like this:

```
xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto

exec ck-launch-session dbus-launch --sh-syntax --exit-with-session startkde
```

 *Quote:*   

> - switch to nvidia opengl using
> 
> ```
> eselect opengl set nvidia
> ```
> ...

 

I had already switched to nvidia opengl prior to the original post, but did it again just to make sure.

I rebooted the machine, logged in as root, and tried to startx but was greeted with a black screen (another common problem I see on the forums) with an underscore in the top-left corner, with no response. Right now, I have rebooted the machine again.

Perhaps I had a bad ~/.xinitrc file or had forgotten an extra step related to KDE or xorg? I had installed KDE and set up the xinit a while ago, so I'm not sure if I had set up something along the way that conflicts with what I currently have now...

But it's great to see that I'm not longer getting the "no screens found" error anymore, that means we must be making progress!  :Very Happy: 

----------

## hhfeuer

Please post your current xorg.conf.

----------

## Eightscer

 *hhfeuer wrote:*   

> Please post your current xorg.conf.

 

Here you go:

```
# nvidia-xconfig: X configuration file generated by nvidia-xconfig

# nvidia-xconfig:  version 418.43

Section "ServerLayout"

    Identifier     "Layout0"

    Screen      0  "Screen0"

    InputDevice    "Keyboard0" "CoreKeyboard"

    InputDevice    "Mouse0" "CorePointer"

EndSection

Section "Files"

EndSection

Section "InputDevice"

    # generated from data in "/etc/conf.d/gpm"

    Identifier     "Mouse0"

    Driver         "mouse"

    Option         "Protocol"

    Option         "Device" "/dev/input/mice"

    Option         "Emulate3Buttons" "no"

    Option         "ZAxisMapping" "4 5"

EndSection

Section "InputDevice"

    # generated from default

    Identifier     "Keyboard0"

    Driver         "kbd"

EndSection

Section "Monitor"

    Identifier     "Monitor0"

    VendorName     "Unknown"

    ModelName      "Unknown"

    HorizSync       28.0 - 33.0

    VertRefresh     43.0 - 72.0

    Option         "DPMS"

EndSection

Section "Device"

    Identifier     "Device0"

    Driver         "nvidia"

    VendorName     "NVIDIA Corporation"

    BusID      "PCI:2:0:0"

EndSection

Section "Screen"

    Identifier     "Screen0"

    Device         "Device0"

    Monitor        "Monitor0"

    DefaultDepth    24

    SubSection     "Display"

        Depth       24

    EndSubSection

EndSection
```

----------

## hhfeuer

Errm, no, that doesn't work. Use this:

```
    Section "ServerLayout"

        Identifier     "layout"

        Screen      0  "nvidia" 0 0

        Inactive       "intel"

    EndSection

    Section "Monitor"

        Identifier     "Monitor0"

        Modeline "1280x720_60.00"  74.48  1280 1336 1472 1664  720 721 724 746  -HSync +Vsync

    EndSection

    Section "Device"

        Identifier     "intel"

        Driver         "modesetting"

        Option         "AccelMethod" "none"

        BusID          "PCI:0:2:0"

    EndSection

    Section "Device"

        Identifier     "nvidia"

        Driver         "nvidia"

        VendorName     "NVIDIA Corporation"

        BusID          "PCI:2:0:0"

        Option         "AllowEmptyInitialConfiguration"

    EndSection

    Section "Screen"

        Identifier     "nvidia"

        Device         "nvidia"

        Monitor        "Monitor0"

    EndSection

```

----------

## Eightscer

 *hhfeuer wrote:*   

> Errm, no, that doesn't work. Use this:
> 
> ```
>     Section "ServerLayout"
> 
> ...

 

I replaced the xorg.conf with exactly that. Saved it, rebooted, and entered startx. This time, another familiar problem occurs, in that the screen goes completely black with no back-lighting.

It turns out I was being dumb and I forgot to install xrandr, but even after (taking a few more minutes to get wpa_supplicant to help WiFi work again  :Rolling Eyes:   and) emerging it and using startx again I'm still greeted with a black screen.

Reading the wiki here at https://wiki.gentoo.org/wiki/NVIDIA/Optimus, it mentions that "creating .xsessionrc and placing the xinitrc commands in there COULD fix" the blank screen issue.

I create an ~/.xsessionrc file with all of the .xinitrc lines in it, startx, and... nothing. Typing in

```
xrandr --listproviders
```

gives a "Can't open display" error. Still, startx works without any errors but now I am presented with what I described before.

----------

## hhfeuer

From another console, you'll have to run

```
DISPLAY=:0 xrandr --listproviders
```

Please pastebin your Xorg.0.log

----------

## Eightscer

 *hhfeuer wrote:*   

> From another console, you'll have to run
> 
> ```
> DISPLAY=:0 xrandr --listproviders
> ```
> ...

 

How would I open another console? I have successfully installed xterm but upon use I get the following:

```
Warning: this program is an suid-root program or is being run by the root user.

The full text of the error or warning message cannot be safely formatted

in this environment. You may get a more descriptive message by running the

program as a non-root user or by removing the suid bit on the executable.

xterm: Xt error: Can't open display: %s

xterm: DISPLAY is not set
```

 *Quote:*   

> Please pastebin your Xorg.0.log

 

You got it: https://pastebin.com/axPTena2

----------

## hhfeuer

Another console e.g.: ctrl+alt+F1...Fn

The Xserver is running fine, so all that's missing is the xrandr commands.

Maybe try a simple ~/.xinitrc:

```
xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto

xterm &

exec xterm

```

should give an Xserver with a single xterm

You can then check if the .xinitrc is picked up using

```
ps a |grep xterm
```

----------

## Eightscer

 *hhfeuer wrote:*   

> Another console e.g.: ctrl+alt+F1...Fn

 

Unfortunately, I can't seem to get that to work... pressing the key combination gives me a tilde (~) and nothing else. Now that I play around with it, holding fn and the function keys gives me A, B, C, etc.

Perhaps I have the wrong keyboard setting? If so, how would I change it?

 *Quote:*   

> The Xserver is running fine, so all that's missing is the xrandr commands.
> 
> Maybe try a simple ~/.xinitrc:
> 
> ```
> ...

 

With the changes applied and without another terminal, startx will still give the blank screen.

Again without the extra terminal, "ps a | grep xterm" gives:

```
 3953 tty1     S+     0:00 grep --colour=auto xterm
```

----------

## hhfeuer

Then startx is simply ignoring your .xinitrc

For a workaround, add the xrandr commands at the beginning of /etc/X11/Sessions/Xsession

Then you should install a DM like lightdm or sddm and add the config like described here:

https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Display_Managers

----------

## Eightscer

 *hhfeuer wrote:*   

> Then startx is simply ignoring your .xinitrc
> 
> For a workaround, add the xrandr commands at the beginning of /etc/X11/Sessions/Xsession

 

I inserted the following lines at the top of Xsession:

```
xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto
```

 *Quote:*   

> Then you should install a DM like lightdm or sddm and add the config like described here:
> 
> https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Display_Managers

 

Turns out I never uninstalled sddm, so I went ahead and wrote the same two lines as before into /usr/share/sddm/scripts/Xsetup (as the wiki stated), making the Xsetup look like the following:

```
#!/bin/sh

# Xsetup - run as root before the login dialogue appears

xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto
```

I typed in "sddm," and - wow! It actually worked! I logged in as my user account "oscar" and successfully got chromium working!   :Surprised: 

I haven't tested it out to see if it consistently works yet, and I haven't also checked to see if the wifi will still need to be manually configured everytime I boot the PC, but everything seems to be working at this moment! Now it doesn't crash when I log out either!  :Very Happy: 

I can't thank you enough for your help, hhfeuer, I think I'll be able to figure things out from here.

Sorry if I had been too much of a hassle. Hopefully other Optimus users can follow along in this thread and get their laptops working with as much hassle as I did.

----------

