Linux newb looking for some help regarding eGPU and games

Small introduction

Howdy folks. I’m somebody who is attempting to try out linux every oftern or so to see if I could move to linux at one point. Now I’ve reached to the point where I’m trying EndevourOS, as I heard it has friendly and helpful community and is arch based (so far my attempts have shown that I have best experience on arch based distros) and to my surprise it seems to be the first distro I’ve tried, that seems to be able to handly my annoying setup.

A brief introduction to my setup

An i7-11800H laptop with integrated Intel graphics + dedicated NVidia RTX 3070 Mobile (damn Nvidia Optimus).

No BIOS option to fully disable the integrated card in BIOS, if I could I would do it as I always set everything to use the Nvidia card.

When I’m at home, I also attach an thunderbult eGPU Nvidia RTX 3080 to the system. Due to the fact that my daily monitor is 3440 x 1440 ultrawide monitor and I also do some gaming, the eGPU is needed to decently run stuff on this setup. The eGPU has been the part that has been a pain in the neck to get properly working (in Manjaro for example, which was my last attempt, it seemed like it was working, but not on it’s full performance - if you want to read about that, here).

I’m using Xorg as on wayland there is no way (that I know at least) to configure the system to use the eGPU only.

Current attempt at the issue

On Endeavour thought, at least first tests indicate to me that the eGPU is working, at least better. However I’ve stumbled upon a strange bug with one the games play a lot and have used as benchmarking so far: Snowrunner (runs through proton).

When I have no eGPU connected, the game runs just fine, but when I have the eGPU connected, the game opens to black screen and immediately closes.

Proton log for the game:

I also attempted to launch the game with PROTON_USE_WINED3D=1 %command%, while it reached the main menu with that method, once i start loading the game itself it does nothing, just sits on black screen.

I also tested Euro Truck Simulator 2 through Proton. When I launch the game using DirectX version, I’m greeted with this error:

When I use Proton and OpenGL launch option, the game works. If don’t use proton at all, native linux method, the game also works. So it seems to me the issue is related to directx (so dxvk essentially?)

How my eGPU is configured

  1. Installed:
  • optimus-manager
  • optimus-manager-qt
  • plasma-thunderbolt
  1. Configured Optimus manager to always run using Nvidia GPU. This generates into /etc/X11/xorg.conf.d

    Section "Files"
            ModulePath "/usr/lib/nvidia"
            ModulePath "/usr/lib32/nvidia"
            ModulePath "/usr/lib32/nvidia/xorg/modules"
            ModulePath "/usr/lib32/xorg/modules"
            ModulePath "/usr/lib64/nvidia/xorg/modules"
            ModulePath "/usr/lib64/nvidia/xorg"
            ModulePath "/usr/lib64/xorg/modules"
    Section "ServerLayout"
            Identifier "layout"
            Screen 0 "nvidia"
            Inactive "integrated"
    Section "Device"
            Identifier "nvidia"
            Driver "nvidia"
            BusID "PCI:1:0:0"
            Option "Coolbits" "28"
            Option "TripleBuffer" "true"
    Section "Screen"
            Identifier "nvidia"
            Device "nvidia"
            Option "AllowEmptyInitialConfiguration"
            Option "AllowExternalGpus"
    Section "Device"
            Identifier "integrated"
            Driver "modesetting"
            BusID "PCI:0:2:0"
    Section "Screen"
            Identifier "integrated"
            Device "integrated"
  2. Created my own script to detect eGPU (which I’ve built over a year on varius distros by piecing together multiple existing scripts) and copy needed configuration files:
    In /etc/X11/xorg.conf.d I’ve created file:

    Section "ServerLayout"
       Identifier "egpu"
       Screen 0 "nvidiaegpu"
       Inactive "nvidia"
       Inactive "integrated"
    Section "Device"
       Identifier "nvidiaegpu"
       Driver "nvidia"
       BusID "PCI:5:0:0"
       Option "AllowEmptyInitialConfiguration"
       Option "AllowExternalGpus"
    Section "Screen"
       Identifier "nvidiaegpu"
       Device "nvidiaegpu"
       Option "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On}"
       Option "TripleBuffer" "on"
       Option "AllowIndirectGLXProtocol" "off"

    Basically the script functions so that, If eGPU is detected, this file is copied to xorg.conf.d folder

    Section "ServerFlags"                    
            Option "DefaultServerLayout" "egpu"

More technical details

Some technical info to help debug

$ lspci -k | grep -EA3 'VGA|3D|Display'
00:02.0 VGA compatible controller: Intel Corporation TigerLake-H GT1 [UHD Graphics] (rev 01)
        DeviceName: Onboard - Video
        Subsystem: Gigabyte Technology Co., Ltd Device 78cc
        Kernel driver in use: i915
01:00.0 VGA compatible controller: NVIDIA Corporation GA104M [GeForce RTX 3070 Mobile / Max-Q] (rev a1)
        Subsystem: Gigabyte Technology Co., Ltd Device 78cc
        Kernel driver in use: nvidia
        Kernel modules: nouveau, nvidia_drm, nvidia
05:00.0 VGA compatible controller: NVIDIA Corporation GA102 [GeForce RTX 3080] (rev a1)
        Subsystem: Gigabyte Technology Co., Ltd Device 405d
        Kernel driver in use: nvidia
        Kernel modules: nouveau, nvidia_drm, nvidia
Fri Apr 15 13:32:12 2022       
| NVIDIA-SMI 510.60.02    Driver Version: 510.60.02    CUDA Version: 11.6     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   50C    P8    17W /  N/A |      6MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
|   1  NVIDIA GeForce ...  Off  | 00000000:05:00.0  On |                  N/A |
|  0%   50C    P5    42W / 320W |   1769MiB / 10240MiB |     35%      Default |
|                               |                      |                  N/A |
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|    0   N/A  N/A       813      G   /usr/lib/Xorg                       4MiB |
|    1   N/A  N/A       813      G   /usr/lib/Xorg                     831MiB |
|    1   N/A  N/A       947      G   /usr/bin/kwin_x11                 132MiB |
|    1   N/A  N/A      1022      G   /usr/bin/plasmashell               93MiB |
|    1   N/A  N/A      1562      G   ...e/Steam/ubuntu12_32/steam       45MiB |
|    1   N/A  N/A      1609      G   ...007348006062947779,131072      217MiB |
|    1   N/A  N/A      1700      G   ...ef_log.txt --shared-files      339MiB |
|    1   N/A  N/A      4298      G   /usr/lib/kf5/kioslave5              3MiB |
                     ./o.                  user@linuxtest3 
                   ./sssso-                ---------------------------- 
                 `:osssssss+-              OS: EndeavourOS Linux x86_64 
               `:+sssssssssso/.            Host: AORUS 17G XD 993AD 
             `-/ossssssssssssso/.          Kernel: 5.17.3-arch1-1 
           `-/+sssssssssssssssso+:`        Uptime: 37 mins 
         `-:/+sssssssssssssssssso+/.       Packages: 1133 (pacman) 
       `.://osssssssssssssssssssso++-      Shell: bash 5.1.16 
      .://+ssssssssssssssssssssssso++:     Resolution: 2560x1440, 1920x1080, 3440x1440 
    .:///ossssssssssssssssssssssssso++:    DE: Plasma 5.24.4 
  `:////ssssssssssssssssssssssssssso+++.   WM: KWin 
`-////+ssssssssssssssssssssssssssso++++-   Theme: [Plasma], Breeze [GTK2/3] 
 `..-+oosssssssssssssssssssssssso+++++/`   Icons: [Plasma], breeze-dark [GTK2/3] 
   ./++++++++++++++++++++++++++++++/:.     Terminal: konsole 
  `:::::::::::::::::::::::::------``       CPU: 11th Gen Intel i7-11800H (16) @ 4.600GHz 
                                           GPU: NVIDIA GeForce RTX 3080 
                                           GPU: NVIDIA GeForce RTX 3070 Mobile / Max-Q 
                                           GPU: Intel TigerLake-H GT1 [UHD Graphics] 
                                           Memory: 4743MiB / 31838MiB

Ask for help

If anybody can help me in finding the issue, it would be appreciated. While I’m not scared of linux & command line, I do not know a lot of stuff so try to approach me with that in mind (if you want me to to test or output something, it would be appreciated if you can include the command to use).

Before going to report bug in dxvk, maybe I’ve done something wrongly on my end? Maybe I’m missing some essential library or sth? The only Arch based linux I’ve used so far is Manjaro and I know that had the hapit of doing a lot of stuff for you.

Did you not install the Nvidia drivers? Looks like your Nvidia hardware is running on the nouveau open source drivers.

Post the output for

inxi -Ga

I did follow the tutorial here: so by running

sudo nvidia-installer-dkms
$ inxi -Ga
Use of uninitialized value in numeric eq (==) at /usr/bin/inxi line 15503.
Use of uninitialized value in numeric eq (==) at /usr/bin/inxi line 15511.
  Device-1: Intel TigerLake-H GT1 [UHD Graphics] vendor: Gigabyte
    driver: i915 v: kernel ports: active: none off: eDP-1
    empty: DP-1, DP-2, DP-3, DP-4, DP-5, HDMI-A-1 bus-ID: 00:02.0
    chip-ID: 8086:9a60 class-ID: 0300
  Device-2: NVIDIA GA104M [GeForce RTX 3070 Mobile / Max-Q]
    vendor: Gigabyte driver: nvidia v: 510.60.02 alternate: nouveau,nvidia_drm
    pcie: gen: 1 speed: 2.5 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s
    ports: active: none empty: DP-6,HDMI-A-2 bus-ID: 01:00.0
    chip-ID: 10de:249d class-ID: 0300
  Device-3: NVIDIA GA102 [GeForce RTX 3080] vendor: Gigabyte driver: nvidia
    v: 510.60.02 alternate: nouveau,nvidia_drm pcie: gen: 3 speed: 8 GT/s
    lanes: 4 link-max: gen: 4 speed: 16 GT/s lanes: 16 ports: active: none
    off: DP-8,DP-9,HDMI-A-4 empty: DP-7,HDMI-A-3 bus-ID: 05:00.0
    chip-ID: 10de:2206 class-ID: 0300
  Device-4: IMC Networks USB2.0 HD UVC WebCam type: USB driver: uvcvideo
    bus-ID: 3-9:4 chip-ID: 13d3:56a2 class-ID: 0e02 serial: 0x0001
  Display: x11 server: X.Org v: 21.1.3 compositor: kwin_x11 driver: X:
    loaded: modesetting,nvidia gpu: i915,nvidia,nvidia-nvswitch display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 7920x1440 s-dpi: 96 s-size: 2095x381mm (82.48x15.00")
    s-diag: 2129mm (83.83")
  Monitor-1: not-matched mapped: DP-2 pos: right res: 2560x1440 hz: 60
    dpi: 124 size: 526x296mm (20.71x11.65") diag: 604mm (23.76") modes: N/A
  Monitor-2: not-matched mapped: DP-4 pos: primary,center res: 3440x1440
    dpi: 109 size: 800x330mm (31.5x12.99") diag: 865mm (34.07") modes: N/A
  Monitor-3: not-matched mapped: HDMI-1 pos: primary,left res: 1920x1080
    hz: 60 dpi: 93 size: 527x296mm (20.75x11.65") diag: 604mm (23.8")
    modes: N/A
  Monitor-4: eDP-1 mapped: eDP-2-1 note: disabled pos: left
    model: Sharp LQ173M1JW04 built: 2020 res: 1920x1080 dpi: 128 gamma: 1.2
    size: 382x215mm (15.04x8.46") diag: 438mm (17.3") ratio: 16:9
    modes: 1920x1080
  OpenGL: renderer: NVIDIA GeForce RTX 3080/PCIe/SSE2
    v: 4.6.0 NVIDIA 510.60.02 direct render: Yes

Okay You do have Nvidia installed. I just wanted to check. The other output just shows the modules and nouveau is listed first so i assumed you were running on opensource driver. It’s all good!

1 Like

I’m not sure i can be of much help with this as I am not a gamer. Looks like you have the hardware working. Not sure if it is within the game platform that needs some changes or something other. Have you looked over these pages. Normally does it use the egpu? Or it switches to it when and how?


Edit2: I see a slightly different set up for egpu here maybe you check it over and compare the setup?

Intended setup is supposed to behave like this:

  • When eGPU is connected, I only use the monitors that are attached to the eGPU directly, laptops screen & ports are not in use.
  • When the eGPU is not connected, then of course I want the laptops NVidia card and ports working.

If I could, I would disable iGPU and dGPU completely when eGPU is connected, in windows it’s actually even needed otherwhise the performance is bad. This egpu switching script does actually attempt to do the same but every time I’ve tried it when it disable the iGPU and dGPU desktop does not load at all.

I’ve tried to use the optimus-manager allowexternalgpu value, while it does enable the egpu screens, clearly rendering is not happening on it because the desktop is laggy as hel (nvidia-smi also confirms it).

I did check the egpu documentation you linked to compare for any xorg configuration differences, but it doesn’t seem to change anything or by adding too much breaks something completely (eGPU monitors no longer got even correct resolutions anymore).

nvidia-smi does seem to indicate that with my scripts, if the eGPU is connected, everything I’ve tried to run so far and runs, do run on the eGPU.

1 Like

Update on the issue. Reached out to dxvk and with their help I managed to get dxvk games working:

Overall, it seems Vulkan driver selects the wrong GPU. With DXVK I can thankly specify the GPU by using this launch param:


Sadly according to them, this should be a issue with the vulkan-driver itself thus it would affect all Vulkan applications and most of them don’t allow to select the GPU so that’s an issue that will stay in the air. Might look into this in the future:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.