[2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
moxie
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Oct 15, 2025 12:44 pm
Contact:

[2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by moxie »

On linux when launching factorio on steam with wayland enabled it just crashes.
Error SDLWindow.cpp:141: SDL couldn't be initialized. SDL_Error: Failed to create XKB context

Code: Select all

   0.000 2025-10-15 15:50:02; Factorio 2.0.69 (build 84148, linux64, steam, space-age)
   0.000 Operating system: Linux
   0.000 Initializing Steam API.
   0.000 Program arguments: "/mnt/games/SteamLibrary/steamapps/common/Factorio/bin/x64/factorio" 
   0.000 Config path: /home/moxie/.factorio/config/config.ini
   0.000 Read data path: /mnt/games/SteamLibrary/steamapps/common/Factorio/data
   0.000 Write data path: /home/moxie/.factorio [151056/354288MB]
   0.000 Binaries path: /mnt/games/SteamLibrary/steamapps/common/Factorio/bin
   0.007 System info: [CPU: AMD Ryzen 9 3900X 12-Core Processor, 24 cores, RAM: 32007 MB]
   0.007 Environment: DISPLAY=:0 WAYLAND_DISPLAY=wayland-1 DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=sway XDG_CURRENT_DESKTOP=sway SDL_VIDEODRIVER=wayland,x11 __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.008 Display options: [FullScreen: false] [VSync: true] [UIScale: automatic (100.0%)] [Native DPI: true] [Screen: 0] [Special: lmw] [Lang: en]
Factorio crashed. Generating symbolized stacktrace, please wait ...
src/Util/StacktraceToStream.cpp (52): walkStackAndPrintToStream
src/Util/StacktraceToStream.cpp (60): printStacktraceToStream
src/Util/Logger.cpp (334): writeStacktrace
src/Util/Logger.cpp (379): logStacktrace
src/Util/Logging.cpp (59): logStackTrace
src/Util/Logging.cpp (107): logAndAbortOrThrow
src/Util/Logging.cpp (96): logAndAbortOrThrow
src/Graphics/SDLWindow.cpp (141): SDLWindow
src/Graphics/SDLWindow.cpp (109): SDLWindow
src/GlobalContext.cpp (971): loadGraphics
src/GlobalContext.cpp (444): init
src/MainLoop.cpp (288): run
src/Main.cpp (906): fmain
src/Main.cpp (928): main
0x7f6575c27674
__libc_start_main
_start
0xffffffffffffffff
Stack trace logging done
   2.932 Error SDLWindow.cpp:141: SDL couldn't be initialized. SDL_Error: Failed to create XKB context
   2.932 Error CrashHandler.cpp:643: Received 6
Logger::writeStacktrace skipped.
   2.932 Error Util.cpp:95: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.

Edit: after trying few things..

x11 seems to work fine, but I can't import long blueprint strings
standalone factorio client seems to work fine with wayland enabled, but I can't get steam achievements

forcing steam to use legacy runtime gives following
libEGL warning: egl: failed to create dri2 screen
and just seems to fallback to llvmpipe software rendering


when running again with steams default I also see this
xkbcommon: ERROR: failed to add default include path /usr/share/xkeyboard-config-2

so I assume it's because steam linux runtime 1.0 (sniper) still has old path /usr/share/X11/xkb

when running steams newer container runtimes with standalone client it to work fine, but I'm not sure if it connects to steam for achievements and other steam stuff, can't choose those from the steam client compatibility UI
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 768
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by raiguard »

What distro are you running?
Don't forget, you're here forever.
moxie
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Oct 15, 2025 12:44 pm
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by moxie »

Arch linux

I did try the sdl2 from AUR, but switched back to sdl2-compat which arch now days gives instead of sdl2 as the game seems to work fine when steam isn't involved.
Also did try with regular steam and steam-native, no difference there.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 768
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by raiguard »

Your system installation of SDL2 won't make a difference because Factorio statically links SDL.

You can try doing SDL_DYNAMIC_API=/usr/path/to/sdl2-compat.so bin/x64/factorio to force it to use your system installation and see if that makes a difference.
Don't forget, you're here forever.
moxie
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Oct 15, 2025 12:44 pm
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by moxie »

Does not seem to make any difference sadly.
With steam same crash, factorio standalone client still works.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 768
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by raiguard »

Unfortunately, I don't really know how else to help you. Steam must be doing something strange and I can't reproduce this.
Don't forget, you're here forever.
moxie
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Oct 15, 2025 12:44 pm
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by moxie »

Well, that did actually help, I started testing on other machines and couldn't reproduce either.

I don't know yet what's the issue but when I changed from sway to hyprland on same machine factorio has no issues when launched from steam..

Definately not factorio bug, sorry.
tls_
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Oct 16, 2025 3:57 pm
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by tls_ »

Same error happens for me on Void Linux using the river compositor.

I also tried SDL_DYNAMIC_API=/usr/lib/libSDL2.so ~/.local/share/Steam/steamapps/common/Factorio/bin/x64/factorio with no success.

Very much appreciated if anyone got any ideas... :cry:
factorio-current.log
(2.35 KiB) Downloaded 4 times
Last edited by tls_ on Thu Oct 16, 2025 4:30 pm, edited 2 times in total.
Zeik
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Oct 16, 2025 7:12 am
Contact:

Re: [2.0.69] Crash on Steam with wayland "SDL_Error: Failed to create XKB context"

Post by Zeik »

I have the same issue if preferred video driver is set to wayland, on Arch sway with libxkbcommon 1.12 from testing repository which was compiled with a new default directory from xkeyboard-config, seems like factorio wayland uses the host libxkbcommon but the steam pressurevessel doesn't have that path (/usr/share/xkeyboard-config-2) it looks for? Downgrading libxkbcommon to 1.11 fixes it, so does using SDL_VIDEODRIVER=X11 and changing the video driver config back to X11 in factorio graphics settings
Post Reply

Return to “Technical Help”