michealespinola / syno.plexupdate

A script to automagically update Plex Media Server on Synology NAS
GNU General Public License v3.0
273 stars 23 forks source link

Architecture missing or incorrect in Plex JSON #7

Closed Med1Q closed 2 years ago

Med1Q commented 3 years ago

The update script fails on the DS116 but I think I narrowed down the issue. The script failed on

INSTALLING NEW PACKAGE:
----------------------------------------
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.

 * Package download failed, skipping install...

While investigating I found out that ArchFamily is set to armv7l on the DS116, while this architecture is not present in the Plex JSON file. The Plex build needed is the armv7hf_neon one.

Since there is no Plex update at the moment I cannot confirm yet if hard coding ArchFamily to armv7hf_neon resolves the issues.

michealespinola commented 3 years ago

This script is written to follow whatever Plex considers supportable by way of the data collected in the JSON, and processed exclusively against that dataset. With that in consideration, this could be a mistake or it could be an intentional exclusion on behalf of Plex.

Because it's exclusively a JSON issue, this needs to be addressed with Plex support and is outside of the scope of this script.

Based on past discussions with Plex employees, that they do not seem to consider all platforms supportable, even if they can technically run PMS - so this may be an intentional exclusion from the JSON dataset.

LearnDriver commented 3 years ago

I had the same issue. My DS414 stopped with the same error. uname -m also returns armv7l for me.

However, according to the Plex downloads site I need ARMv7 (x13 Series, x14 Series (excluding DS414j), DS115j, RS815, and DS216se) which is armv7hf instead of armv7hf_neon @Med1Q needs for the DS116.

So the way I interpret the Plex Downloads site (https://www.plex.tv/nl/media-server-downloads/) both Synologies are officially supported by Plex.

What can be done perhaps is to make a mapping based on the device model when armv7 is detected.

I did a quick Google search, and happened to find this project (https://github.com/cowboy/synology-update-plex/) which does exactly that.

However, I like that this script auto updates etc., so would it be possible to add the same mapping to this script?

function get_arch() {
  local arch machine=$1 hw_version=$2
  if [[ "$machine" =~ armv7 ]]; then
    declare -A model_machine_map
    model_machine_map[DS414j]=armv7hf_neon
    model_machine_map[DS115j]=armv7hf
    model_machine_map[RS815]=armv7hf
    model_machine_map[DS216se]=armv7hf
    model_machine_map[DS215jv10-j]=armv7hf_neon
    if [[ "${model_machine_map[$hw_version]+_}" ]]; then
      arch=${model_machine_map[$hw_version]}
    elif [[ "${hw_version//[^0-9]/}" =~ 1[5-8]$ ]]; then
      arch=armv7hf_neon
    else
      arch=armv7hf
    fi
  elif [[ "$machine" =~ i686 ]]; then
    arch=x86
  else
    arch=$machine
  fi
  echo $arch
}
michealespinola commented 3 years ago

First I have to ask if either of you (@Med1Q, @LearnDriver) have reached out to Plex regarding the exclusions of your devices? Idealy this is the way to properly resolve your issues - particularly if they are devices officially supported by Plex. This could be an oversight on their part.

I intentionally wrote the script to not require static mappings like this. This was to avoid future script maintenance as well as to observe Plex's wishes (per discussions with Plex support) regarding supportability.

That said, I'm willing to look into overrides using similar variables to those located at the top of the script (and will be available as parsed command-line options). Something along the lines of inputting your specific model selection to shim/replace into the download criteria.

But if these devices are officially supported by Plex, it would be ideal for this to be resolved by Plex for multiple reasons.

Med1Q commented 3 years ago

I haven't, since I figured this is a limitation of the different ARMv7 versions and their corresponding Plex Media Server versions. The Plex team also manually guides users to the right version on their own download page by providing two links for ARMv7 and the models in- and excluded for both: ARMv7 (x13 Series, x14 Series (excluding DS414j), DS115j, RS815, and DS216se) --> links to the armv7hf version ARMv7 (x15 Series (excluding DS115j and RS815), x16 Series (excluding DS216se), x17 Series, x18 Series, and DS414j) --> links to the armv7hf_neon version.

Both the DS116 and the DS414 are officially supported by Plex according to the Plex NAS Compatibility spreadsheet and the package page on the Synology website.

Med1Q commented 3 years ago

I've posted on the Plex forums: https://forums.plex.tv/t/synology-different-armv7-versions-and-plex-server-update-via-json/698833

LearnDriver commented 3 years ago

I've been Googling a bit more, but it seems that instead of it being a Plex problem it's more a limitation of the uname command depending on the kernel you are running.

https://stackoverflow.com/questions/29166619/differences-between-arm-versions-armv7-only https://raspberrypi.stackexchange.com/questions/101215/why-raspberry-pi-4b-claims-that-its-processor-is-armv7l-when-in-official-specif https://archlinuxarm.org/forum/viewtopic.php?f=65&t=13994 https://www.raspberrypi.org/forums/viewtopic.php?t=245846

So I don't think this should be solved at the Plex level. Also given that @Med1Q and my Synology both report that they are armv7l, but according to Plex we need two different packages.

But being able to override the architecture would also solve it for me. For now I've just hardcoded the value in the script, but when I turn on autoupdate my change will be gone ofc. So in that sense, I think a command line option would be nice indeed, as that can survive updates.

michealespinola commented 3 years ago

To keep the script and DSM-related setup as simple as possible, I'm now thinking of breaking out customized variables to an .ini file that would not be affected by the self-update process. Do you think that would work equally for you?

Med1Q commented 3 years ago

I guess that will work fine!

michealespinola commented 3 years ago

Great. I've broken out the settings into a separate config.ini file (I wish I had thought of this months ago). With this done, the self-update feature can be fully implemented, and I will publish the v3.0.0 release later today.

I've read the post in the Plex forums, and am waiting to see what their response is before proceeding with a shim/override solution.

LearnDriver commented 3 years ago

Ah great! Awesome that you picked this up so quickly! Seems that the Plex mod who replied has read this discussion as well, as his two suggestions are exactly the same as we're discussing here 😉 So I guess the override is the way to go!

michealespinola commented 3 years ago

Slight delay as I updated the documentation to reflect changes and also incorporated a notification if the config.ini is missing and configured with "default" settings. This has all been tested and will be published this evening.

michealespinola commented 3 years ago

Update: My apologies for letting this go without updating the code on GitHub. I've held off on updating the code while dealing with other Plex update-related issues. I wanted to be certain that the code is not contributing or affected by the other issues I am experiencing. I hadn't realized that 2+ weeks (!!!) had passed, but the other issues are still not resolved.

However, I'm confident that there is no connection between the script and the other Plex-update issue, and I will update the code to v3.0.0 this weekend.

Med1Q commented 3 years ago

No problem, no rush 😉

michealespinola commented 3 years ago

Something has changed on GitHub, specifically in the "releases" area, that has broken the 'new version' scrape. I'm currently working on resolving it.

michealespinola commented 3 years ago

I've updated the code and am doing a limited round of testing. I'm currently trying to determine if I can make a change that will avoid this sort of issue in the future.

michealespinola commented 3 years ago

Changes made, and v3.0.1 has been released. If this checks out for everyone, then I'll start on an architecture override variable.

https://github.com/michealespinola/syno.plexupdate/releases

Med1Q commented 3 years ago

With the ArchFamily manual override in place it seems the v3.0.1 script works fine

morganm00 commented 3 years ago

I downloaded 3.0.2 and ran into this problem on a DS216play. I was able to get it to work wrapping the 'uname -m' call with:

if [ -z "$ArchFamily" ]; then
  ArchFamily=$(uname -m)     
fi

And then setting ArchFamily in config.ini to ArchFamily=armv7hf_neon

michealespinola commented 3 years ago

😀 This is very much along the lines of what I was going to publish as an update. I'm glad that you were able to do it as easily as I anticipated. I'm looking at incorporating a few other tweaks, but I do not see what you did here as causing an issue. Your variable use in config.ini is the same name I am working with, so any future update should not break what you have done on your own here.

jplandry908 commented 3 years ago

Thanks @morganm00 - that IF statement is exactly what I needed. I have a DS715 and used 'ArchFamily=armv7neon' to get mine working.

Med1Q commented 3 years ago

It seems the Plex team renamed the architectures (at least for my DS116) in the JSON file. armv7hf_neon is now called armv7neon

This resulted in the following 'error' which says '* Package download failed, skipping install...' but after that it says 'Update from: 1.23.2.4656 to: 1.23.3.4707 succeeded!' which is incorrect.

SYNO.PLEX UPDATE SCRIPT v3.0.2

         Script: syno.plexupdate.sh v3.0.2
     Script Dir: /volume1/archive/syno.plexupdate
    Running Ver: 3.0.2
     Online Ver: 3.0.2
       Released: 2021-03-31 10:55:38+02:00 (82+ days old)
                 * No new version found.

       Synology: DS116-j (armv7hf_neon), DSM 6.2.4-25556 Update 0
       Plex Dir: /volume1/Plex/Library/Application Support/Plex Media Server
     Plex Token: ---
    Running Ver: 1.23.2.4656
     Online Ver: 1.23.3.4707 (Public Channel)
       Released: 2021-06-16 19:26:18+02:00 (5+ days old)
                 * Newer version found!

    New Package:
    Package Age: 5+ days old (3+ required for install)

INSTALLING NEW PACKAGE:
----------------------------------------
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.

 * Package download failed, skipping install...
----------------------------------------

    Update from: 1.23.2.4656
             to: 1.23.3.4707 succeeded!