Askannz / optimus-manager

A Linux program to handle GPU switching on Optimus laptops.
MIT License
2.25k stars 165 forks source link

xorg files prevents the desktop environment from starting, for some reason. #544

Closed pato-pan closed 1 year ago

pato-pan commented 1 year ago

I am confused because, if you only use the startup option in the configuration (instead of -switch), all this script is doing is generating an xorg configuration file. However when startup integrated is chosen I am not able to access my desktop environment, and I can't open a terminal session by using any of the ctrl+alt+f# shortcuts (sometimes ctrl+alt+delete for a restart doesn't work). Looking at the xorg, lightdm, and journalctl logs didn't show any errors.

To troubleshoot this issue, I unninstalled optimus-manager and made a copy of the config file it generated for xorg. I had also done a clean install where only my intel gpu is used, and generated an xorg.conf file for testing. Please assume I had always deleted xorg.conf and any file related to my gpu inside xorg.conf.d before performing these tests. I had also done this on a clean install without optimus-manager installed. Here's what I found.

10-optimus-manager.conf doesn't work

Section "Device"
    Identifier "integrated"
    Driver "modesetting"
    BusID "PCI:0:2:0"
    Option "DRI" "3"
EndSection

xorg.conf for intel does work

Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" RightOf "Screen0"
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    ModulePath   "/usr/lib/xorg/modules"
    FontPath     "/usr/share/fonts/misc"
    FontPath     "/usr/share/fonts/TTF"
    FontPath     "/usr/share/fonts/OTF"
    FontPath     "/usr/share/fonts/Type1"
    FontPath     "/usr/share/fonts/100dpi"
    FontPath     "/usr/share/fonts/75dpi"
EndSection

Section "Module"
    Load  "glx"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option      "Protocol" "auto"
    Option      "Device" "/dev/input/mice"
    Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Monitor"
    Identifier   "Monitor1"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "SWcursor"              # [<bool>]
        #Option     "kmsdev"                # <str>
        #Option     "ShadowFB"              # [<bool>]
        #Option     "AccelMethod"           # <str>
        #Option     "PageFlip"              # [<bool>]
        #Option     "ZaphodHeads"           # <str>
        #Option     "DoubleShadow"          # [<bool>]
        #Option     "Atomic"                # [<bool>]
        #Option     "VariableRefresh"       # [<bool>]
        #Option     "UseGammaLUT"           # [<bool>]
        #Option     "AsyncFlipSecondaries"  # [<bool>]
    Identifier  "Card0"
    Driver      "modesetting"
    BusID       "PCI:0:2:0"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "SWcursor"              # [<bool>]
        #Option     "kmsdev"                # <str>
        #Option     "ShadowFB"              # [<bool>]
        #Option     "AccelMethod"           # <str>
        #Option     "PageFlip"              # [<bool>]
        #Option     "ZaphodHeads"           # <str>
        #Option     "DoubleShadow"          # [<bool>]
        #Option     "Atomic"                # [<bool>]
        #Option     "VariableRefresh"       # [<bool>]
        #Option     "UseGammaLUT"           # [<bool>]
        #Option     "AsyncFlipSecondaries"  # [<bool>]
    Identifier  "Card1"
    Driver      "modesetting"
    BusID       "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
    SubSection "Display"
        Viewport   0 0
        Depth     1
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

Section "Screen"
    Identifier "Screen1"
    Device     "Card1"
    Monitor    "Monitor1"
    SubSection "Display"
        Viewport   0 0
        Depth     1
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

I look at this and I just wonder. Why? I have no idea. I changed the identifier to say Card0, and that made no difference. I am new to dealing with xorg files, but based on what I read I believe this is how xorg.conf.d is supposed to work. Simply apply the settings inside the file inside of it and let that take priority over anything that's not autogenerated. Then why is it not doing that?? I am so confused. I am not even dealing with optimus-manager at this point, it's xorg, but I had made this issue here because I think it would be a good idea for this program to implement a fix for this or for the solution to at least be recommended somewhere people might be looking at.

I should mention, I am using a desktop computer. I don't have an optimus laptop. My cpu is an Intel i5-12400, my gpu is an NVIDIA GeForce RTX 3080. I am also using arch linux with xfce4 and btrfs. Because of this problem I had been considering just writing a simple script that copy and pastes xorg.conf files I generated instead.

Here's the logs

Xorg.0.log.old

lightdm.log.old

x-0.log.old

Note: I guess Github doesn't allow you to post a ton of code or logs without hurting the readability of the post. Shortening the xorg.conf above would be nice but I have no idea which part of this is leading to a diferent result.

pato-pan commented 1 year ago

nevermind. It was not working because I didn't have my monitor plugged in into my motherboard, only my gpu. Plugging my monitor into my motherboard solved the issue.