How to install nvidia driver for secondary GPU on laptop


i dont know how important this is but here is mine:

# Xsetup - run as root before the login dialog appears

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

did you adjust scaling settings>monitor/display> scale (something like that)


Yes actually when I was following the tutorial, it said that I had to create this file Xsetup, but I already had one with those 2 lines above, so I thought I should replace it or something. Think it’s worth a try?

did you adjust scaling settings>monitor/display> scale (something like that)

before the DPI was again forced to 96, but the scale was at 1.1, and the splash screen was ok, but the terminals had transparent lines appearing under the current line so I switched back.


Oh damn that was actually the problem. When I was following the tutorial it said to create a new file called Xsetup in that directory, but I got confused since I already had such a file there, so instead of appending those 2 lines from the tutorial

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

I just replaced my entire file with just those 2 lines. I thought the previous weren’t functional anyway since they were commented out, but I just restored them and now my desktop runs normally like it’s supposed to AND the splash screen isn’t off to the edge of the screen.

Even more now I don’t have the process sddm-greeter, instead I have sddm-helper and Xorg under the parent process sddm and they’re NOT randomly taking up 100% of a single CPU core like before.

Monitor doesn't detect DisplayPort connection, if it's turned on after the computer
[HowTo] Set up PRIME with NVIDIA proprietary driver

yes, IIRC the #!/bin/sh is needed to run as a script.

adjust scaling size first, then font, if your having graphical anomalies, change the compositor (in that same monitor section somewhere) to opengl 2 or 3, switch them around and see which works best

ok, im on my kde install now to do some comparisons to your setup. did you change the Xsetup script? does kde now start up properly?

EDIT: could you post the entire output of
cat /etc/X11/mhwd.d/nvidia.conf


Ok so far now after fixing Xsetup everything seems to be working mostly ok, however when resuming after a suspend, I get a notification from KWin window manager saying that desktop effects were restarted due to a graphics reset, and afterwards the text on desktop folders look like this. I’m thinking of making a backup of my current setup and restoring my timeshift before this adventure so I can redo it properly this time.

Here’s how it looks after resuming, but only for the files that were already there, newly created ones don’t break until another suspend.

cat /etc/X11/mhwd.d/nvidia.conf

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 415.27

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

Section "Files"

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
	Option "NoLogo" "1"

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24

Section "Extensions"
    Option         "COMPOSITE" "Enable"

Section "InputClass"
    Identifier          "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"


edit nvidia.conf and change the screen section to look like this. that should fix most/all of the scaling problems

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Option     "UseEdidDpi" "False"
        Option     "DPI" "96x96"

so you now have a fully, properly booting system? no more manually starting x?

ah yes, the wonderful world of kde compostitor :poop:. i too get graphical glitches after wake where my latte-dock looks like its made of high definition static (at least its hd :grin:). that nvidia.conf fix i listed above may improve that. other than that you can try different compositor options and see if it helps.

you can do that, it likely would not make a difference for the compositor glitches. that could be fixed by having the compositor restarted after suspend which is easy enough to do with a systemd service, i think i have one laying around i could easily modify to do that.

since you know where you went wrong with the xsetup, backing up your current setup before returning to the old one and doing prime setup over would not take very long, the tutorial only took you what maybe 10-15 min?

the rest of the time was spent troubleshooting human error, which has been the case with anyone who follows that tutorial and runs into issues, including myself. now that you know what to be careful of you could do that easily.


I “repaired” the tutorial, after this possible “human” error was discovered.:wink:

Another option is a keyboard or panel shortcut, as was proposed by @tbg a while ago.


is there a special way of restarting the compositor?


I guess it’s restarting kwin that does the job.
I"ll try to find the command, if you don’t have it already…


kquitapp5 plasmashell
kstart5 plasmashell

kquitapp5 plasmashell ; sleep 1 ; kstart5 plasmashell & exit
this seems to work as intended


something i do notice now that was not an issue i had a week ago (last time i used kde) as @kik4444 also noticed was the graphical glitch where typing in the terminal has a transparent line under it. hmmm… i miss my openbox, i dont have these issues :smirk:


Ok so I’ve restarted from scratch, this time I didn’t make any mistakes on the bus ID and Xsetup, and now it runs fine, I didn’t even need to mess with grub and systemctl


good, so your one of the lucky few that dont need kernel parameters to boot your optimus laptop. :sob:
hows the compositing? scaling?

that change i mentioned to nvidia.conf actually tamed all the crazy settings i had to make to fonts/scaling/browser text size. before changing others i would add that first and reboot.

the graphical glitches i just noticed today as you have also, seem to be fixed with opengl 3.1 and full screen repaints
spoke too soon, the only thing that fixes the “hd static” seems to be logout/login of desktop. (or reboot as i used to do with kde after suspend). either way it’s annoying and its been an issue for a while now. alternatively i can just restart latte-dock which is effected the most by suspend, moving the mouse over the icons does fix the icons but the spacers remain “hd static”.
ok well for me this concludes the amount of life im willing to waste on kde. back to openbox it is for me. dont get me wrong, i like kde, i just like OB better :grin:


Yeah the problem with the static text on the desktop is still present after resuming, even though this time I didn’t get a KWin notification


Try this after changes and/or plasma5 restart

qdbus org.kde.KWin /KWin reconfigure


And how about “Solving” this topic?
I suggest you mark this as solution, or the one that @dglt suggested PRIME setup.


Yeah that is technically what ended it all.

Interestingly enough, if I try to rename the things on the desktop, but enter the same name, the “static” disappears, and so far that’s the only problem I’ve noticed.


what about my growing reputation of painfully long help threads? :rofl: like this one for example. :fearful:


Our DMs are technically under 100 messages :+1:


now you can wipe the other backup and back this one up. no need to keep a flawed backup.

also, it would be cool if you could do some real world battery life comparisons between bumblebee and prime, theres a lot of mixed opinions on the matter but not many facts. just an idea, i think alot of people would be interested in that