Skip to content

"failed to create EGL context" in Arch ARM on UTM #176

Open

Description

@mikew
$ ./Ghostty-1.4.0-aarch64.AppImage 
info: ghostty version=1.4.0
info: ghostty build optimize=fast
info: runtime=.gtk
info: font_backend=.fontconfig_freetype
info: dependency harfbuzz=11.0.0
info: dependency fontconfig=21803
info: renderer=renderer.generic.Renderer(renderer.OpenGL)
info: libxev default backend=io_uring
info(os_locale): setlocale from env result=en_US.UTF-8
info(gtk): GTK version build=4.24.1 runtime=4.24.1
info(gtk): libadwaita version build=1.10.0 runtime=1.10.0
info: reading configuration file path=/home/mike/.config/ghostty/config.ghostty
info(config): default shell src=passwd value=/usr/bin/bash
info(config): default working directory src=passwd value=/home/mike
warning(gtk_ghostty_application): setting GDK_DEBUG=
warning(gtk_ghostty_application): setting GDK_DISABLE=vulkan
info(gtk_ghostty_surface): surface content scale: x=1 y=1 dpi=96x96 font_size=12
info(opengl): EGL vendor=Mesa Project
info(opengl): EGL extensions=EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_present_opaque EGL_EXT_surface_compression EGL_EXT_swap_buffers_with_damage EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_KHR_swap_buffers_with_damage EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display EGL_WL_create_wayland_buffer_from_image 
warning(opengl): failed to create EGL context err=error.BadMatch
warning(gtk_ghostty_surface): failed to initialize surface err=error.BadMatch
warning(gtk_ghostty_surface): surface failed to initialize err=error.SurfaceError

From looking at similar issues, everything else RE opengl / gtk4+opengl work:

kitty:

image

alacritty:

image

gtk4-demo-aarch64.appimage:

image

Ghostty-1.4.0-aarch64.AppImage-debug.log

Activity

  1. mikew commented on Nov 11, 2026

    @mikew
    Author

    I am able to get ghostty running by downloading a deb, installing its dependencies, and running with LIBGL_ALWAYS_SOFTWARE=1:

    sudo pacman -S oniguruma gtk4-layer-shell libadwaita
    LIBGL_ALWAYS_SOFTWARE=1 ~/Downloads/ghostty_1.4.0-0.ppa2_arm64_26.10/usr/bin/ghostty
    image

    The same environment variable does not work with the .appimage from this repository.

  2. Samueru-sama commented on Nov 11, 2026

    @Samueru-sama
    Member

    something odd is that libanl.so.1 is missing from the appimage, even though it should have been added automatically..

    That alone is unlikely to be causing this issue though.

    Ghostty-1.4.0-aarch64.AppImage-debug.log

    The debug log shows this:

    MESA-EGL: debug: using driver virtio_gpu for 10

    Are we sure virgl works here? That driver is notoriously buggy and Mesa wanted to remove it a while back.

    I am able to get ghostty running by downloading a deb, installing its dependencies, and running with LIBGL_ALWAYS_SOFTWARE=1:
    The same environment variable does not work with the .appimage from this repository.

    That's normal, because the appimage ships its own version of Mesa, and this version has llvmpipe disabled.

    It still has softpipe for these cases when the system gpu doesn't work, but softpipe only offers OpenGL 3.3 iirc which is not enough for ghostty.

    Would be good to figure out why you need to set LIBGL_ALWAYS_SOFTWARE=1 in first place.

  3. mikew commented on Nov 11, 2026

    @mikew
    Author

    FWIW I do get the same GL errors when trying to run the .deb version without LIBGL_ALWAYS_SOFTWARE=1.

    And from what I can tell, virgl works? Admittedly I don't know how to actually verify that:

    $ glxinfo | grep "direct rendering"
    direct rendering: Yes
    
    $ glxinfo | grep -E "OpenGL renderer|OpenGL vendor"
    OpenGL vendor string: Mesa
    OpenGL renderer string: virgl (Apple M1 Pro)
    
    $ glxinfo -B
    name of display: :0
    display: :0  screen: 0
    direct rendering: Yes
    Extended renderer info (GLX_MESA_query_renderer):
        Vendor: Mesa (0x1af4)
        Device: virgl (Apple M1 Pro) (0x1010)
        Version: 26.2.6
        Accelerated: yes
        Video memory: 0MB
        Unified memory: no
        Preferred profile: core (0x1)
        Max core profile version: 4.1
        Max compat profile version: 4.1
        Max GLES1 profile version: 1.1
        Max GLES[23] profile version: 3.0
    OpenGL vendor string: Mesa
    OpenGL renderer string: virgl (Apple M1 Pro)
    OpenGL core profile version string: 4.1 (Core Profile) Mesa 26.2.6-arch1.1
    OpenGL core profile shading language version string: 4.10
    OpenGL core profile context flags: (none)
    OpenGL core profile profile mask: core profile
    
    OpenGL version string: 4.1 (Compatibility Profile) Mesa 26.2.6-arch1.1
    OpenGL shading language version string: 4.10
    OpenGL context flags: (none)
    OpenGL profile mask: compatibility profile
    
    OpenGL ES profile version string: OpenGL ES 3.0 Mesa 26.2.6-arch1.1
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

    UTM has a few different renderer backends I can try.

  4. Samueru-sama commented on Nov 11, 2026

    @Samueru-sama
    Member

    If you have lavapipe installed you might be able to get this to run by forcing zink as the opengl driver.

    SHARUN_ALLOW_SYS_VKICD=1 MESA_LOADER_DRIVER_OVERRIDE=zink

    Anyways, gonna ask a bot to debug this now

  5. Samueru-sama commented on Nov 11, 2026

    @Samueru-sama
    Member

    Note

    This is an automated response generated by DeepSeek V4.1 Flash (AI), at a maintainer's request. It is based on the published AppImage contents, CI logs, and the upstream source/commits linked below. Please excuse any inaccuracies.

    libanl.so.1

    libanl.so.1 was added to quick-sharun two days after the v1.4.0 AppImage was built, so this release simply predates it:

    • v1.4.0 was published on 2026-10-28; its assets were built by run 40748137812. That build downloaded quick-sharun (176435 bytes, sha256 5360ef24…), which corresponds to commit 5216c9b2 from 2026-10-28. Its glibc deployment list has libpthread, libdl, librt, libm, libutil and libresolv, but not libanl.
    • libanl was added on 2026-10-30 in commit bec22efd769b ("always include libanl.so when deploying glibc", PR #1002), in response to issue #1001.
    • ghostty-appimage downloads quick-sharun from main at build time, so every build after that date includes it. The current tip nightly has libanl.so.1 plus the libanl.so symlink. v1.4.0 is immutable, so the next stable release will be the first one to carry it.

    This is not the cause of the failure. The debug log shows cross-libc-dlopen found the host copy and loaded it successfully:

    [cross-libc-dlopen.so] >> dlopen pass-through: libanl.so.1
    ...
    calling init: /usr/lib/libanl.so.1
    [cross-libc-dlopen.so] >> global-scope lib libanl.so.1: loaded
    

    The EGL failure is a GL 4.3 vs 4.1 mismatch

    virgl is working — it just can't provide the OpenGL version Ghostty needs.

    • The debug log shows MESA-EGL: debug: using driver virtio_gpu for 10, and immediately before Ghostty's failure:

      MESA-EGL: debug: EGL user error 0x3009 (EGL_BAD_MATCH) in eglCreateContext: dri2_create_context
      warning(opengl): failed to create EGL context err=error.BadMatch
      
    • The glxinfo output above confirms virgl exposes OpenGL 4.1 core max (Max core profile version: 4.1). That is expected on macOS: Apple's OpenGL implementation tops out at 4.1, and UTM's virglrenderer can only expose what the host driver provides.

    • Ghostty hard-requires OpenGL 4.3 core and asks for it at context creation: src/renderer/OpenGL.zig#L38-L40 (MIN_VERSION_MAJOR = 4, MIN_VERSION_MINOR = 3) and #L65-L69 (EGL_CONTEXT_MAJOR_VERSION = 4, EGL_CONTEXT_MINOR_VERSION = 3, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT).

    • Asking a 4.1 driver for a 4.3 core context returns EGL_BAD_MATCH from dri2_create_context, which is exactly what the log shows. This also explains why kitty, alacritty and gtk4-demo work: they only need OpenGL 3.3 (or lower), safely below virgl's 4.1 ceiling.

    softpipe vs llvmpipe

    LIBGL_ALWAYS_SOFTWARE=1 only says "use Mesa's software path"; it does not choose which software driver. Mesa has two CPU backends behind swrast:

    • llvmpipe — LLVM JIT, multithreaded, reports OpenGL 4.6 with Mesa 26.2.x. Fast, but requires LLVM/libLLVM, which is large.
    • softpipe — scalar reference rasterizer, no LLVM, reports OpenGL 3.3. Much slower.

    The host Arch Mesa used by the .deb ships both, so LIBGL_ALWAYS_SOFTWARE=1 selects llvmpipe (GL 4.6) and Ghostty gets its 4.3 context, so it works.

    The AppImage's Mesa is debloated and ships without llvmpipe (to avoid pulling in LLVM), leaving only softpipe:

    • The bundled libgallium-26.2.6-arch1.1.so contains the strings softpipe, swrast and virgl — but not llvmpipe; the host's same-version libgallium contains all four.
    • I verified this with a small EGL test program against the bundled libraries:
    Mesa LIBGL_ALWAYS_SOFTWARE=1 Request 4.3 core
    AppImage (softpipe only) softpipe 3.3 EGL_BAD_MATCH
    host Arch (llvmpipe) llvmpipe 4.6 OK (4.6)

    So LIBGL_ALWAYS_SOFTWARE=1 fails for the AppImage because the only software driver in the bundle tops out at 3.3, still below Ghostty's 4.3 minimum — the same EGL_BAD_MATCH.

    Conclusion

    This is a host/VM capability limitation, not an AppImage packaging problem: with UTM's virgl on macOS the GPU path is capped at GL 4.1, and the bundled Mesa's software fallback is softpipe (GL 3.3). Ghostty needs 4.3 either way.

    Practical options:

    • Keep using the distro build with host Mesa + LIBGL_ALWAYS_SOFTWARE=1 (llvmpipe).
    • Include llvmpipe in the AppImage's Mesa (accepting the LLVM size cost).
    • Build with USE_HOST_DRIVERS=1 so runtime uses the host Mesa; then LIBGL_ALWAYS_SOFTWARE=1 would reach the host llvmpipe (with the usual USE_HOST_DRIVERS caveats).

    The libanl omission will disappear automatically in the next stable build.

  6. Samueru-sama commented on Nov 11, 2026

    @Samueru-sama
    Member

    Build with USE_HOST_DRIVERS=1 so runtime uses the host Mesa; then LIBGL_ALWAYS_SOFTWARE=1 would reach the host llvmpipe (with the usual USE_HOST_DRIVERS caveats).

    That's a big no here btw, we only use this for apps that have fallback software renderers, ghostty doesn't.

  7. andrelnfernandes commented on Nov 21, 2026

    @andrelnfernandes

    I hit the same failed to create EGL context err=error.BadMatch with the x86_64 1.4.0 AppImage. My setup is different but the root cause looks the same. I found a workaround that doesn't need a rebuild, in case it helps others or is worth documenting.

    Setup: Debian 13 on a VM without GPU access (my user can't open /dev/dri/renderD128), so software rendering is the only option.

    Cause: Ghostty 1.4 creates its own EGL context on the surfaceless platform and asks for GL 4.3 core. With no usable render node, the bundled Mesa (libgallium-26.2.5) falls back to softpipe, because this build has no llvmpipe (strings finds no llvmpipe in libgallium, and the bundle has no libLLVM). softpipe only goes up to GL 3.3 core (checked with GALLIUM_DRIVER=softpipe glxinfo -B on the host Mesa), so creating the context fails with EGL_BAD_MATCH. The host's Mesa 25.0.7 does have llvmpipe (GL 4.5 core), but the AppImage never uses it.

    SHARUN_ALLOW_SYS_VKICD=1 MESA_LOADER_DRIVER_OVERRIDE=zink didn't help here. lavapipe is installed, but LD_DEBUG=files showed no libvulkan or lavapipe being loaded at all, and the error was still BadMatch.

    Workaround: SHARUN_MESA_PATH (the bundled Anylinux-sharun 3.8.0 supports it). I pointed it at a directory of symlinks to the host Mesa, built the same way as the _use_host_mesa hook in quick-sharun.sh, with one change: leave out the host libwayland-*. With Debian's libwayland 1.23.1 exposed, the bundled GTK 4.24.1 exits at startup:

    bin/ghostty: symbol lookup error: lib/libgtk-4.so.1: undefined symbol: wl_fixes_interface
    

    The host Mesa works fine with the bundled (newer) libwayland. Without those libs I get:

    info(opengl): loaded OpenGL 4.5
    warning(opengl): failed to export DMABUF, falling back to CPU presentation
    

    and Ghostty works normally (llvmpipe plus CPU presentation). The DMABUF warning is logged on every frame (about 1.4/s while idle), so I set GHOSTTY_LOG=no-stderr when launching from the desktop.

    Script to build the directory (same list as _use_host_mesa, minus libwayland-*):

    #!/bin/sh
    set -e
    DEST=${1:-$HOME/.local/opt/ghostty/host-mesa}
    LIB=/usr/lib/x86_64-linux-gnu
    mkdir -p "$DEST/lib" "$DEST/share"
    for i in gbm dri 'libdrm_*.so*' 'libEGL_mesa.so*' 'libEGL.so*' 'libgallium*.so*' \
             'libgbm.so*' 'libglapi.so*' 'libGLdispatch.so*' 'libGLESv2.so*' 'libGL.so*' \
             'libGLX_indirect.so*' 'libGLX_mesa.so*' 'libGLX.so*' 'libva-drm.so*' 'libva.so*' \
             'libva-wayland.so*' 'libva-x11.so*' 'libvulkan*gfxstream.so*' 'libX11.so*' \
             'libX11-xcb.so*' 'libXau.so*' 'libxcb-dri2.so*' 'libxcb-dri3.so*' 'libxcb-glx.so*' \
             'libxcb-present.so*' 'libxcb-randr.so*' 'libxcb-shm.so*' 'libxcb.so*' \
             'libxcb-sync.so*' 'libxcb-xfixes.so*' 'libXdamage.so*' 'libXdmcp.so*' \
             'libXext.so*' 'libXfixes.so*'; do
        for l in $LIB/$i; do [ -e "$l" ] && ln -sfn "$l" "$DEST/lib/"; done
    done
    for d in drirc.d glvnd libdrm vulkan X11; do
        [ -d "/usr/share/$d" ] && ln -sfn "/usr/share/$d" "$DEST/share/"
    done

    Then:

    SHARUN_MESA_PATH=$HOME/.local/opt/ghostty/host-mesa ./Ghostty-1.4.0-x86_64.AppImage

    The symlinks point to versioned files (libgallium-<version>.so), so the directory has to be rebuilt after a host Mesa upgrade.

    Two things that may be worth a look:

    1. The libwayland-* entries in _use_host_mesa (quick-sharun.sh) can break apps whose bundled libraries need newer libwayland symbols than the host has. Here GTK 4.24.1 needs wl_fixes_interface, which Debian 13's 1.23.1 doesn't provide.
    2. A short note in TROUBLESHOOTING.md for people with no usable GPU (VMs, remote desktops), since llvmpipe isn't bundled and the fallback renderer can't run Ghostty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions