Plugin connectivity issue

Currently reading
Plugin connectivity issue

4
0
Hello everyone.

I have been going in circles to try to resolve this but nothing seems to work. I've read all that I can find about people facing the same situation but none of the suggestions have worked for me. I've tried changing the DNS settings, NTP settings, I've tried resolving IPv4 first, disabling IPv6, I've tried regenerating the NAS certificate... I don't think there is anything I have not tried. I have even used a switch with port mirroring to capture the NAS network communication using Wireshark and what I realized is that... the problem is anything but connectivity!

On the TMDB API key form, the test function returns successful validation, and when I look at the Wireshark traffic there is indeed a DNS query and then active communication with api.themoviedb.org. Then I use the test function in the plugin list and the connection fails, moreover there is absolutely no communication with the internet, just an exchange between the NAS and the user browser saying that the test failed. The same case happened when I tried to install a 3rd-party metadata plugin in VideoStation, it says there is no internet connectivity... which is false, and again, Wireshark shows that there was no attempt to communicate outside the local network.

Taking this a bit further, using SSH to test either the default TMDB plugin (or a third-party plugin dropped through SCP) works fine in the terminal, meaning that a perfect JSON response is received with all the expected metadata. So, my question at the moment is why Synology's VideoStation seemingly invents connectivity issues where there are none, and if there is anything that can be done about it? I assume that the issue must be at the binary level of VideoStation itself so I'm not getting my hopes up.
 
Welcome to the forum.

To summarise in reverse:
You’re having problems with Synology’s TMDB metadata plug-in, whereby it says in the Video Station web interface that the test connection fails. But when you invoke the plug-in from the SSH command line it works successfully.​
Plus you’ve tried lots of things in the NAS’s network setting and they didn’t fix it.​
What NAS are you using and versions of DSM, and Video Station? Do you have multiple LAN ports on the NAS?
 
Welcome to the forum.
Thank you.

I think I was so frustrated with the whole issue that I ended up leaving the most important detail out. I'm running DSM on a virtual machine, so there is no official support. In theory, that could be the reason for it not to work, even when using a valid serial # and MAC from a real Synology NAS and a valid Synology account.

I use a bootloader that allows to install DSM on both virtual machines or regular PCs (depending on the CPU). In this instance the system is configured as a DS920+ with the latest firmware. In practice, almost every package I have installed runs and works perfectly, even VideoStation does with this exception of running VideoStation plugins, either pre-packaged or 3rd party.

Since my initial post, I gathered more information from both DSM logs in general and the serial console (kernel) output.

Serial console
Code:
[  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
Code:
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

Before this information I thought maybe there could be something else I could try, but now I just think that something is not patched properly at runtime and so this falls into a weird category where only those whith a deeper knowledge of Linux, DSM intricacies and apparmor in particular. There should be no reason for /usr/sbin/sed to be denied execution within the context of VideoStation, but it clearly is so... yeah, seems I hit a dead end with this.
 
OK. I haven't run Video Station in virtual DSM. I was wondering if you invoked the plugin on command line running as the VideoStation user: it's something like that and probably what the Video Station* web engine is using to access system resources.

Tagging, even when the plug-in works, is more painful in Video Station than in Plex, which is one reason I use Plex now.

*VS long-hand since it could also be read as Virtual Server.
 
I am not quite sure how to run the plugin impersonating VideoStation, all I know is that with root privileges it works in the terminal.

This is the plugin tester:
Code:
/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

This is the actual request that would be run, if the plugin tester didn't fail when ran from the WebUI:
Code:
/bin/env HOME=/ SHELL=/bin/false /bin/bash -p /var/packages/VideoStation/target/plugins/syno_themoviedb/loader.sh --type movie --lang enu --input "{\"original_available\":\"2001-11-16\",\"title\":\"Harry Potter\"}" --limit 1 --apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
Might work with su --command "my command" VideoStation or sudo su --command "my command" VideoStation. Replacing "my command" with what you want running as VideoStation user, and suitably escaped and quoted. I've not tried it, and you seem to have experience to work this out :)
 
Nothing seemed to work after countless attempts, eventually this seems to have done the trick:

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

1. Backup 'constant.py' script:
Bash:
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:
Bash:
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):
Bash:
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/':
Bash:
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:
Bash:
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.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top