Skip to content

[HELP (Not Launching/ Crashing)] NVIDIA/RTX 4090: X_GLXCreateContext BadValue on launch; workaround with DXVK + NVIDIA Vulkan + WebView2 GPU disabled #350

Description

@alinossier

Checklist

  • I have given details of my install including Distribution, Wayland/ XOrg, Parameters Used, echo $XAUTHORITY, etc.
  • I have provided logs showing any errors, if available (use VERBOSITY=3 ZWIFT_FG=1 zwift)
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of previous issue.

Describe the issue

Summary

Zwift recently stopped launching for me in netbrain/zwift:latest on Ubuntu/X11 with an NVIDIA RTX 4090. The initial failure was:

X Error of failed request: BadValue (integer parameter out of range for operation)
  Major opcode of failed request: 152 (GLX)
  Minor opcode of failed request: 3 (X_GLXCreateContext)

After debugging, the working workaround was:

  1. Use NVIDIA runtime / NVIDIA Vulkan, not WineD3D/OpenGL.
  2. Install DXVK into the Wine prefix.
  3. Make sure the non-root user inside the container can access /dev/nvidia*.
  4. Disable WebView2 GPU acceleration.
  5. Start ZwiftApp.exe via runfromprocess-rs after ZwiftLauncher.exe is alive.

Workaround

Install DXVK into the Wine prefix:

cd /tmp
wget https://github.com/doitsujin/dxvk/releases/download/v2.6.2/dxvk-2.6.2.tar.gz
tar -xzf dxvk-2.6.2.tar.gz

cp -v /tmp/dxvk-2.6.2/x64/d3d9.dll  /home/user/.wine/drive_c/windows/system32/d3d9.dll
cp -v /tmp/dxvk-2.6.2/x64/dxgi.dll  /home/user/.wine/drive_c/windows/system32/dxgi.dll
cp -v /tmp/dxvk-2.6.2/x64/d3d11.dll /home/user/.wine/drive_c/windows/system32/d3d11.dll
cp -v /tmp/dxvk-2.6.2/x64/d3d10core.dll /home/user/.wine/drive_c/windows/system32/d3d10core.dll

Run with these environment variables:

NVIDIA_VISIBLE_DEVICES=all
NVIDIA_DRIVER_CAPABILITIES=all
VK_ICD_FILENAMES=/etc/vulkan/icd.d/nvidia_icd.json
DXVK_FILTER_DEVICE_NAME="NVIDIA GeForce RTX 4090"
__GLX_VENDOR_LIBRARY_NAME=nvidia
XLIB_SKIP_ARGB_VISUALS=1
WINEDLLOVERRIDES="dxgi,d3d11,d3d10core,d3d9=n,b"
WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS="--disable-gpu --disable-gpu-compositing --disable-accelerated-2d-canvas --disable-accelerated-video-decode --disable-features=Vulkan,DefaultANGLEVulkan,VulkanFromANGLE,UseOzonePlatform --use-gl=swiftshader --no-sandbox"

Also ensure the container user has access to /dev/nvidia*. For debugging I used:

chmod a+rw /dev/nvidia* /dev/nvidia-caps/* 2>/dev/null || true

After that, DXVK correctly reported:

DXVK: v2.6.2
NVIDIA GeForce RTX 4090
Driver: NVIDIA 580.142.0

Then I could start the app with:

wine start ZwiftLauncher.exe SilentLaunch

LAUNCHER_PID_HEX=$(winedbg --command 'info proc' | awk '/ZwiftLauncher.exe/ {print $1; exit}')
LAUNCHER_PID=$((16#$LAUNCHER_PID_HEX))

wine start /exec /bin/runfromprocess-rs.exe "$LAUNCHER_PID" ZwiftApp.exe

Zwift Logs

alinossier@squid:~/zwift-fixed$ VERBOSITY=3 ZWIFT_FG=1 zwift
[!] Easily Zwift on linux!
[!] https://github.com/netbrain/zwift
[18:13:18|*] Preparing to launch Zwift
[18:13:18|*] Looking for config file /home/alinossier/.config/zwift/config
[18:13:18|✓] Loaded /home/alinossier/.config/zwift/config
[18:13:18|*] Looking for config file /home/alinossier/.config/zwift/alinossier-config
[18:13:18|*] Looking for container tool
[18:13:18|✓] Found container tool: docker
[18:13:18|◉] Script was invoked with the following parameters:
[18:13:18|◉]   • declare -r DEBUG="0"
[18:13:18|◉]   • declare -rx VERBOSITY="3"
[18:13:18|◉]   • declare -r CONTAINER_TOOL="docker"
[18:13:18|◉]   • declare -r IMAGE="docker.io/netbrain/zwift"
[18:13:18|◉]   • declare -r VERSION="latest"
[18:13:18|◉]   • declare -r SCRIPT_VERSION="master"
[18:13:18|◉]   • declare -r DONT_CHECK="0"
[18:13:18|◉]   • declare -r DONT_PULL="0"
[18:13:18|◉]   • declare -r DONT_CLEAN="0"
[18:13:18|◉]   • declare -r DRYRUN="0"
[18:13:18|◉]   • declare -r INTERACTIVE="0"
[18:13:18|◉]   • declare -ar CONTAINER_EXTRA_ARGS=([0]="--runtime=nvidia" [1]="--env" [2]="NVIDIA_DRIVER_CAPABILITIES=all" [3]="--env" [4]="NVIDIA_VISIBLE_DEVICES=all" [5]="--env" [6]="__GLX_VENDOR_LIBRARY_NAME=nvidia" [7]="--env" [8]="XAUTHORITY=/tmp/.docker.xauth" [9]="--env" [10]="XDG_RUNTIME_DIR=/run/user/1000" [11]="--volume" [12]="/home/alinossier/.Xauthority:/tmp/.docker.xauth:ro" [13]="--volume" [14]="/run/user/1000:/run/user/1000")
[18:13:18|◉]   • declare -r ZWIFT_USERNAME="💜💜💜💜💜💜"
[18:13:18|◉]   • declare -r ZWIFT_PASSWORD="💜💜💜💜💜💜"
[18:13:18|◉]   • declare -r ZWIFT_WORKOUT_DIR=""
[18:13:18|◉]   • declare -r ZWIFT_ACTIVITY_DIR=""
[18:13:18|◉]   • declare -r ZWIFT_LOG_DIR=""
[18:13:18|◉]   • declare -r ZWIFT_SCREENSHOTS_DIR=""
[18:13:18|◉]   • declare -r ZWIFT_OVERRIDE_GRAPHICS="0"
[18:13:18|◉]   • declare -r ZWIFT_OVERRIDE_RESOLUTION=""
[18:13:18|◉]   • declare -rx ZWIFT_FG="1"
[18:13:18|◉]   • declare -r ZWIFT_NO_GAMEMODE="0"
[18:13:18|◉]   • declare -r WINE_EXPERIMENTAL_WAYLAND="0"
[18:13:18|◉]   • declare -r NETWORKING="bridge"
[18:13:18|◉]   • declare -r ZWIFT_UID="1000"
[18:13:18|◉]   • declare -r ZWIFT_GID="1000"
[18:13:18|◉]   • declare -r VGA_DEVICE_FLAG=""
[18:13:18|◉]   • declare -r PRIVILEGED_CONTAINER="0"
[18:13:18|◉]   • declare -rx DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
[18:13:18|◉]   • declare -rx DISPLAY=":0"
[18:13:18|◉]   • declare -r WAYLAND_DISPLAY=""
[18:13:18|◉]   • declare -rx XAUTHORITY="/home/alinossier/.Xauthority"
[18:13:18|◉]   • declare -rx XDG_RUNTIME_DIR="/run/user/1000"
[18:13:18|*] Checking for updated zwift.sh
[18:13:18|✓] You are running the latest zwift.sh 👏
[18:13:18|*] Checking for updated container image
latest: Pulling from netbrain/zwift
Digest: sha256:5bfcaae82e4dd70b5284a5a0b9c7d340e24b642f08672dbe75a2be9932a3c1de
Status: Image is up to date for netbrain/zwift:latest
docker.io/netbrain/zwift:latest
[18:13:19|✓] Container image is up to date
[18:13:19|*] Cleaning up previous container images
Untagged: netbrain/zwift:1.104.3
Untagged: netbrain/zwift@sha256:5e7a26d7efc6ae081a3f9b3e2818af2f8283f0a4f3f262fec3550324a170b1bc
Deleted: sha256:5d8709196d4849d913f9ee23a7069532dee8bc979c1c86b66633027b957dbea8
Deleted: sha256:6bdef86eed48efac7a9c6102b74563fdcbb2bc396c179cb03632c1e854f5ed40
Untagged: netbrain/zwift:1.103.0
Untagged: netbrain/zwift@sha256:3aa8a7f2df684f5a5729a39b8d1c2556f7041fce659a72054549d6d387130d82
Deleted: sha256:15919e0df76046091643dd0ddda472cb749d7fb0cb2dc4e13dabeb9223787a3c
Deleted: sha256:291ea30d5938c5c91a1e6577f0407756351c02bec419b0b5dafb33c4b89ee318
Untagged: netbrain/zwift:1.102.0
Untagged: netbrain/zwift@sha256:bed27d1c78cb11fcad06e9f9884232ad4e6a8ff04005b56dd689eac33fc8baf4
Deleted: sha256:fd9411d63aa8ad6951889d931241d5ef45d680034dd7ab834bd598144e1b6946
Deleted: sha256:cce045dce0ca5d5a0ab914268a602ed8d6475a58e8652d85d5e7867b61caec5d
Untagged: netbrain/zwift:1.101.0
Untagged: netbrain/zwift@sha256:8c7cedd2b1abd62aba32f9fe51e63614c0a8ca9ae5b97b140edd454e7d103075
Deleted: sha256:48fa3d3ae334f04389cd726fa6c4d9a570ed822486490cb1a54bb3e726fe2082
Deleted: sha256:e6d8365b3398672b78264008e44b36c4c9cd2ce36bb941bff44061e32ca46eb7
Deleted: sha256:4bbdf22f05fdb8ffd6ed99222d9e14c331950ee1e72938f4f01c2f9eeb460b24
Deleted: sha256:bc93c98c798612a79322ccb5646167971a75ce6bffc791a0767a70426a2edd3d
Error response from daemon: conflict: unable to delete 186a5e8335e8 (cannot be forced) - image is being used by running container 7792214f98e9
Error response from daemon: conflict: unable to delete 1550535d5bc7 (cannot be forced) - image is being used by running container 712458adf893
[18:13:19|!] Failed to clean up previous container images
[18:13:19|*] Created temporary file for environment variables:
[18:13:19|*]   /tmp/zwift-container.env.4cscF5Smls
[18:13:19|*]   This file will be removed automatically when the script exits
[18:13:19|!] Not using SELinux, running container in privileged mode to be able to access the GPU
[18:13:19|*] Looking up Zwift password for antoninlinossier@gmail.com
[18:13:19|*] Password found for antoninlinossier@gmail.com
[18:13:19|*] Could not create secret for password, using environment variable instead
[18:13:19|*] Using X11 window manager (XOrg)
[18:13:19|◉] Starting docker container with the following arguments:
[18:13:19|◉] environment variables (/tmp/zwift-container.env.4cscF5Smls):
[18:13:19|◉]   • DEBUG=0
[18:13:19|◉]   • VERBOSITY=3
[18:13:19|◉]   • ZWIFT_UID=1000
[18:13:19|◉]   • ZWIFT_GID=1000
[18:13:19|◉]   • CONTAINER_TOOL=docker
[18:13:19|◉]   • COLORED_OUTPUT=1
[18:13:19|◉]   • ZWIFT_USERNAME=💜💜💜💜💜💜
[18:13:19|◉]   • ZWIFT_PASSWORD=💜💜💜💜💜💜
[18:13:19|◉]   • DISPLAY=:0
[18:13:19|◉]   • XAUTHORITY=/home/alinossier/.Xauthority
[18:13:19|◉]   • DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
[18:13:19|◉]   • PULSE_SERVER=/run/user/1000/pulse/native
[18:13:19|◉] docker command:
[18:13:19|◉]   docker run --rm --network bridge --name zwift-alinossier --hostname squid --env-file /tmp/zwift-container.env.4cscF5Smls -v zwift-alinossier:/home/user/.wine/drive_c/users/user/AppData/Local/Zwift -it --privileged --security-opt label=disable --runtime=nvidia --env NVIDIA_DRIVER_CAPABILITIES=all --env NVIDIA_VISIBLE_DEVICES=all --env __GLX_VENDOR_LIBRARY_NAME=nvidia --env XAUTHORITY=/tmp/.docker.xauth --env XDG_RUNTIME_DIR=/run/user/1000 --volume /home/alinossier/.Xauthority:/tmp/.docker.xauth:ro --volume /run/user/1000:/run/user/1000 -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/alinossier/.Xauthority:/home/alinossier/.Xauthority -v /run/user/1000/bus:/run/user/1000/bus -v /run/user/1000/pulse:/run/user/1000/pulse --gpus=all docker.io/netbrain/zwift:latest 
[18:13:19|*] Writing environment variables to temporary file
[18:13:19|✓] Environment variables written to temporary file
[18:13:19|*] Launching Zwift
[docker|22:13:19|*] Checking file ownership
[docker|22:13:19|✓] Ownership already correct, skipping
[docker|22:13:19|✓] File ownership is correct
[docker|22:13:19|*] Starting Zwift launcher using wine
[docker|22:13:20|✓] Zwift launcher started using wine
[docker|22:13:20|*] Authenticating with Zwift
01b0:err:ole:CoGetContextToken apartment not initialised
0188:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Foundation.Diagnostics.AsyncCausalityTracer"
0188:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Globalization.Calendar"
[docker|22:13:21|*] Starting Zwift using wine
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  232
  Current serial number in output stream:  233

thread 'main' panicked at src/main.rs:38:73:
called `Result::unwrap()` on an `Err` value: Error { code: HRESULT(0x80070057), message: "Invalid parameter." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
0238:err:seh:NtRaiseException Unhandled exception code c0000409 flags 1 addr 0x14000f805
[docker|22:13:21|✗] Failed to start Zwift using wine!
[docker|22:13:21|*] Killing unnecessary applications
[18:13:21|✗] Failed to start Zwift, check variables! 😢
[18:13:30|*] Continuing in 1 seconds...
[18:13:31|*] Removed temporary file /tmp/zwift-container.env.4cscF5Smls

Distribution Details

  • Ubuntu 22.04.5 LTS
  • x11
  • NVIDIA GeForce RTX 4090
  • Driver Version: 580.142
  • netbrain/zwift:latest
  • sha256:5bfcaae82e4dd70b5284a5a0b9c7d340e24b642f08672dbe75a2be9932a3c1de

Reproduction steps

  1. Run VERBOSITY=3 ZWIFT_FG=1 zwift

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions