flathub / us.zoom.Zoom

https://flathub.org/apps/details/us.zoom.Zoom
35 stars 46 forks source link

No Wayland screensharing again (Zoom 6.1) #471

Closed takluyver closed 1 month ago

takluyver commented 1 month ago

Screensharing doesn't work again since Zoom version 6.1. The window that should show the 'Use system desktop capture' & 'Use system window capture' options is empty:

image

I'm opening a new issue because while the symptoms are the same as #412, the cause seems to be different. Specifically, earlier workarounds like setting 'Pipewire mode' in the screensharing settings no longer work.

Arch users figured out that Zoom is looking for a file like /usr/libexec/xdg-desktop-portal - it now looks in /usr/lib and /usr/lib64 as well, but none of these exist inside the freedesktop runtime, because the portal infrastructure is running outside the flatpak. If one of those files exists, it then runs it with a --version flag, presumably to do a version check.

Fiddling around with the runtime to put a script there with echo "xdg-desktop-portal 1.18.4" is enough to fool it into working. But I can't see a way to achieve this inside the running Flatpak - the /usr filesystem is read-only, and I'm not expecting there to be a config setting or an environment variable to change where it looks for this (though I haven't gone looking).

takluyver commented 1 month ago

I've posted in the Zoom forum with some details of how they might be able to fix it, but I doubt this will be high on their priority list if it's working with the (unsandboxed) packages they provide. :disappointed:

https://community.zoom.com/t5/Zoom-Meetings/share-screen-linux-wayland-broken/m-p/193009/highlight/true#M106590

onagano-rh commented 1 month ago

For the moment, I reverted to the previous commit and it works as used to be.

$ flatpak remote-info --log flathub us.zoom.Zoom

Zoom - Video Conferencing, Web Conferencing, Webinars, Screen Sharing

        ID: us.zoom.Zoom
       Ref: app/us.zoom.Zoom/x86_64/stable                                                                                     
      Arch: x86_64
    Branch: stable        
   Version: 6.1.5.871                       
   License: LicenseRef-proprietary
Collection: org.flathub.Stable
  Download: 5.0 MB     
 Installed: 10.8 MB                 
   Runtime: org.freedesktop.Platform/x86_64/23.08
       Sdk: org.freedesktop.Sdk/x86_64/23.08

    Commit: a771328edcab0e9c017fe0daf02fa042eed5ae8a2c99de64a0f8e898dffc7f82
    Parent: b9505f108b5f9acb2bbad83ac66f97b42bc6a75b9c28ed7b75dec1040e013305
   Subject: Update krb5 and zoom modules (da15efb1)
      Date: 2024-07-25 21:56:08 +0000
   History:                                                                                                                    

    Commit: b9505f108b5f9acb2bbad83ac66f97b42bc6a75b9c28ed7b75dec1040e013305
   Subject: Update zoom.tar.xz to 6.0.12.5501 (b76552df)
      Date: 2024-06-19 11:23:36 +0000                                                                                                                                                                                                                          

(snipped)

$ sudo flatpak update --commit=b9505f108b5f9acb2bbad83ac66f97b42bc6a75b9c28ed7b75dec1040e013305 us.zoom.Zoom
nedrichards commented 1 month ago

Sadly just keeping on the previous commit was becoming increasingly unsustainable as ever increasing numbers of users hit a minimum version wall of a 6.1.x version. If this works for you, I am delighted!

Thanks for reporting upstream @takluyver - agreed that this is likely a fix they'll have to do, which is frustrating. Obviously patches very welcome for cunning workarounds.

takluyver commented 1 month ago

Technically the simplest workaround would be to make a custom runtime derived from the freedesktop one with a mock xdg-desktop-portal script. But making a custom runtime for your app cuts against the design of Flatpak, and I'm pretty sure Flathub doesn't have easy processes for adding a new runtime, because it's not what we're meant to do.

If we could set up /usr as an overlay mount, we could add a file temporarily when the app starts, but I assume we can't change the mounts inside the sandbox.

Other than that, the only way I can think of is an LD_PRELOAD trick to intercept the calls to find and run this file. Zypak already does something like this to make Chromium work, but this would be harder because we can't even see the source code that we're trying to affect. And we'd need to ensure the new hooks didn't break Zypak's hooks. I think this is techically possible, but I'm not going to try it.

nedrichards commented 1 month ago

Yeah - flathub really does not want you to be deriving runtimes. And I was handwaving towards something like a zypak style solution, it's certainly not something I'm going to get involved in or really want to support, but I've been very impressed at how well the zypak group have done with good coding and a lot of enthusiasm.

galloramiro commented 1 month ago

Im having the same problem in Fedora Screenshot_20240806_111411 Screenshot_20240806_111312

enck commented 1 month ago

Crazy idea: Can we patch the zoom binary to replace one of the xdg-desktop-portal strings? As long as the new string is the same length as the old string, it should theoretically work.

% strings zoom.real | grep xdg-desktop-portal
/usr/lib/xdg-desktop-portal
/usr/lib64/xdg-desktop-portal
/usr/libexec/xdg-desktop-portal
/usr/libexec/xdg-desktop-portal --version
/usr/lib/xdg-desktop-portal --version
/usr/lib64/xdg-desktop-portal --version
% sed -e 's@/usr/lib/xdg-desktop-portal@/app/lib/xdg-desktop-portal@g' -i zoom.real
% strings zoom.real | grep xdg-desktop-portal                                      
/app/lib/xdg-desktop-portal
/usr/lib64/xdg-desktop-portal
/usr/libexec/xdg-desktop-portal
/usr/libexec/xdg-desktop-portal --version
/app/lib/xdg-desktop-portal --version
/usr/lib64/xdg-desktop-portal --version

And then we can put a simple script with echo "xdg-desktop-portal 1.18.4" in /app/lib/xdg-desktop-portal.

I don't have an environment setup to rebuild the flatpak, so I was not able to test it.

agunnerson-elastic commented 1 month ago

@enck Thanks, that worked great!

I applied this diff:

diff --git a/us.zoom.Zoom.json b/us.zoom.Zoom.json
index 5f0e296..0377870 100644
--- a/us.zoom.Zoom.json
+++ b/us.zoom.Zoom.json
@@ -68,7 +68,9 @@
                 "install -Dm644 us.zoom.Zoom.256.png /app/share/icons/hicolor/256x256/apps/us.zoom.Zoom.png",
                 "install -Dm755 zoom.sh /app/bin/zoom",
                 "install -Dm755 zoom-wrapper.sh /app/bin/zoom-wrapper.sh",
-                "install -Dm644 zoom-ld.so.conf /app/etc/ld.so.conf"
+                "install -Dm644 zoom-ld.so.conf /app/etc/ld.so.conf",
+                "echo -e '#!/bin/sh\necho xdg-desktop-portal 1.18.4' > /app/lib/xdg-desktop-portal",
+                "chmod 755 /app/lib/xdg-desktop-portal"
             ],
             "sources": [
                 {
@@ -78,6 +80,7 @@
                         "tar xf zoom.tar.xz --no-same-owner",
                         "rm -f zoom.tar.xz",
                         "mv /app/extra/zoom/zoom /app/extra/zoom/zoom.real",
+                        "sed -i 's,/usr/lib/xdg-desktop-portal,/app/lib/xdg-desktop-portal,g' /app/extra/zoom/zoom.real",
                         "cp /app/bin/zoom-wrapper.sh /app/extra/zoom/zoom"
                     ]
                 },

built it with:

flatpak-builder --user --install-deps-from flathub --force-clean build-dir --install us.zoom.Zoom.json

and ran it with:

XDG_CURRENT_DESKTOP=GNOME flatpak run app/us.zoom.Zoom/x86_64/master
takluyver commented 1 month ago

Nice one! @agunnerson-elastic, since you've got the diff there, do you want to turn it into a pull request on this repo?

nedrichards commented 1 month ago

Can you test https://github.com/flathub/us.zoom.Zoom/pull/474 ? This contains the patch above and works for me locally.