{"record":{"id":"a1013cd64f990c60","repo":"SeleniumHQ/selenium","slug":"none-of-the-following-is-a-s-version-of-xlib","errorCode":null,"errorMessage":"None of the following is a %s version of Xlib:","messagePattern":"None of the following is a (.+?) version of Xlib:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cpp/linux-specific/x_ignore_nofocus.c","lineNumber":630,"sourceCode":"  int locations_len = sizeof(possible_locations) / sizeof(char*);\n\n  uint16_t required_lib_arch;\n  if (is_32bit_system() || is_emulated_32bit()) {\n    required_lib_arch = EM_386;\n  } else {\n    required_lib_arch = EM_X86_64;\n  }\n  int suitable_xlib_index = find_xlib_by_arch(possible_locations, locations_len, required_lib_arch);\n  int found_library = FALSE;\n  if (suitable_xlib_index >= 0) {\n    snprintf(library, MAX_LIBRARY_PATH, \"%s\", possible_locations[suitable_xlib_index]);\n    found_library = TRUE;\n  } else {\n    found_library = find_xlib_by_env(library, required_lib_arch);\n  }\n  if (found_library == FALSE) {\n    const char* desired_arch = (required_lib_arch == EM_386 ? \"32-bit\" : \"64-bit\");\n    fprintf(stderr, \"None of the following is a %s version of Xlib:\", desired_arch);\n    int i;\n    for (i = 0; i < locations_len; i++) {\n      fprintf(stderr, \" %s\\n\", possible_locations[i]);\n    }\n    return NULL;\n  }\n\n  ret_handle = dlopen(library, RTLD_LAZY);\n  if (ret_handle == NULL) {\n    fprintf(stderr, \"Failed to dlopen %s\\n\", library);\n    fprintf(stderr, \"dlerror says: %s\\n\", dlerror());\n  }\n\n  return ret_handle;\n}\n\nvoid print_event_to_log(Display* dpy, XEvent* ev)\n{","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/cpp/linux-specific/x_ignore_nofocus.c#L612-L648","documentation":"This is a stderr diagnostic, not a raised exception, emitted by get_xlib_handle() in Selenium's Linux native helper x_ignore_nofocus.so. After scanning the five hardcoded libX11.so.6 candidate paths and the LD_LIBRARY_PATH-derived paths (find_xlib_by_env) and ELF-checking each against the required machine type (EM_386 for 32-bit, EM_X86_64 for 64-bit, chosen via is_32bit_system()/is_emulated_32bit()), none matched. The function prints this line, then lists each candidate, then returns NULL, which disables the focus-stealing-prevention shim and degrades native-event focus handling. It is the root-cause line; the per-path ' %s\\n' lines that follow are its continuation.","triggerScenarios":"get_xlib_handle() runs at JVM/native-helper load time on Linux: required_lib_arch resolves to EM_X86_64 (or EM_386) and find_xlib_by_arch returns -1 for every entry in possible_locations, AND find_xlib_by_env also returns FALSE (no usable LD_LIBRARY_PATH entry of the right arch). Concretely: 64-bit JVM/browser on a host whose libX11.so.6 is only the 32-bit Debian/Ubuntu variant, or vice-versa, or a host where none of the five paths exist at all.","commonSituations":"Minimal Docker/headless containers that omit libX11 or ship only one architecture; mixed 32/64-bit setups running a 32-bit browser on a 64-bit host without the i386 multilib packages; custom distros whose libX11 lives outside the five scanned locations and LD_LIBRARY_PATH is unset; systems where libX11 was removed during image slimming.","solutions":["Install the architecture-matching libX11: on Debian/Ubuntu 64-bit run `apt-get install -y libx11-6`; for 32-bit on a 64-bit host add `:i386` (`dpkg --add-architecture i386 && apt-get install -y libx11-6:i386`).","If libX11 is installed in a non-scanned path, export `LD_LIBRARY_PATH` pointing at the directory containing the correct-arch libX11.so.6 before launching the JVM/browser, so find_xlib_by_env succeeds.","Align architectures: run a 64-bit browser with a 64-bit JVM (and libX11), or a 32-bit browser with 32-bit libX11; mixing is the most common trigger.","Verify with `file $(ldconfig -p | grep libX11.so.6 | awk '{print $NF}' | head -1)` that the ELF machine type matches the required arch; if not, install the matching package."],"exampleFix":"# before (64-bit JVM, container with only 32-bit libX11)\njava -jar selenium-server.jar   # get_xlib_handle prints 'None of the following is a 64-bit version of Xlib:'\n\n# after\napt-get update && apt-get install -y libx11-6\njava -jar selenium-server.jar   # find_xlib_by_arch matches /usr/lib/x86_64-linux-gnu/libX11.so.6","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# Run before launching the JVM/Selenium Server on Linux.\nREQUIRED_ARCH=\"64-bit\"   # set to 32-bit for a 32-bit browser/JVM\n\ncandidates=(\n  /usr/lib/libX11.so.6\n  /usr/lib/x86_64-linux-gnu/libX11.so.6\n  /usr/lib/i386-linux-gnu/libX11.so.6\n  /usr/lib64/libX11.so.6\n  /usr/lib32/libX11.so.6\n)\n\nmatch=0\nfor lib in \"${candidates[@]}\"; do\n  [ -f \"$lib\" ] || continue\n  arch=$(file -L \"$lib\" | grep -o 'ELF 32-bit\\|ELF 64-bit')\n  if [ \"${arch#ELF }\" = \"$REQUIRED_ARCH\" ]; then\n    echo \"OK: $lib ($arch)\"; match=1; break\n  fi\n  echo \"SKIP: $lib ($arch)\"\ndone\n\nif [ \"$match\" -eq 0 ] && [ -n \"$LD_LIBRARY_PATH\" ]; then\n  for d in \"${LD_LIBRARY_PATH//:/ }\"; do\n    lib=\"$d/libX11.so.6\"; [ -f \"$lib\" ] || continue\n    arch=$(file -L \"$lib\" | grep -o 'ELF 32-bit\\|ELF 64-bit')\n    [ \"${arch#ELF }\" = \"$REQUIRED_ARCH\" ] && { echo \"OK(env): $lib\"; match=1; break; }\n  done\nfi\n\n[ \"$match\" -eq 1 ] || { echo \"FAIL: no $REQUIRED_ARCH libX11 found\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake `apt-get install -y libx11-6` (and :i386 for 32-bit browsers) into your Dockerfile so the arch match is guaranteed at build time.","Keep JVM, browser, and libX11 on the same architecture; do not run a 32-bit browser on a 64-bit JVM without multilib packages.","If libX11 lives outside the five scanned paths, set LD_LIBRARY_PATH in the same script that launches the JVM.","Add the validation script above as a CI preflight gate so arch-mismatch failures surface before the Selenium suite runs."],"tags":["linux","native","x11","libx11","selenium","environment","elf-arch"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}