Configuration files for NVIDIA Drivers on Optimus laptops

Following are the .conf files of a working NVidia Drivers installation on a muxless Optimus laptop. If you are having problems with the drivers check /var/log/Xorg.0.log to see exactly what’s wrong and the laptop won’t boot.

  • /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 "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
2 Likes

Thank you for putting your files here.

You were very lucky, I still struggle with this on an MX150. The driver seems to load, but GDM does not for some reason.

My xorg log can be found here: https://gist.github.com/lf-araujo/1106640c7a66dee16fe61965bf5ccd05

1 Like