You are not logged in.

#1 2017-01-09 14:31:54

ElRon91
Member
Registered: 2017-01-09
Posts: 7

[SOLVED] X fails to start with Nvidia Optimus, Screen turns black

Hello smart people,
I am using Arch Linux for about a year on my Desktop. Everything works perfectly there. So I decided to install Arch on my Notebook as well. I have a Core i5 3317u with a Nvidia 740m. The base installation went fine and i was able to startx after installing xorg including xorg-server-devel (which was needed on my desktop in order to use nvidia-settings properly).
That was before i installed the nvidia group according to the arch wiki. Here is what i did:
install mesa.
install intel-dri (which seems to be mesa, correct me if im wrong here)
remove mesa-libgl
install nvidia and select from nvidia-libgl (default was mesa-libgl and thats what i just removed...).
editing the xorg.conf according to the wiki

Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "<BusID for NVIDIA device here>"
    Option "AllowEmptyInitialConfiguration"
EndSection

editing the ~/.xinitrc according to the wiki with:

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec startxfce4

I also installed xfce plus goodies if that matters.

So from my understanding if i startx it looks for the xinitrc file in my home folder. It does not exist by default, so if there is no such file in home it uses the generic one located at /etc/X11/xinit/xinitrc. Again, correct me if im wrong.
When i execute startx my screen turns black and i dont see anything at all. I think this is a good sign, since there were no errors with executing startx, but i would love to see something on my screen ofc... big_smile

Thanks in advance and sorry for my poor english skills wink
ElRon

Last edited by ElRon91 (2017-01-14 12:09:46)

Offline

#2 2017-01-09 15:15:53

steviesteve78
Member
Registered: 2017-01-09
Posts: 2

Re: [SOLVED] X fails to start with Nvidia Optimus, Screen turns black

Hi

I have had a long-standing battle with this issue over the last 12 months of learning Arch.

Here is what works for me...

This

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec startxfce4

only works when I put it in: /etc/X11/xinit/xinitrc

And my xorg.conf looks like:

Section "ServerLayout"
    Identifier "Xorg"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0:2:0"
EndSection

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

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "UseDisplayDevice" "none"
EndSection

Section "Screen"
    Identifier "intel"
    Device "modesetting"
EndSection
   
I have built it from various sources online using trial and error to get it going. I have no more issues but with this setup I am always using the nvidia card which is great for gaming but sucks for power management. You can also look-up nvidia-xrun which does work but has compatibility issues with bbswitch & bumblebee.

If you want a login screen or display manager, you should try lightdm, apparantly it can be made to work with this setup.

I personally do not use one. I boot to terminal and login then run startx from there. Everything working perfectly.

Let me know how you get on :-)

Last edited by steviesteve78 (2017-01-09 16:36:19)

Offline

#3 2017-01-09 20:38:15

ElRon91
Member
Registered: 2017-01-09
Posts: 7

Re: [SOLVED] X fails to start with Nvidia Optimus, Screen turns black

Hi there,

I'm afraid this doesn't work for me. I use exactly everything you had in your conf files, but my problem persists. I still get a black screen after startx. Could you maybe give me your entire xinitrc? i wonder where that differs. Thanks alot for your fast response tho wink

Offline

#4 2017-01-09 21:32:34

ElRon91
Member
Registered: 2017-01-09
Posts: 7

Re: [SOLVED] X fails to start with Nvidia Optimus, Screen turns black

Ok, i fixed something. I have xfce loading up using the nvidia gpu. Problem is i have massive tearing while moving windows around. I had a similar Problem on my Desktop in Gnome, to fix it i enabled 'force Composition Pipeline'. However, i cant make these changes on my laptop. The only suspicious thing i can see is that the X Server Display Configuration only shows 'X Screen 0 (no Scanout)' rather then a proper name.

However, startx worked after removing the ~./xinitrc and editing the generic one according to the wiki with

...

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
        [ -x "$f" ] && . "$f"
    done
    unset f
fi

# twm &
# xclock -geometry 50x50-1+1 &
# xterm -geometry 80x50+494+51 &
# xterm -geometry 80x20+494-0 &
# exec xterm -geometry 80x66+0+0 -name login

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec startxfce4

Thx steviesteve78 for providing his conf files; i owe you one wink

Would be happy if we can solve the remaining problem too

Offline

#5 2017-01-09 23:51:57

steviesteve78
Member
Registered: 2017-01-09
Posts: 2

Re: [SOLVED] X fails to start with Nvidia Optimus, Screen turns black

I'm glad you are up and running...

My xinitrc is literally just the last 3 lines - nothing else there at all:

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec startxfce4

I do not experience the tearing. Have you tried the Windows settings tweaks on XFCE4? It's in the settings section.

I also remember seeing something about fixing tearing through changing options in the xorg file - can't search right now but I'm sure it's in the arch wiki.

Good luck.

Offline

#6 2017-01-14 12:18:05

ElRon91
Member
Registered: 2017-01-09
Posts: 7

Re: [SOLVED] X fails to start with Nvidia Optimus, Screen turns black

Ok, i marked this as solved.
To prevent Screen Tearing i installed LXQT instead of XFCE, since i dont really care about the DE. It reduced tearing a lot.

The reason why nvidia-settings doesnt show my display:
The display is actually connected to the Intel Graphics. I edited the xorg.conf to load "forceCompositionPipeline" at boot. That reduced tearing even further. Now everything is running fine, even tho i still cant enable optimus atm, So its working ONLY for the nvidia-card.

Thx again wink

Offline

Board footer

Powered by FluxBB