{"record":{"id":"34c82c2e0b8a7f9f","repo":"fyne-io/fyne","slug":"eglinitialize-failed-n","errorCode":null,"errorMessage":"eglInitialize failed\\n","messagePattern":"eglInitialize failed\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/driver/mobile/app/x11.c","lineNumber":111,"sourceCode":"EGLContext e_ctx;\nEGLSurface e_surf;\nWindow win;\n\nvoid\ncreateWindow(void) {\n\tx_dpy = XOpenDisplay(NULL);\n\tif (!x_dpy) {\n\t\tfprintf(stderr, \"XOpenDisplay failed\\n\");\n\t\texit(1);\n\t}\n\te_dpy = eglGetDisplay(x_dpy);\n\tif (!e_dpy) {\n\t\tfprintf(stderr, \"eglGetDisplay failed\\n\");\n\t\texit(1);\n\t}\n\tEGLint e_major, e_minor;\n\tif (!eglInitialize(e_dpy, &e_major, &e_minor)) {\n\t\tfprintf(stderr, \"eglInitialize failed\\n\");\n\t\texit(1);\n\t}\n\teglBindAPI(EGL_OPENGL_ES_API);\n\twin = new_window(x_dpy, e_dpy, 500, 1000, &e_ctx, &e_surf);\n\n\twm_delete_window = XInternAtom(x_dpy, \"WM_DELETE_WINDOW\", True);\n\tif (wm_delete_window != None) {\n\t\tXSetWMProtocols(x_dpy, win, &wm_delete_window, 1);\n\t}\n\n\tXMapWindow(x_dpy, win);\n\tif (!eglMakeCurrent(e_dpy, e_surf, e_surf, e_ctx)) {\n\t\tfprintf(stderr, \"eglMakeCurrent failed\\n\");\n\t\texit(1);\n\t}\n\n\t// Window size and DPI should be initialized before starting app.\n\tXEvent ev;","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/internal/driver/mobile/app/x11.c#L93-L129","documentation":"x11.c then calls eglInitialize on the EGL display. Failure means EGL was given a display but could not initialize it: driver mismatch (32/64-bit or vendor confusion), no usable GPU device for this user, or a broken Mesa install. The process prints 'eglInitialize failed' and exits(1).","triggerScenarios":"eglInitialize returning false: GPU device nodes (/dev/dri/*) unreadable for the running user, vendor ICD libraries in a bad state, or EGL picked up a display for a platform that has no backing device.","commonSituations":"Users not in the video/render groups (common in fresh Linux installs and WSL); containers without GPU device passthrough; systems after partial NVIDIA/Mesa upgrades; running as an unprivileged service user.","solutions":["Check GPU access: ls -l /dev/dri/ and add the user to the video and render groups, then re-login","Diagnose with EGL logging: EGL_LOG_LEVEL=debug LIBGL_DEBUG=verbose eglinfo","Fall back to software EGL: LIBGL_ALWAYS_SOFTWARE=1 ./yourapp","Reinstall/upgrade Mesa and vendor ICDs to clear the broken state"],"exampleFix":"# before: no permission on GPU nodes -> eglInitialize failed\n./yourapp\n\n# after: grant DRI access (re-login required) or use software EGL\nsudo usermod -aG video,render \"$USER\"\nLIBGL_ALWAYS_SOFTWARE=1 ./yourapp","handlingStrategy":"validation","validationCode":"func gpuAccessPreflight() error {\n\tentries, err := os.ReadDir(\"/dev/dri\")\n\tif err != nil || len(entries) == 0 {\n\t\treturn fmt.Errorf(\"no DRI devices; run with LIBGL_ALWAYS_SOFTWARE=1 or enable GPU access\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the runtime user is in the video and render groups","Run EGL_LOG_LEVEL=debug eglinfo when initialization fails to get the driver reason","Support LIBGL_ALWAYS_SOFTWARE=1 as a documented fallback in containers and CI"],"tags":["c","egl","permissions","mesa","driver","gpu"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}