zwift icon indicating copy to clipboard operation
zwift copied to clipboard

Container crashes on wayland. Works on X: err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.

Open NaevaTheCat opened this issue 10 months ago • 15 comments

Describe the bug Running the container closes almost immediately, checking the journal I see:

Apr 11 10:34:04 bark zwift[25964]: 01a4:err:ole:CoGetContextToken apartment not initialised
Apr 11 10:34:04 bark zwift[25964]: 0184:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Foundation.Diagnostics.AsyncCausalityTracer"
Apr 11 10:34:05 bark zwift[25964]: 0184:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
Apr 11 10:34:05 bark zwift[25964]: 0184:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
Apr 11 10:34:05 bark zwift[25964]: + wine start /exec /bin/runfromprocess-rs.exe 384 ZwiftApp.exe '--token={"access_token":"<redacted>","expires_in":21600,"refresh_expires_in":691200,"refresh_token":"<redacted>","scope":"openid"}'
Apr 11 10:34:05 bark zwift[25964]: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: HRESULT(0x80070057), message: "Invalid parameter." }', src/main.rs:38:73
Apr 11 10:34:05 bark zwift[25964]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Apr 11 10:34:05 bark zwift[25964]: 01e0:err:seh:NtRaiseException Unhandled exception code c0000409 flags 1 addr 0x1400347f6

stdout is:

+ IMAGE=docker.io/netbrain/zwift
+ VERSION=latest
+ [[ ! -n '' ]]
++ command -v podman
+ [[ -x /usr/bin/podman ]]
+ CONTAINER_TOOL=podman
+ [[ ! -n '' ]]
+ podman pull docker.io/netbrain/zwift:latest
Trying to pull docker.io/netbrain/zwift:latest...
Getting image source signatures
Copying blob c12bfc3fd135 skipped: already exists
<SNIP>
bb153ec22d63b7bd628ba5b929b5bab98946ca8b121020fc98e59f3bfded184b
+ [[ -f /proc/driver/nvidia/version ]]
+ VGA_DEVICE_FLAG='--device /dev/dri:/dev/dri'
+++ '[' podman = podman ']'
+++ echo --userns=keep-id
++ podman run -d --rm --privileged -e DISPLAY=:1 -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/pulse:/run/user/1000/pulse -v zwift-naeva:/home/user/Zwift --userns=keep-id --device /dev/dri:/dev/dri docker.io/netbrain/zwift:latest
+ CONTAINER=ab12285132782d872399f8865e86713f0bfd472c2c8426e8a964dd5be2772040
+ [[ -z wayland-0 ]]

Without authentication I just see this:

Apr 11 08:41:00 bark zwift[8761]: 01c0:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
Apr 11 08:41:00 bark zwift[8761]: 01c0:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
Apr 11 08:41:01 bark zwift[8761]: + pgrep -f ZwiftApp.exe
Apr 11 08:41:01 bark zwift[8761]: Killing uneccesary applications

So I think that's likely the salient stuff.

To Reproduce Load plasma on wayland, run /usr/local/bin/zwift

Additional context If I load plasma on X and run it (after installing xhost) it works fine. It seems to be some wayland problem? This is the first time I've used wayland/a desktop environment in more than a decade so I am pretty clueless at what to troubleshoot.

System information:

OS: Arch Linux x86_64 
Host: 20QGS1DB00 ThinkPad X1 Yoga 4th 
Kernel: 6.8.4-arch1-1 
Uptime: 12 hours, 54 mins 
Packages: 1503 (pacman) 
Shell: bash 5.2.26 
Resolution: 1920x1080 
DE: Plasma 6.0.3 
WM: kwin 
Theme: [Plasma], Breeze-Dark [GTK2], Breeze [GTK3] 
Icons: [Plasma], breeze-dark [GTK2/3] 
Terminal: konsole 
Terminal Font: MesloLGS NF 14 
CPU: Intel i5-8365U (8) @ 4.100GHz 

NaevaTheCat avatar Apr 11 '24 00:04 NaevaTheCat

What graphics card are you using?

Most likely you are missing the correct graphics driver in the container itself. Im guessing this works on zwift version 1.60.0? i.e

VERSION=1.60.0 zwift

Could you also try to see if glxgears would spin up in the container?

This will run the container interactively

podman run -it --rm --privileged -e DISPLAY=:1 -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/pulse:/run/user/1000/pulse -v zwift-naeva:/home/user/Zwift --userns=keep-id --device /dev/dri:/dev/dri  --entrypoint=bash docker.io/netbrain/zwift:latest
glxgears

netbrain avatar Apr 11 '24 05:04 netbrain

Apparently I am a bad user who fails at copy paste.

GPU: GPU: Intel WhiskeyLake-U GT2 [UHD Graphics 620]


Downloading zwift 1.60.0 and running (I had not used any previous versions) it I get:

Apr 11 17:52:20 bark zwift[51353]: 0138:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Foundation.Diagnostics.AsyncCausalityTracer"
Apr 11 17:52:21 bark zwift[51353]: 0138:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
Apr 11 17:52:21 bark zwift[51353]: 0138:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly."

which seems like the same thing.

Running those 2 commands I get:

user@4287b882a301:~$ glxgears
bash: glxgears: command not found

glxgears works fine outside the container though, if that's relevant /shrug

NaevaTheCat avatar Apr 11 '24 07:04 NaevaTheCat

sorry, please do a sudo apt update && sudo apt install mesa-utils before trying to run glxgears

also show me the output of glxinfo

netbrain avatar Apr 11 '24 08:04 netbrain

Ah, see now that you actually have it working in X? but not wayland? correct? In that case i'ts probably something with how podman / wayland interacts.

But, if you can get a container with glxgears to run under wayland, then zwift should work aswell. A good starting point would be this:

https://github.com/netbrain/zwift/issues/80#issuecomment-2039116156

And then try to tweak podman flags in order to allow the container to use your graphics device.

netbrain avatar Apr 11 '24 08:04 netbrain

I had a similar issue (also on Arch Linux with Wayland) and removing the if-statement around xhost in zwift.sh (so that it runs even if Wayland is in use) fixed it for me, if I remember correctly.

sebstrand avatar Apr 11 '24 14:04 sebstrand

Thanks for your patience with this.

Yes, it does work if I log in to an X session vs a wayland session.

Installing mesa-utils and running glxgears I get:

user@a6b42aa4eff8:~$ glxinfo
Authorization required, but no authorization protocol specified

Error: unable to open display :1

Baffling, since I'm not running X

However if I do xhost + and then run the container it works.

So it looks like stuff is being forced through xhost or something? I'm not entirely sure.

As a result doing what sebstrand says works.

Baffling! Idk if you want to leave this open to fix in a future release or consider it closed, it's probably worth documenting though?

NaevaTheCat avatar Apr 12 '24 05:04 NaevaTheCat

Im running wayland myself, but i don't need to do xhost in order to get zwift running. So not sure why you have to. guess it comes down to how wayland is configured? or myabe Xwayland.

Another alternative thing you could try is to use the experimental wayland feature in wine (see WINE_EXPERIMENTAL_WAYLAND in README). but in that case i think you need to forward other environment variables aswell and set DISPLAY to an empty string. @quietvoid might now a thing or two about this as i'm pretty sure he has tested out wine with wayland support.

netbrain avatar Apr 12 '24 08:04 netbrain

I have not tested the current image but I'll try to later today or on the weekend.

The Wine Wayland driver can't be used for Zwift until version 9.4 (OpenGL basic support), so if the image is actually on 9.0 it's not possible to use it. It would be a different error though.

So here it just seems like a misconfiguration that makes it not find the X display.

quietvoid avatar Apr 12 '24 13:04 quietvoid

I just tested the latest netbrain/zwift image and it works fine for me. Might be a podman specific issue.

quietvoid avatar Apr 20 '24 17:04 quietvoid

I just updated to latest fedora (40) which will be released tomorrow. Fedora 40 comes with Wayland only. I have the same issues as described above. It's only starting with xhost + before docker run.

cmuench avatar Apr 22 '24 16:04 cmuench

Wayland on Fedora 40 works for me without the xhost + using 1.62.0

Using 1.63.0 with Podman now gives me a permissions error on groupmod -o -g user, this gives me the same issue on Fedora 39. The latest update you can't run groupmod or usermod using rootless podman by the looks of it.

sHedC avatar Apr 24 '24 14:04 sHedC

I just updated to latest fedora (40) which will be released tomorrow. Fedora 40 comes with Wayland only. I have the same issues as described above. It's only starting with xhost + before docker run.

Just found a post on this one, someone said they put this in their bash script on startup

xhost +si:localuser:$USER

This is what made my zwift work on wayland fedora 40 without modifying the zwift script maybe this can be added to the zwift script?

This is for 1.62.0, still have an issue that two new commands in 1.63.0 don't work with podman rootless.

sHedC avatar Apr 24 '24 15:04 sHedC

This really bugged me, for the latest podman is working fine but not displaying under wayland. Under X works but requires running xhost + or xhost +si:localuser:$USER first.

In short, under Fedora 40 Wayland this worked for me, still needed xhost +

  • xhost +
  • NETWORKING=host zwift

Doing this worked

podman run -it --rm --privileged -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/pulse:/run/user/1000/pulse -v zwift-naeva:/home/user/Zwift --userns=keep-id --device /dev/dri:/dev/dri  --entrypoint=bash docker.io/netbrain/zwift:latest

wine notepad

But doing this, which is how the latest runs, gave me more information (removing the --userns=keep-id)

podman run -it --rm --privileged -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/pulse:/run/user/1000/pulse -v zwift-naeva:/home/user/Zwift --device /dev/dri:/dev/dri  --entrypoint=bash docker.io/netbrain/zwift:latest

wine notepad
gosu user:user wine notepad

The first works the second does not.

Further investigation when you gosu or su or sudo to a user you loose the access to the X11 server. There are some things online about this but I couldn't get any working.

In the end I found a post that said just put --net host and it works, so the solution to change NETWORKING=host worked for me under wayland.

sHedC avatar Apr 27 '24 18:04 sHedC

Still trying to figure out how to get the container to see my graphics card (AMD). I can't really install anything within that container because the user podman creates for me does not have sudo permission and, trying to run sudo --user=[ME] doesn't seem to work either.

It's running, but it appears to be running off my CPU and not the GPU. This is true in both X and Wayland.

joekm avatar May 04 '24 12:05 joekm

Still trying to figure out how to get the container to see my graphics card (AMD). I can't really install anything within that container because the user podman creates for me does not have sudo permission and, trying to run sudo --user=[ME] doesn't seem to work either.

It's running, but it appears to be running off my CPU and not the GPU. This is true in both X and Wayland.

Assuming your CPU is an intel and your primary display is the intel iGPU then not sure how you can get it to pick up the Radeon, the app uses /dev/dri for Intel/ AMD and it is picking up the first capable card.

You could try passing DRI_PRIME=1 as an environment variable, adding -e DRI_PRIME=1 to the zwift startup.

sHedC avatar May 04 '24 19:05 sHedC

My setup is all AMD. Ryzen 7 5800X CPU and Radeon RX6700XT graphics. Motherboard has no onboard graphics.

I also run openRGB setup to give me color scale indications of CPU, GPU, and memory temperature. It works pretty well in giving me an indication as to what's being loaded. When I run Zwift, the CPU fan color shows it's warming up, but the window in front of the graphics card is staying blue, indicating it's not really becoming active.

joekm avatar May 05 '24 01:05 joekm

similar to mine mine is an AMD 5700G with RX6700XT, I am running in proxmox so have setup just with the RX using Fedora 40 under Wayland. (currently accessing over RDP can try without during the week direct with the RX.

Install zwift xhost + start radeontop zwift

in my case radeontop shows activity once zwift started.

ls -la /dev/dri shows render128 as crw, rw, rw

Inside the container, starting as root:

podman run -it --rm --privileged -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/pulse:/run/user/1000/pulse -v zwift-naeva:/home/user/Zwift --device /dev/dri:/dev/dri  --entrypoint=bash docker.io/netbrain/zwift:latest

apt update
apt install mesa-utils
glxgears -info

Shows that the RX is being used and RadeonTop shows activity ls -la /dev/dir shows render128 as crw,rw,rw

sHedC avatar May 05 '24 08:05 sHedC

Ok, radeontop does confirm the graphics card is active. I should have thought to run that to cross-check OpenRGB.

Curious though, the argb CPU cooler fan is changing color to show the CPU is getting warm, but the window in front of the graphics card stays blue. Just launched Borderlands 3 just to verify it's working and, the window changed color as expected when the game's graphic engine came online.

It may be as simple as Zwift just doesn't load my graphics card that much. Next time I run it, I'll try cranking up the graphics settings and see if that doesn't wake it up a bit.

That being said, it appears to be working after all, and I don't even seem to need xhost +.

UPDATE: Ok, "Jurrasic Coast" was just enough graphics load to make the temperature monitor color just start to transition from blue to green. No doubt it's working correctly now. It just doesn't load my card that much.

joekm avatar May 05 '24 12:05 joekm

Hi, can you re-try. Re-install the latest zwift program and you probably have to remove the volume.

podman volume rm zwift-xxxxx

Where xxxx is your userid, then re-try. Latest should just work with Wayland and X11 under podman and docker.

sHedC avatar May 12 '24 17:05 sHedC

Not working under Wayland, will work under X11 if I run "xhost +" first. Also, when I listed my podman volumes, I got

zwift-jkmooney zwift-naeva

The former is my username, don't know what the latter is.

joekm avatar May 12 '24 22:05 joekm

Not working under Wayland, will work under X11 if I run "xhost +" first. Also, when I listed my podman volumes, I got

zwift-jkmooney zwift-naeva

The former is my username, don't know what the latter is.

Hi, please delete both, the naeva was something I noticed to when I started testing to fix, not sure where it came from but delete it it should not appear anymore.

Ok just to confirm you re-updated the latest zwift script from git hub using Curl? It downloaded the latest

in the zwift you can compare what you have in /usr/local/bin with the zwift.sh in the repo to make sure you are up to date.

What do you see did it open then crash after update? I saw this once but after it was stable.

What OK I think Fedora and Gnome What Card (I can't test Intel but have Nvidia/ AMD dGPU and iGPU and Virt IO GL and SPice etc so can easliy test) If Nvidia what drivers Noveau or Nvidia.

Sorry also podman/ docker and what environment variables.

Thanks

sHedC avatar May 13 '24 06:05 sHedC

I did reinstall zwift using curl. I'm currently on business travel so it will be middle of next week before I can try again.

On Mon, May 13, 2024, 2:58 AM Richard Holmes @.***> wrote:

Not working under Wayland, will work under X11 if I run "xhost +" first. Also, when I listed my podman volumes, I got

zwift-jkmooney zwift-naeva

The former is my username, don't know what the latter is.

Hi, please delete both, the naeva was something I noticed to when I started testing to fix, not sure where it came from but delete it it should not appear anymore.

Ok just to confirm you re-updated the latest zwift script from git hub using Curl? It downloaded the latest

in the zwift you can compare what you have in /usr/local/bin with the zwift.sh in the repo to make sure you are up to date.

What do you see did it open then crash after update? I saw this once but after it was stable.

What OK I think Fedora and Gnome What Card (I can't test Intel but have Nvidia/ AMD dGPU and iGPU and Virt IO GL and SPice etc so can easliy test) If Nvidia what drivers Noveau or Nvidia.

Thanks

— Reply to this email directly, view it on GitHub https://github.com/netbrain/zwift/issues/88#issuecomment-2106794686, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA76BALFN2F3NDLPHBWBAN3ZCBQB7AVCNFSM6AAAAABGBMEWC6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWG44TINRYGY . You are receiving this because you commented.Message ID: @.***>

joekm avatar May 13 '24 13:05 joekm

Hi, I read ealier your setup forgot we already discussed, I see that in some cases the XAuthority does not seem to work, when you get back can you check what XAUTHORITY contains on your host please.

sHedC avatar May 14 '24 06:05 sHedC

@joekm - Have updated to always use the xhost +local.... for both X11 and XWayland, hopfully this works on all distributions.

sHedC avatar May 14 '24 09:05 sHedC

Under Wayland: echo $XAUTHORITY comes up blank. Similarly ~/.Xauthority exists, but is an empty file.

Under X11: echo $XAUTHORITY gives me a cookie file in the /tmp directory.

With latest update to Zwift.sh, X11 is working fine but Wayland fails to launch with the following message:

Error: host directory cannot be empty

  • CONTAINER=
  • '[' 125 -ne 0 ']'
  • echo -e '\033[0;31m\033[1m\033[4mError can'''t run zwift, check variables!\033[0m' Error can't run zwift, check variables!

joekm avatar May 18 '24 21:05 joekm

Anything in the log before, that line is saying that the container failed to run, can you post what the container command is too please :)

CONTAINER=$($podman .....) for example.

sHedC avatar May 19 '24 07:05 sHedC

I'll dive more into it when I have some time but it kind of looks like it's not getting something to assign to CONTAINER...

  • [[ -f /proc/driver/nvidia/version ]]
  • VGA_DEVICE_FLAG=--device=/dev/dri:/dev/dri
  • [[ -n unix:path=/run/user/1000/bus ]]
  • [[ unix:path=/run/user/1000/bus =~ ^unix:path=([^,]+) ]]
  • DBUS_UNIX_SOCKET=/run/user/1000/bus
  • [[ -n /run/user/1000/bus ]]
  • DBUS_CONFIG_FLAGS=(-e DBUS_SESSION_BUS_ADDRESS=$(echo $DBUS_SESSION_BUS_ADDRESS | sed 's/'$UID'/'$ZWIFT_UID'/') -v $DBUS_UNIX_SOCKET:$(echo $DBUS_UNIX_SOCKET | sed 's/'$UID'/'$ZWIFT_UID'/')) ++ echo unix:path=/run/user/1000/bus ++ sed s/1000/1000/ ++ echo /run/user/1000/bus ++ sed s/1000/1000/
  • [[ ! -z wayland-1 ]]
  • [[ ! -z '' ]]
  • WAYLAND_FLAGS=(--hostname $HOSTNAME -e PULSE_SERVER=/run/user/$ZWIFT_UID/pulse/native -v $XAUTHORITY:$(echo $XAUTHORITY | sed 's/'$UID'/'$ZWIFT_UID'/')) ++ echo ++ sed s/1000/1000/
  • [[ podman == \p\o\d\m\a\n ]] ++ podman volume ls ++ grep zwift-jkmooney
  • [[ -z local zwift-jkmooney ]]
  • PODMAN_FLAGS=(--userns keep-id:uid=$ZWIFT_UID,gid=$ZWIFT_GID) ++ podman run -d --rm --privileged --network bridge --name zwift-jkmooney --security-opt label=disable -e DISPLAY=:1 -e WINE_EXPERIMENTAL_WAYLAND= -e ZWIFT_UID=1000 -e ZWIFT_GID=1000 -e XAUTHORITY= -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/pulse:/run/user/1000/pulse -v zwift-jkmooney:/home/user/.wine/drive_c/users/user/Documents/Zwift --device=/dev/dri:/dev/dri -e DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus -v /run/user/1000/bus:/run/user/1000/bus --hostname jkmooney-ms7c96 -e PULSE_SERVER=/run/user/1000/pulse/native -v : --userns keep-id:uid=1000,gid=1000 docker.io/netbrain/zwift:latest Error: host directory cannot be empty
  • CONTAINER=
  • '[' 125 -ne 0 ']'
  • echo -e '\033[0;31m\033[1m\033[4mError can'''t run zwift, check variables!\033[0m' Error can't run zwift, check variables!
  • exit 0

joekm avatar May 19 '24 16:05 joekm

Its the XAUTHROITY bit, its blank which is not good, did you say which distro you are on, seems XAuthority is not used.

I think for your case we need to add a check for XAUTHORITY and if blank probably enable xhost, I assume you have xhost installed.

sHedC avatar May 19 '24 16:05 sHedC

I'm running EndeavourOS (pretty close to Arch). The window manager is Hyprland. I've tried launching this on Hyprland by running "xhost +" first but it still doesn't work. (I do have xhost installed). . The other desktop I have installed is XFCE (which is X11) and this runs just fine on that.

joekm avatar May 19 '24 21:05 joekm

Never tried EndevourOS will spin it up, also not yet tried hyperland but interested to see what it would offer me.

sHedC avatar May 20 '24 05:05 sHedC