Rafostar / clapper

Level up your video experience with a modern and user-friendly media player.
https://rafostar.github.io/clapper/
GNU General Public License v3.0
773 stars 37 forks source link

flatpak: Cannot play files from samba since a few days #277

Closed prog-amateur2 closed 2 years ago

prog-amateur2 commented 2 years ago

Hello, I have always used this great application to read my files. Since a few days, I can only read the files on my computer (home directory).

I am under the following configuration:

       _,met$$$$$gg.          3@3 
    ,g$$$$$$$$$$$$$$$P.       ------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux bookworm/sid x86_64 
 ,$$P'              `$$$.     Host: Surface Go 3 124I:00074T:000M:0300000D:0B:0 
',$$P       ,ggs.     `$$b:   Kernel: 5.17.0-3-amd64 
`d$$'     ,$P"'   .    $$$    Uptime: 15 mins 
 $$P      d$'     ,    $$P    Packages: 2921 (dpkg), 51 (flatpak) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.1.16 
 $$;      Y$b._   _,d$P'      Resolution: 1920x1280 
 Y$$.    `.`"Y$$$$P"'         DE: GNOME 42.1 
 `$$b      "-.__              WM: Mutter 
  `Y$$                        WM Theme: Adwaita 
   `Y$$.                      Theme: Adwaita-dark [GTK2/3] 
     `$$b.                    Icons: Adwaita [GTK2/3] 
       `Y$$b.                 Terminal: kgx 
          `"Y$b._             CPU: Intel i3-10100Y (4) @ 3.900GHz 
              `"""            GPU: Intel UHD Graphics 615 
                              Memory: 2992MiB / 7876MiB

With Flatseal, I added: xdg-run/gvfs and even activated filesystem=host, without success.

I have also tried to run Clapper from a Terminal (but I am not sure it is the right command) :

3@3:~$ flatpak run -v com.github.rafostar.Clapper 
F: No installations directory in /etc/flatpak/installations.d. Skipping
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/3/.local/share/flatpak
F: Opening user flatpak installation at path /home/3/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/3/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: /var/lib/flatpak/runtime/org.gnome.Platform/x86_64/42/e21d33a4f415cd14b03a148f757ebc2b4f86259fae14e3bd22c361b5b1d9b480/files/lib32 does not exist
F: Cleaning up unused container id 1234391585
F: Cleaning up per-app-ID state for com.github.rafostar.Clapper
F: Allocated instance id 654821995
F: Add defaults in dir /com/github/rafostar/Clapper/
F: Add locks in dir /com/github/rafostar/Clapper/
F: Allowing host-fs access
F: skipping export for path /usr/libx32
F: Allowing wayland access
F: Allowing pulseaudio access
F: Pulseaudio user configuration file '/home/3/.config/pulse/client.conf': Error opening file /home/3/.config/pulse/client.conf: Aucun fichier ou dossier de ce type
F: Running 'bwrap --args 40 xdg-dbus-proxy --args=42'
F: Running 'bwrap --args 40 com.github.rafostar.Clapper'

(com.github.rafostar.Clapper:2): Gdk-CRITICAL **: 18:20:14.428: gdk_scroll_event_get_direction: assertion 'GDK_IS_EVENT_TYPE (event, GDK_SCROLL)' failed

PS : the above Gdk-CRITICAL appeared while I was looking on the settings window.

Would you know where the problem comes from please?

If I need to run a terminal command to see the problems live, please let me know, I'd be happy to help find the solution together, many thanks !

Rafostar commented 2 years ago

With Flatseal, I added: xdg-run/gvfs

Have you also tried adding xdg-run/gvfsd (with letter "d" at the end)?

Rafostar commented 2 years ago

Another one apparently needed is org.gtk.vfs.*.

@prog-amateur2

Can you try:

sudo flatpak override --reset com.github.rafostar.Clapper
sudo flatpak override --talk-name="org.gtk.vfs.*" com.github.rafostar.Clapper
sudo flatpak override --filesystem="xdg-run/gvfsd" com.github.rafostar.Clapper

If you can confirm those two fix your issue, I will add them to flatpak manifest, as it seems they are now recommended for GNOME/GTK apps: https://docs.flatpak.org/en/latest/sandbox-permissions.html#gvfs-access

prog-amateur2 commented 2 years ago

@Rafostar Hello, thank you very much for your kind help. Unfortunately, none of these above commands works. I am not sure what happen. I even tried to uninstall/reinstall without success. Do you need a command from my side (log or verbose, please feel free to ask me) to better understand the issue ?

Thank you !

Rafostar commented 2 years ago

I am not asking for a log currently as I am not sure yet what part to debug. Since you said it was working before and there weren't any changes to file loading recently. Seems like it's either permissions issue or something somewhere else is causing this.

Could you describe how you mount and how you open files from your samba share, so I could try to reproduce this issue?

prog-amateur2 commented 2 years ago

Thank you for your help. I have mounted my samba share with the Gnome file manager : if you click on the left menu on Other locations, you can find at the bottom-right a field where you can enter an address like smb://id_name@192.168.X.X/path-to-video-folder.

When I select a video from this location, the window stays black, stuck at 00:00.

The same happen if I use another method to connect on my samba share : still on Gnome Files Other locations > Windows network > WORKGROUP > my NAS > id_name > path-to-video-folder.

If I copy and paste this same video from my samba share to my ~/Documents folder, the video works with Clapper.

(optional, for information purpose only) : maybe a clue that could be important: shortly before this problem, I couldn't read embedded subtitles on .mp4 videos from my samba share while these subtitles were readable if I launch the video from my ~/Documents folder.

So I agree the might be a permission issue. I hope this description will help you, thank you again.

Rafostar commented 2 years ago

OK. Thanks for describing how you mount this. So we are dealing with GVFS here then.

I think I can reproduce this with SFTP file server. And yes, seems like GVFS permissions issue. Here is what I tried:

  1. Mount SFTP via Nautilus file manager (uses GVFS) = NOT WORK
  2. Add with flatpak override org.gtk.vfs.* and xdg-run/gvfsd permissions = NOT WORK
  3. Add org.gtk.vfs.* and xdg-run/gvfsd permissions to manifest and update app = NOT WORK
  4. Add org.gtk.vfs.* and xdg-run/gvfsd permissions to manifest and clean reinstall app = WORKS!!!

Also with 4 when I remove back those permissions, it immediately stops working. So it seems like there is some cache/config file involved somewhere that makes adding those permissions not immediately take effect.

I will add those permissions to Flathub version with the next update then, since they fix this issue on at least my side of things and seem to be recommended nowadays anyway.

Also, this is slightly unrelated, but if I were you, I wouldn't use GVFS for this. Its VERY SLOW and buggy (see: https://gitlab.gnome.org/GNOME/gvfs/-/issues/292). Consider using manual fstab mount instead (just remember to also add nofail option so boot can continue on error), this should not only avoid all kinds of permissions issues, but also make file transfer and seeking much faster. Just be very careful if you decide to edit fstab file :smile:

prog-amateur2 commented 2 years ago

Thank a lot for your testing. If I understood correctly, I have to wait for the next version of Clapper to take the updated manifest into account, right?

About cifs, after reading a little bit about it (and thank you for your above link), I have found that credentials shall be either on the fstab file itself or in a separate file with chmod 600, but still in plain text, therefore, I am afraid to use this method in a security point of view.

Rafostar commented 2 years ago

I did a throughout investigation of what changed and how it works now (on at least my side of things, hoping that this is the same issue).

So by making this app DBusActivatable (changed in 0.5.0 Clapper version) we now automatically talk with GVFS over D-BUS, which in case of Flatpak fails due to missing org.gtk.vfs.* and xdg-run/gvfsd permissions.

As described in https://docs.flatpak.org/en/latest/sandbox-permissions.html#gvfs-access the old method is something that "legacy applications can use" while new method uses "URLs rather than FUSE paths". This means that file will be read using giosrc element rather than filesrc (unlike we normally do). And looking at giosrc URI handler, I can see that it fails to detect SFTP, SMB, etc. URIs support due to missing permissions during init. This is the place where it is cached and why it doesn't work even after overriding permissions manually.

@prog-amateur2

Please try doing the 3 flatpak override commands I written in previous comment AND afterwards remove GStreamer registry cache file inside ~/.var/app/com.github.rafostar.Clapper/cache/gstreamer-1.0 directory (will be recreated on next Clapper launch). Afterwards start Clapper by opening some samba share file. See if it works now.

in a separate file with chmod 600, but still in plain text, therefore, I am afraid to use this method in a security point of view.

The point of being 600 chmod is that nobody without being logged in as root (thus entering root password to sudo) cannot read it. So basically your root password guards contents of this plain file.

prog-amateur2 commented 2 years ago

Congratulations, it works, that's what I can call a problem solving ! Do you think that, because I manually removed the GStreamer cache, I have to do some manipulations after the next Clapper update or is everything supposed to be fine without my intervention? By the way, if you agree, we can happily close this issue if you think the problem is solved (on my side, I think so).

Again a big thanks for your kind support and constructive way of helping people. Clapper shall be the main Gnome movie reader in my opinion because it is so pleasant to use and has a very ergonomic and beautiful interface.. and a very cool developer !

Rafostar commented 2 years ago

By the way, if you agree, we can happily close this issue if you think the problem is solved (on my side, I think so).

Please do not close this, otherwise I might forget to update manifest file on Flathub.

because I manually removed the GStreamer cache (...) fine without my intervention

This file is recreated when Clapper is launched next time and overwritten every time when it determines something changed (e.g. on update). So no need. Changes to permissions can always be restored with:

sudo flatpak override --reset com.github.rafostar.Clapper

But only after we update manifest, otherwise it will remove what you added now :smile:

prog-amateur2 commented 2 years ago

Thank you, then I keep the issue open ! I think the subtitle issue is related to yt-dlp (if you know this, also, wonderful program), so I have to investigate on this side, please do not take into account my previous information about subtitles issues.

Rafostar commented 2 years ago

yt-dlp (if you know this, also, wonderful program)

Flatpak version of Clapper can actually stream YouTube videos (with adaptive streaming). We do not use yt-dlp there through, but something slightly different, that better suits this player needs.

For any other eventual problems with Clapper, please open a separate issues on github. If unsure or have some questions, then feel free to ask on Clapper player matrix channel. This problem here (with samba share) I consider figured out and will be closed when Flathub version is updated with necessary permissions set by default.

frandavid100 commented 2 years ago

I have noticed that Clapper fails to play files on my local network, accessed through SSH. Could it be the same issue?

Rafostar commented 2 years ago

I have noticed that Clapper fails to play files on my local network, accessed through SSH. Could it be the same issue?

All types of mounts done through GVFS are affected. As mentioned in this issue earlier, I was using SFTP to reproduce the problem.

frandavid100 commented 2 years ago

All types of mounts done through GVFS are affected.

I'm confused then. Is the problem supposed to be fixed? How come I'm still getting it, if I'm using 0.5.1?

Rafostar commented 2 years ago

@frandavid100

Usually non-closed issue is an indication that problem is not yet fixed, no? :smile: I was very busy last week. Will do a 0.5.2 patch version release this week with a fix for this included.

frandavid100 commented 2 years ago

My mistake then. Eagerly waiting for that patch 😀

Rafostar commented 2 years ago

Should be fixed as part of 0.5.2 Flatpak version update. Update was pushed to Flathub and should roll out to users within next few hours.