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

profiles: anki: fix opening, allow media & add to firecfg #6545

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

haplo
Copy link
Contributor

@haplo haplo commented Nov 12, 2024

Anki relies on mpv and mplayer for playing audio and video files.

If mpv is present in the system but not allowed in firejail then Anki fails to start because mpv permissions won't allow for execution.

Fixes #6544.

@kmk3 kmk3 changed the title Profiles: anki: allow mpv and mplayer profiles: anki: allow mpv and mplayer Nov 12, 2024
@haplo
Copy link
Contributor Author

haplo commented Nov 14, 2024

@kmk3 I pushed some commits, but Github is not displaying them for some reason.

@rusty-snake
Copy link
Collaborator

processing updates

@rusty-snake
Copy link
Collaborator

Maybe try to pull and force-push.

@haplo
Copy link
Contributor Author

haplo commented Nov 14, 2024

Maybe try to pull and force-push.

That worked.

I enabled anki in firecfg, because it should now work with the default profile. Is that OK?

Without this change, Anki fails to start.

Fixes netblue30#6544.
@kmk3 kmk3 force-pushed the anki-mpv-lua branch 2 times, most recently from 42e96be to 07568f5 Compare November 19, 2024 16:53
@kmk3 kmk3 changed the title profiles: anki: allow mpv and mplayer profiles: anki: fix opening, allow media & add to firecfg Nov 19, 2024
kmk3 and others added 4 commits November 19, 2024 14:44
Anki relies on mpv/mplayer for playing audio and video files.
Anki uses mpv to play media, which requires the lua interpreter.

Without this, anki displays this error in the console and falls back to
mplayer:

    mpv: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: Permission denied
    Traceback (most recent call last):
    File "/usr/lib/python3.12/site-packages/aqt/sound.py", line 854, in setup_audio
    mpvManager = MpvManager(base_folder, media_folder)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/site-packages/aqt/sound.py", line 408, in __init__
    super().__init__(window_id=None, debug=False)
    File "/usr/lib/python3.12/site-packages/aqt/mpv.py", line 442, in __init__
    super().__init__(*args, **kwargs)
    File "/usr/lib/python3.12/site-packages/aqt/mpv.py", line 104, in __init__
    self._start_socket()
    File "/usr/lib/python3.12/site-packages/aqt/mpv.py", line 194, in _start_socket
    raise MPVProcessError("unable to start process")
    aqt.mpv.MPVProcessError: unable to start process

    mpv too old or failed to open, reverting to mplayer
Anki needs sound access for recording and playing media.
@kmk3 kmk3 merged commit d3f6858 into netblue30:master Nov 19, 2024
8 checks passed
kmk3 added a commit to kmk3/firejail that referenced this pull request Nov 25, 2024
mpv crashes if luajit is blocked:

    $ firejail --quiet --noprofile \
      --include=/etc/firejail/disable-interpreters.inc /usr/bin/mpv
    /usr/bin/mpv: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: Permission denied

So make sure that allow-lua.inc is always included when mpv paths (such
as ~/.config/mpv) are allowed.

Environment: luajit 2.1.1727870382-1, mpv 1:0.39.0-3 on Artix Linux.

Related commits:

* db2bdaa ("add lua support for mpv (netblue30#3243)", 2020-02-24) /
  PR netblue30#3243
* d6a6fb9 ("Allow Lua for mpv in dolphin.profile", 2020-04-18) /
  issue netblue30#3363
* f3585e5 ("fixes, closes, enhances, improvements, and so on",
  2020-11-09) /
  issue netblue30#3686
* 3ec523f ("profiles: anki: allow lua", 2024-11-14) /
  PR netblue30#6545
kmk3 added a commit that referenced this pull request Nov 29, 2024
mpv crashes if luajit is blocked:

    $ firejail --quiet --noprofile \
      --include=/etc/firejail/disable-interpreters.inc /usr/bin/mpv
    /usr/bin/mpv: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: Permission denied

So make sure that allow-lua.inc is always included when mpv paths (such
as ~/.config/mpv) are allowed.

Environment: luajit 2.1.1727870382-1, mpv 1:0.39.0-3 on Artix Linux.

Related commits:

* db2bdaa ("add lua support for mpv (#3243)", 2020-02-24) /
  PR #3243
* d6a6fb9 ("Allow Lua for mpv in dolphin.profile", 2020-04-18) /
  issue #3363
* f3585e5 ("fixes, closes, enhances, improvements, and so on",
  2020-11-09) /
  issue #3686
* 3ec523f ("profiles: anki: allow lua", 2024-11-14) /
  PR #6545
kmk3 added a commit that referenced this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (on RELNOTES)
Development

Successfully merging this pull request may close these issues.

anki: program fails to open because it requires mpv
3 participants