FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Linux - flatpak version throws an exception instead of opening mpv

Open kajdo opened this issue 4 years ago • 14 comments

Behavior of the program Using the new version (supporting external players), "open in external player" throws an exception:

Error: spawn /usr/bin/mpv ENOENT

mpv is available using that path

which mpv
/usr/bin/mpv

Expected behavior mpv opening up and playing the video

To Reproduce

  1. install flatpak version of FreeTube
  2. Go to any video
  3. Click on open external player
  4. See error

Environment Information (please complete the following information):

  • OS: PopOS!
  • OS Version: Linux pop-os 5.11.0-7633-generic #35163010093021.04~ae2753e-Ubuntu SMP Mon Aug 30 18:26:54 UTC x86_64 x86_64 x86_64 GNU/Linux
  • FreeTube version: 0.14.0 beta
  • Installation Method (If applicable): FlatHub
  • Primary API Used: Local API

Additional context installed the AppImage and the issue is gone -- i guess it's related to the "sandboxing" of flatpak apps

kajdo avatar Sep 22 '21 12:09 kajdo

I was investigating this because I saw this exception and arrived at this open issue Maybe it could be solved by using flatpak-spawn --host mpv (instead of spawn) on the flatpak builds? It seems to be the way to execute commands on host from a flatpak app

repparw avatar Nov 18 '21 05:11 repparw

I have the same issue on the Flatpak version. Throws the error no matter what player or path we use.

lurkynerd avatar Jan 02 '22 18:01 lurkynerd

@repparw was on the right track: it is possible to use mpv right now by using "flatpak-spawn". This is what you need to do:

  1. Go to "Setting" --> "External Player Setting"
  2. Set "External Player" to "mpv"
  3. Set "Custom External Player Executable" to "flatpak-spawn" (without the quotes)
  4. Set "Custom External Player Arguments" to "--host;/usr/bin/mpv" (without the quotes and without spaces... notice there is a ";" between the two words).

2022-02-03_23-33

That's it :)

PS: Maybe this should be added as an option in the "drop-down" menu (ex: "mpv inside flatpak") or, at least, somewhere in the documentation.

greenfoo avatar Feb 03 '22 22:02 greenfoo

@repparw was on the right track: it is possible to use mpv right now by using "flatpak-spawn". This is what you need to do:

1. Go to "Setting" --> "External Player Setting"

2. Set "External Player" to "mpv"

3. Set "Custom External Player Executable" to "**flatpak-spawn**" (without the quotes)

4. Set "Custom External Player Arguments" to "**--host;/usr/bin/mpv**" (without the quotes and without spaces... notice there is a ";" between the two words).

2022-02-03_23-33

That's it :)

PS: Maybe this should be added as an option in the "drop-down" menu (ex: "mpv inside flatpak") or, at least, somewhere in the documentation.

This worked for me, much appreciated!

dinotheextinct avatar Feb 04 '22 08:02 dinotheextinct

I was having a similar issue, but with launching the mpv flatpak (rather than the binary), this is the solution that got it working: image

DEFCON001 avatar May 31 '22 05:05 DEFCON001

Suddenly it doesn't work for my flatpak version any longer. I also installed through appimage and it works without any problems there. image

dinotheextinct avatar Aug 05 '22 19:08 dinotheextinct

@dinotheextinct can you send the output of "flatpak info --show-permissions io.mpv.Mpv" I doubt this is a permissions issue but I wanna check it has dbus access first as I have no idea what could also cause the appimage to break.

DEFCON001 avatar Aug 05 '22 20:08 DEFCON001

flatpak info --show-permissions io.mpv.Mpv  ✔  22:12:05  error: io.mpv.Mpv/*unspecified*/*unspecified* not installed

dinotheextinct avatar Aug 05 '22 20:08 dinotheextinct

Sorry I meant "io.freetubeapp.FreeTube" instead of "io.mpv.Mpv", please run the same command but with the freetube name above, and send the output.

DEFCON001 avatar Aug 05 '22 20:08 DEFCON001

` ~  flatpak info --show-permissions io.freetubeapp.FreeTube  ✔  22:18:00  [Context] shared=network;ipc; sockets=x11;pulseaudio; devices=dri; filesystems=xdg-download;

[Session Bus Policy] org.gnome.SessionManager=talk org.freedesktop.ScreenSaver=talk org.mpris.MediaPlayer2.freetube=own org.gnome.SettingsDaemon=talk org.freedesktop.PowerManagement=talk org.mpris.MediaPlayer2.chromium.*=own

[Environment] TZ=UTC`

dinotheextinct avatar Aug 05 '22 20:08 dinotheextinct

Okay I see how to fix this, for some reason the flatpak freetube ppl (or it might just be a part of the update process) pushed out a change that disabled part of the dbus permission called "session-bus", you can enable it in the cli but its a bit messy and it would be better practice to get some experience with Flatseal. Flatseal is a GUI app that lets you modify the permissions a flatpak has, like camera access, files, ect. You can install it with: flatpak install flathub com.github.tchx84.Flatseal (https://flathub.org/apps/details/com.github.tchx84.Flatseal). Once you have installed it, run the application, go to FreeTube on the left column, click it, then find the permission:

  • D-Bus session bus (don't be confused with D-Bus system bus which is next to it)

Toggle that on with the switch, then close Flatseal, and close FreeTube if it is still running, when you re-open FreeTube, it should work again.

Flatseal lets you manipulate the permission of apps in a bit more detail than say macOS, so feel free to change values about and experiment, you can always reset things with the "Reset" button in the bottom right to reset them back to the standard install, however if you do that you will have to re-enable the D-Bus session bus again.

For some extra info, dbus stuff usually involves letting the flatpak interact with other programs in the system, and either of the two commands is required for "flatpak-spawn" to work. Either permission works, but from my understanding the session bus one is a lower permission than system bus, so its better to just enable that one for security reasons. Also for a permission change to take effect, the program needs to be launched after the toggle has been switched, that's why we closed FreeTube and re-opened it.

DEFCON001 avatar Aug 05 '22 23:08 DEFCON001

Also yep, it was them: https://github.com/flathub/io.freetubeapp.FreeTube/commit/0b495c9924feffa8c6771270610f0d3a8384e983 I'll see if I can get them to add a special permission for the mpv binary itself, but I doubt I could convince them to let it have access to all flatpaks in the system for the situation when mpv is a flatpak.

DEFCON001 avatar Aug 05 '22 23:08 DEFCON001

I've made this issue to see if it can be fixed by default, if anyone knows the dbus bus name for mpv, please comment it there, as I can't find it online or on my system. https://github.com/flathub/io.freetubeapp.FreeTube/issues/74#issue-1330591179

DEFCON001 avatar Aug 06 '22 00:08 DEFCON001

Configuring the external player settings as described by @greenfoo and then adding D-Bus session permission as described by @DEFCON001 solved it for me.

PolGZ avatar Sep 03 '22 00:09 PolGZ

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 30 '22 02:10 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 29 '22 02:11 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 28 '22 01:12 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jan 26 '23 01:01 github-actions[bot]

Is this now fixed? Because appimage doesnt work with external mpv either anymore for me.

dinotheextinct avatar Feb 18 '23 07:02 dinotheextinct

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Mar 19 '23 02:03 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 17 '23 01:04 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 16 '23 01:05 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 14 '23 01:06 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 13 '23 02:07 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 11 '23 01:08 github-actions[bot]

I'm going to close this issue because there is an open issue in the flathub repo and needs to be addressed over there. You are free to take the discussions over there or keep it here.

https://github.com/flathub/io.freetubeapp.FreeTube/issues/74

here is working solution.

(install mpv flatpak version)

launch freetube like this: flatpak run --talk-name=io.mpv.Mpv io.freetubeapp.FreeTube

add these settings: custom external player executable: flatpak-spawn custom external player arguments: --host;flatpak;run;io.mpv.Mpv

user3534 avatar Jan 17 '24 01:01 user3534