Has anyone successfully installed NVIDIA driver to Optimus enabled laptops?

Hi! I have a Optimus laptop with Intel Core i7-6700HQ and GTX 950M hardware (MSI GP62 6QE). I took a look to Clear Linux’s benchmarks so it’s looks like a benchmark killer and feels a rock solid system. I want to do it my main system but two things confusing me.

Installing with NVIDIA’s .run package instead package manager is really hard. I hope Clear Linux devs will make a installing option through swupd. After couple hours of night with dealing NVIDIA’s installer errors (the last one i couldn’t pass:“Unable to load nvidia-drm modules”), i left Clear Linux sadly. (I tried this script)

NVIDIA Optimus is really feels pain in Linux. It makes system crash, using with poor performance (bumblebee), in some distros it makes even unable to boot.

So i need advices from people who has setup with NVIDIA Optimus hardware.

I remember @specter and @mstute made some notes about their journey with Optimus. Maybe they’ll have some ideas for you.

Here are their previous posts:

In the post of bash install script, there is a link to one of my repository where I ported nvdia-xrun for Clear Linux. If you eventually want to try nvdia-xrun, you can use that port.

Hello, I tried to install the Nvidia drivers on my Optimus laptop using the Manjaro Nvidia Prime method as I indicated in the post above. I got a black screen so I tried to comment the disable the nouveau drivers in /etc/modprobe.d/disable-nouveau.conf . Now I can’t even get to a terminal. As is obvious I’m a complete noob, is there any way to revert this? When I installed the Nvidia drivers I got an error that something went wrong. Also I got 2 warnings when installing the Nvidia driver.

EDIT: I managed to uncomment what I have commented so now I have a terminal. Is there anything I can do to make the drivers work? I still get a black screen. The Nvidia modules seem to be loaded. From what I understand no screens can be found, altho the laptop obviously has a screen.

EDIT2: Ok, after wasting a day trying to find out what’s wrong I finally managed to get it working. I uninstalled the drivers, reinstalled them using the scripts provided by the thread above and did all the steps the Manjaro Prime thread mentions but then I couldn’t even get in a terminal. The system just hang on a blinking cursor.
So, I checked the Xorg logs and noticed that xorg only loaded modules from one of the ModulePaths (namely /usr/lib64/xorg/modules) and I couldn’t make it load modules from /opt/nvidia/lib64 for no reason whatsoever. So, I copied all the modules present in /opt/nvidia/lib64 in /usr/lib64/xorg/modules and now everything works like a charm. :smiley: Is this a bug or am I doing something wrong?

A little question: Does writing options nvidia_drm modeset=1 to nvidia-drm.conf allows to pass Unable to load nvidia-drm modules error while installing nvidia drivers?

Where is the post about Manjaro NVIDIA prime method?

Here is the article mentioned in the second post of this thread.

You must not follow section 3.1 in this article because it’s misconfigured, do you?

1 Like

Oh really? Well I researched it and found this “file”, and used that so that’s probably why it works now. But the problem is not that, the problem is that the second ModulePath set is never looked in (namely /opt/nvidia/lib64) by Xorg that’s why the computer just hang on boot before I copied the files to /usr/lib64/xorg/modules using the Live USB.

It doesn’t specify the module path so that’s why I said it’s misconfigured.
Can you post the full configuration of you Xorg here?

You mean all the .conf files or will the /var/log/Xorg.0.log do?

The file that sets both ModulePaths is created by the NVidia installer I think and is in /etc/X11/xorg.conf.d/nvidia-files-opt.conf, it contains:

Section "Files"
	ModulePath      "/opt/nvidia/lib64/xorg/modules"
	ModulePath      "/usr/lib64/xorg/modules"
EndSection

I have made edits to it so it won’t be as the nvidia installer creates it.
Is there any chance it contains symbols that make the first line not work?

As far as I know, the nvidia installer does not create this file. That is why was included as a separate step in the CL documentation: https://docs.01.org/clearlinux/latest/tutorials/nvidia.html

I have seen that the xorg.conf file created if you run nvidia-xconfig or nvidia-settings and save the configuration to a file it adds an empty “Files” section that conflicts. Maybe for some reason your system ended up with multiple xorg configs with “Files” sections causing it not to work?

Here are all the config files I can find in /etc:

  • /etc/ld.so.conf.d/nvidia.conf
/opt/nvidia/lib
/opt/nvidia/lib32
  • /etc/modprobe.d/disable-nouveau.conf
blacklist nouveau
blacklist nvidiafb
blacklist rivafb
options nouveau modeset=0
  • /etc/modprobe.d/nvidia-drm.conf
options nvidia_drm modeset=1
  • /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 430.40

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/mouse"
    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"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
  • /etc/X11/xorg.conf.nvidia-xconfig-original

This file is empty

  • /etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,gr"
        Option "XkbVariant" ","
EndSection
  • /etc/X11/xorg.conf.d/ nvidia-drm-outputclass.conf
# This xorg.conf.d configuration snippet configures the X server to
# automatically load the nvidia X driver when it detects a device driven by the
# nvidia-drm.ko kernel module.  Please note that this only works on Linux kernels
# version 3.9 or higher with CONFIG_DRM enabled, and only if the nvidia-drm.ko
# kernel module is loaded before the X server is started.

Section "OutputClass"
    Identifier     "nvidia"
    MatchDriver    "nvidia-drm"
    Driver         "nvidia"
EndSection
  • /etc/X11/xorg.conf.d/ nvidia-files-opt.conf
Section "Files"
	ModulePath      "/opt/nvidia/lib64/xorg/modules"
	ModulePath      "/usr/lib64/xorg/modules"
EndSection
  • /etc/X11/xorg.conf.d/xorg.conf
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

I don’t think there’s a contradiction somewhere, if someone knows any better please let me know. If you need any other .conf files also please tell me where to find them.

This is the problematic section that I referred to, which gets added by nvidia-xconfig:

Omg I completely missed that. OK I’m gonna remove it and see how that goes :smiley:

Thanks for the heads up :smiley:

Ok, removed it and all the nvidia modules from /usr/lib64/xorg/modules and works like a charm. Thank you so much :smiley:

That’s a great news!

So with the above configurations, you managed to have Optimus working?

Yes it’s working like a charm. I have tried Metroid Prime in Dolphin Emulator (on Vulkan), Tomb Raider (2013) on Steam and WoW Classic on Lutris. All work really well, I get ~5 FPS more than on Manjaro, especially on lower resolutions. The only thing that doesn’t work for some reason is vkcube.

Just for the record, I have a muxless laptop, so the NVIdia drivers can work on any configuration.

So I actually suggested someone to do the same modifications as you did in my post. But he disappeared and I cannot know whether this approach work.

Ok what I did was first install the drivers through the scripts. So I ran the pre_install.sh script. I rebooted, I didn’t log in, and went to a terminal (ALT +CTRL+F2) immediately. I ran the install.sh script and then the post_install.sh script. Then I rebooted to see if the latest drivers would work cause apparently they have some Prime offloading support.This didn’t work and I got an error screen.
I, then (using a terminal), followed the guide that was mentioned before and rebooted. I got a black screen and things still didn’t work.

I tried a lot of different things until I checked the /var/log/Xorg.0.log and found that the necessary ModulePaths weren’t loading. I’m sorry I don’t remember exactly what I did between the stage that wasn’t working and copying the modules to make things work. I suggest he checks his /var/log/Xorg.0.log and troubleshoots himself what’s going on exactly. But for future reference the above configuration files work, as long as you remove the problematic segment that was mentioned before.

That module file section is needed only because we installed the driver to /opt/nvidia.

Would you open a new post like “Notes for NVIDIA proprietary driver on laptop”? Quite a lot people had samilar issues. I will update my scripts to accommodate NVIDIA PRIME if more people succeeds with the configurations you have.

1 Like