nvidia-exec
nvidia-exec copied to clipboard
Factorio (from Steam) won't start: Failed to create OpenGL context
Using nvx start %command%
as command on Steam. It used to work with prime-run %command%
.
Log from Factorio:
0.000 2022-10-24 12:00:46; Factorio 1.1.69 (build 60061, linux64, steam)
0.150 Operating system: Linux (Arch rolling)
0.150 Program arguments: "/data/SteamLib/steamapps/common/Factorio/bin/x64/factorio"
0.150 Read data path: /data/SteamLib/steamapps/common/Factorio/data
0.150 Write data path: /home/norbert/.factorio [51149/191314MB]
0.150 Binaries path: /data/SteamLib/steamapps/common/Factorio/bin
0.158 System info: [CPU: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz, 4 cores, RAM: 15885 MB]
0.158 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=plasma XDG_SESSION_DESKTOP=KDE XDG_CURRENT_DESKTOP=KDE __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
0.158 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
0.474 Available displays: 1
0.474 [0]: 0 - {[0,0], 1920x1080, SDL_PIXELFORMAT_RGB888, 120Hz}
0.554 Error Util.cpp:83: Failed to create OpenGL context: Could not create GL context: GLXBadFBConfig
More info:
System: Arch Linux, kernel 6.0.1-arch2-1
Nvidia drivers nvidia 520.56.06-3
I think it fails to get permissions, dmesg:
[ 1007.910891] audit: type=1100 audit(1666606006.942:173): pid=2856 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1010.794927] audit: type=1100 audit(1666606009.825:174): pid=2860 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1012.801137] audit: type=1100 audit(1666606011.832:175): pid=2862 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1014.414397] audit: type=1100 audit(1666606013.445:176): pid=2863 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1016.630823] audit: type=1100 audit(1666606015.662:177): pid=2864 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1022.657666] audit: type=1100 audit(1666606021.688:178): pid=2893 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1024.981403] audit: type=1100 audit(1666606024.012:179): pid=2894 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1027.044815] audit: type=1100 audit(1666606026.075:180): pid=2895 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
[ 1029.050879] audit: type=1100 audit(1666606028.082:181): pid=2896 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=? acct="norbert" exe="/usr/bin/sudo" hostname=? addr=? terminal=? res=failed'
I'm working on a fix but using kdesu
is painful. It asks for password for every command. Currently thinking to run terminal with nvx for sudo to ask password. Any other ideas?
I'm working on a fix but using
kdesu
is painful. It asks for password for every command. Currently thinking to run terminal with nvx for sudo to ask password. Any other ideas?
I am using gamemoderun
to apply the appropriate env vars, konsole -e nvx on
just before any game launch, and konsole -e nvx off
afterwards.
My exact configuration:
/etc/
environment
GAMEMODERUNEXEC=env __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia
gamemode.ini
[custom]
; Custom scripts (executed using the shell) when gamemode starts and ends
start=notify-send "GameMode started"
konsole -e nvx on
end=notify-send "GameMode ended"
konsole -e nvx off-kill
; Timeout for scripts (seconds). Scripts will be killed if they do not complete within this time.
;script_timeout=10
I also use the plasma-gamemode widget (available on the aur) to track the processes using the gpu. ~~There's been only one case where I needed to manually stop the running game process after closing so far. Using gamemode and that widget can help end users with locating the specific process on the gpu. A more robust on/off would be nice, but this has worked for me. Maybe I should try nvx off-kill
instead.~~ nvx off-kill
makes sure the processes on the GPU stop too. nvx, these two configuration files, and setting each game to start with gamemoderun has saved my laptop.
Maybe you could try starting steam itself using nvx
. The command requires you to type your password in order to turn on/off the GPU. I don't have an Nvidia GPU anymore. Hence, I can't provide much help.
Maybe you could try starting steam itself using
nvx
. The command requires you to type your password in order to turn on/off the GPU. I don't have an Nvidia GPU anymore. Hence, I can't provide much help.
I don't want to keep steam on the GPU all the time, change how steam starts, or add a wrapper to steam. If I decide to turn off the GPU in BIOS for any reason, I'd rather not encounter issues with Steam at login. Steam is fine as-is. I still haven't tried nvx off-kill
so that will probably be enough to stop the processes for me 100% of the time I stop a game.
I have already added gamemoderun %command%
to each game in Steam and being prompted by a new terminal window each time I start and stop a game is a small price to pay for starting my GPU only when I want it. Many games require a login to play too; this is just an authentication step I actually want rather than a remote login being forced upon me.
My setup leverages multiple tools purely out of convenience and lack of interest in trying to implement my own system service. NVIDIA not providing a convenient service for managing their hybrid devices on Linux is their fault; they can ship 5 system services, but not the one users actually want/need? :thinking: I am still interested in your nvx daemon implementation, if that ever happens.