pocopico / tinycore-redpill

GNU General Public License v3.0
2.13k stars 631 forks source link

plugin_runner.cpp:82 Failed to execute plugin runner | "/usr/sbin/sed" denied exec/open #397

Closed ner00 closed 1 month ago

ner00 commented 1 month ago

Describe the bug VideoStation plugins do not work, and it is not a connectivity issue.

To Reproduce Open VideoStation, goto Settings > Video Info Plugin > Test Connection

Expected behavior VideoStation should be able to communicate, but it fails before it can.

Screenshots image

Desktop (please complete the following information):

Additional context

Serial console

[  143.799058] audit: type=1400 audit(1715530151.021:2): apparmor="DENIED" operation="exec" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15874 comm="bash" requested_mask="x" denied_mask="x" fsuid=228233 ouid=0
[  143.803147] audit: type=1400 audit(1715530151.025:3): apparmor="DENIED" operation="open" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15874 comm="bash" requested_mask="r" denied_mask="r" fsuid=228233 ouid=0
[  143.810459] audit: type=1400 audit(1715530151.032:4): apparmor="DENIED" operation="exec" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15879 comm="bash" requested_mask="x" denied_mask="x" fsuid=228233 ouid=0
[  143.814240] audit: type=1400 audit(1715530151.036:5): apparmor="DENIED" operation="open" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15879 comm="bash" requested_mask="r" denied_mask="r" fsuid=228233 ouid=0
[  143.820832] audit: type=1400 audit(1715530151.043:6): apparmor="DENIED" operation="exec" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15884 comm="bash" requested_mask="x" denied_mask="x" fsuid=228233 ouid=0
[  143.825004] audit: type=1400 audit(1715530151.047:7): apparmor="DENIED" operation="open" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15884 comm="bash" requested_mask="r" denied_mask="r" fsuid=228233 ouid=0
[  143.831772] audit: type=1400 audit(1715530151.054:8): apparmor="DENIED" operation="exec" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15889 comm="bash" requested_mask="x" denied_mask="x" fsuid=228233 ouid=0
[  143.835655] audit: type=1400 audit(1715530151.057:9): apparmor="DENIED" operation="open" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15889 comm="bash" requested_mask="r" denied_mask="r" fsuid=228233 ouid=0
[  143.843663] audit: type=1400 audit(1715530151.065:10): apparmor="DENIED" operation="exec" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15894 comm="bash" requested_mask="x" denied_mask="x" fsuid=228233 ouid=0
[  143.847538] audit: type=1400 audit(1715530151.069:11): apparmor="DENIED" operation="open" profile="videostation_default_plugin" name="/usr/sbin/sed" pid=15894 comm="bash" requested_mask="r" denied_mask="r" fsuid=228233 ouid=0

/var/log/messages

2024-05-12T17:09:11+01:00 VM-NAS plugin_runner[15868]: plugin_runner.cpp:82 Failed to execute plugin runner: /bin/env HOME=/ SHELL=/bin/false /bin/bash -p /var/packages/VideoStation/target/plugins/syno_plugin_tester/loader.sh --type movie --lang enu --input {"original_available":"2001-11-16","title":"Harry Potter"}
 --limit 1 --apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --path /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh --pluginid com.synology.TheMovieDb
2024-05-12T17:09:11+01:00 VM-NAS plugin_runner[15943]: plugin_runner.cpp:82 Failed to execute plugin runner: /bin/env HOME=/ SHELL=/bin/false /bin/bash -p /var/packages/VideoStation/target/plugins/syno_plugin_tester/loader.sh --type tvshow --lang enu --input {"original_available":"2011-04-17","title":"Game of Thrones"}
 --limit 1 --apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --path /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh --pluginid com.synology.TheMovieDb
ner00 commented 1 month ago

I was able to find a workaround, this might help those using VideoStation on non-official as well as official Synology systems:

Start by connecting through SSH, then run the commands below:

1. Backup 'constant.py' script:

sudo cp /var/packages/VideoStation/target/plugins/syno_themoviedb/constant.py /var/packages/VideoStation/target/plugins/syno_themoviedb/constant.py.bak
sudo chmod 644 /var/packages/VideoStation/target/plugins/syno_themoviedb/constant.py.bak
sudo chown VideoStation:VideoStation /var/packages/VideoStation/target/plugins/syno_themoviedb/constant.py.bak

2. Backup 'loader.sh' script:

sudo cp /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh.bak
sudo chmod 644 /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh.bak
sudo chown VideoStation:VideoStation /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh.bak

3. Inject your TMDB API key into 'constant.py' script (replace xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx with your own key):

sudo sed -i "s/DEFAULT_APIKEY = ''/DEFAULT_APIKEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'/g" /var/packages/VideoStation/target/plugins/syno_themoviedb/constant.py

4. Force VideoStation to use 'sed' from '/usr/bin/' instead of '/usr/sbin/':

sudo sed -i "s/ sed \"/ \/usr\/bin\/sed \"/g" /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh

This should make TMDB plugin start working properly, regardless of the "Test Connection" failure in the Video Info Plugin settings page.

If at any point you need to go back, either uninstall/reinstall VideoStation or just restore from the backup files by doing:

sudo cp /var/packages/VideoStation/target/plugins/syno_themoviedb/constant.py.bak /var/packages/VideoStation/target/plugins/syno_themoviedb/constant.py
sudo cp /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh.bak /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh

Note: When uninstalling VideoStation you have the possibility to check a box, that checkbox decides if you want to wipe the VideoStation metadata database or not. If you haven't fetched any metadata, you should check that box to start from a clean slate.