Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
NaevaTheCat opened this issue Apr 11, 2024 · 38 comments
Assignees
Labels
bug Something isn't working

Comments

@NaevaTheCat
Copy link

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 
@netbrain
Copy link
Owner

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

@NaevaTheCat
Copy link
Author

NaevaTheCat commented Apr 11, 2024

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

@netbrain
Copy link
Owner

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
Copy link
Owner

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:

#80 (comment)

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

@sebstrand
Copy link

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.

@NaevaTheCat
Copy link
Author

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?

@netbrain
Copy link
Owner

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.

@quietvoid
Copy link
Contributor

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
Copy link
Contributor

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

@cmuench
Copy link

cmuench commented Apr 22, 2024

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.

@sHedC
Copy link
Collaborator

sHedC commented Apr 24, 2024

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
Copy link
Collaborator

sHedC commented Apr 24, 2024

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
Copy link
Collaborator

sHedC commented Apr 27, 2024

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.

@joekm
Copy link

joekm commented May 4, 2024

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.

@sHedC
Copy link
Collaborator

sHedC commented May 4, 2024

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.

@joekm
Copy link

joekm commented May 5, 2024

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.

@sHedC
Copy link
Collaborator

sHedC commented May 5, 2024

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

@joekm
Copy link

joekm commented May 5, 2024

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.

@sHedC
Copy link
Collaborator

sHedC commented May 12, 2024

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.

@joekm
Copy link

joekm commented May 12, 2024

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.

@sHedC
Copy link
Collaborator

sHedC commented May 13, 2024

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 sHedC self-assigned this May 13, 2024
@joekm
Copy link

joekm commented May 13, 2024 via email

@sHedC
Copy link
Collaborator

sHedC commented May 14, 2024

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
Copy link
Collaborator

sHedC commented May 14, 2024

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

@joekm
Copy link

joekm commented May 18, 2024

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!

@sHedC
Copy link
Collaborator

sHedC commented May 19, 2024

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.

@joekm
Copy link

joekm commented May 19, 2024

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

@sHedC
Copy link
Collaborator

sHedC commented May 19, 2024

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.

@joekm
Copy link

joekm commented May 19, 2024

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.

@sHedC
Copy link
Collaborator

sHedC commented May 20, 2024

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

@joekm
Copy link

joekm commented May 20, 2024

poking around, this looks like it may impact both Hyprland and Sway desktops on Arch.

@sHedC
Copy link
Collaborator

sHedC commented May 20, 2024

I have hyperland installed and see the same error, its down to xauthority not sure what yet.

@sHedC
Copy link
Collaborator

sHedC commented May 20, 2024

Can you edit the /usr/local/bin/zwift and comment out the line -v $XAUTHORITY:$(echo $XAUTHORITY | sed 's/'$UID'/'$ZWIFT_UID'/') as shown below.

Hyperland doesn't need XAUTHORITY to release the window, I will put an update in the latest updates I have ongoing.

# Setup Wayland Usage.
if [[ ! -z $WAYLAND_DISPLAY ]]
then
    if [[ ! -z $WINE_EXPERIMENTAL_WAYLAND ]]
    then
        # Using Experimental Wayland, setup required parameters
        # To force wayland DISPLAY must be blank.
        WAYLAND_FLAGS=(
            -e XDG_RUNTIME_DIR=/run/user/$ZWIFT_UID
            -e PULSE_SERVER=/run/user/$ZWIFT_UID/pulse/native
            -e WINE_EXPERIMENTAL_WAYLAND=1
        )
    else

        WAYLAND_FLAGS=(
            --hostname $HOSTNAME
            -e PULSE_SERVER=/run/user/$ZWIFT_UID/pulse/native
            # -v $XAUTHORITY:$(echo $XAUTHORITY | sed 's/'$UID'/'$ZWIFT_UID'/')
        )
    fi
else
    X11_FLAGS=(
        --hostname $HOSTNAME
        -v $XAUTHORITY:$(echo $XAUTHORITY | sed 's/'$UID'/'$ZWIFT_UID'/')
    )
fi

@sHedC
Copy link
Collaborator

sHedC commented May 20, 2024

Yes so hyprland is not using XAUTHORITY however xhost by default allows local user to run X Programs so commenting this out should work.

I have updated the script in the latest pull request.

@joekm
Copy link

joekm commented May 20, 2024

That seems to have fixed it on Hyprland, thanks :). From what I was reading this morning, it's possible Sway may have the same issue (or maybe any Wayland Compositor/Window Manager).

@sHedC
Copy link
Collaborator

sHedC commented May 21, 2024

possibly, I don't know sway either. Basically the current preferred way is to use Xauthority, in these cases default is disable access and Xauthority gives access.

However I was reading some compositors and WM's don't use xauthority, in Hyperlands case when starting it automatically adds xhost +SI:localhost:. xhost is not installed by default on EndevourOS I found.

If neither xauthority or xhost access is set then no x applications would work so I think it might be safe to assume its going to be one or the other.

So I updated the latest pull to check for xauthority first then if not there assume access is defined by xhost rules and we can see if we get other issues. Would be easier to figure out:

  • Check you have XAUTHORITY
  • run xhost see what authorizations are set.

I'll close this thread once we have the merges reviewed/ updated and merged.

@sHedC sHedC added the bug Something isn't working label May 21, 2024
@sHedC
Copy link
Collaborator

sHedC commented May 21, 2024

Latest is released, please re-install zwift from following instructions in the README.

When I ran it complained about an existing container which I remeoved using podman container rm zwift-xxxxx but that could just be because I have been messing and left it around.

@sHedC sHedC closed this as completed May 21, 2024
@joekm
Copy link

joekm commented May 21, 2024

Can confirm it's working on both Hyprland (Wayland) and XFCE (X11). Thanks again and ride on :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants