SynoCommunity / spksrc

Cross compilation framework to create native packages for the Synology's NAS
https://synocommunity.com
Other
2.98k stars 1.22k forks source link

Sonarr v3 + Mono SSL Issues #5798

Closed sthewissen closed 12 months ago

sthewissen commented 1 year ago

Is this a new Bug?

Package Name

Sonarr v3 / Mono

Package Version

Sonarr 20230217-22 / Mono v6.12.0.182-20

Device Model

DS211

Device Architecture

88f628x

Firmware Version

DSM 6.2.4-25556 Update 7

What happened?

I want to install Sonarr v3 on my Synology. Both Mono and Sonarr v3 install just fine. However, when I want to do anything in Sonarr (be it searching for a show, getting something from a crawler etc.) I get the following SSL error in the logs:

image

A common problem, that I find is mostly solved through the workarounds mentioned here https://github.com/SynoCommunity/spksrc/issues/5051 namely:

  1. Running sudo /var/packages/mono/target/bin/cert-sync /etc/ssl/certs/ca-certificates.crt
  2. Running sudo chmod -R a+rX /usr/share/.mono

Running the first one of these on my NAS however crashes immediately:

image

I'm kind of lost on what I could do to get this issue resolved and was hoping someone here could share some insights. These are clean installs of both Sonarr and Mono.

Reproduction steps

  1. Install latest Sonarr v3 and Mono packages mentioned above.
  2. Search for a show in Sonarr.
  3. Check Sonarr logs to find the error mentioned.

Install Log

See attached log.

Service Log

No response

Other Logs

No response

Known workaround

Mono versions newer than 5.10.1.38 have a known compatibility issue with 88f628x architectures. Using version 5.8.0.108 resolved this issue.

sthewissen commented 1 year ago

Please find attached the log; mono.log

hgy59 commented 1 year ago

@sthewissen the arch of DSM211 is not x86_64. It is 88f6281 (i.e. ARMv5).

I suppose that mono is not supported on this old device.

mreid-tt commented 1 year ago

Based on the mono log, it seems that the certificates were imported successfully under version 5.8.0.108-11. @hgy59 perhaps using an older mono may work?

EDIT: @sthewissen, when you were running mono v5.8.0.108 on 2023/06/29 19:46:23, did Sonarr v3 work correctly? If so you can manually downgrade to this version as a workaround.

EDIT: There may have been some previous workarounds noted in https://github.com/mono/mono/issues/12537 with ARMv5 (for v5.10.1.38 and newer based on the releases). @hgy59 are these incorporated already for 88f6281? (it may be there as this came up in https://github.com/SynoCommunity/spksrc/pull/3803#issuecomment-729238160)

sthewissen commented 1 year ago

What you're essentially seeing is me trying to install all the 3 available Mono packages for my machine and seeing if Sonarr works with them @mreid-tt

mreid-tt commented 1 year ago

Okay, thanks for the clarification. Can we see the sonarr.log as well to better understand why it wasn't booting?

EDIT: Can confirm from the mono install log you supplied that the postinstall script didn't complete for 5.20.1.34-19 and 6.12.0.182-20 as both reported crashes on population of the certificate store.

sthewissen commented 1 year ago

Assuming it's the one attached here nzbdrone.log

mreid-tt commented 1 year ago

From what I can see regarding the mono 5.8.0.108-11 and Sonarr v3 combination, you completed the install of mono 5.8.0.108-11 on 2023/06/29 19:46:50 and sonarr v3 on 2023/06/29 19:53:53 with another startup attempt on 2023/06/29 19:57:47. What I'd really like to see is the service log for Sonarr (and mono) during that time.

Service logs are typically stored in /var/packages/{package}/var/{package}.log.

sthewissen commented 1 year ago

Here we go service.nzbdrone.log

mreid-tt commented 1 year ago

Thanks for that. Unfortunately, the log only goes as far back as Jun 30 12:03:02 CEST 2023. In this log it shows mono-6.12.0.182. Ideally you would need to go back to mono 5.8.0.108-11 and get a new log for me to look at. As an alternative (rather than going backward), if you are comfortable with terminal we can try moving forward.

In looking at the current code, @hgy59 already has included a workaround for ARM v5:

https://github.com/SynoCommunity/spksrc/blob/333736b5089b3beea91dde912989b9052bad17b9/spk/sonarr3/src/service-setup.sh#L18-L21

As you can see, there are already the -aot and -float32 environment options configured. What I'd like to try are two other options referenced in the original mono issue as possible workarounds. For the first test, you can open the file /var/packages/nzbdrone/scripts/service-setup. In it you should find a line like this:

MONO="MONO_ENV_OPTIONS='-O=-aot,-float32' ${MONO}"

You can change it to:

MONO="MONO_ENV_OPTIONS='-O=-aot,-float32,-inline' ${MONO}"

Start Sonarr v3 and see if anything changes. If it does not, you can change the same line to the following and try again:

MONO="MONO_ENV_OPTIONS='-O=-all' ${MONO}"

EDIT: Now that I think on this some more I realise that even if this does work, the certificate store in mono may not be populated. @hgy59 is there a way to use environment variables with cert-sync to get the initial setup correct?

sthewissen commented 1 year ago

Here's what I did;

Result: SSL issue below

Result: SSL issue below

[v3.0.9.1549] System.Net.WebException: Error: TrustFailure (Authentication failed, see inner exception.): 'https://skyhook.sonarr.tv/v1/tvdb/search/en/?term=bl' ---> System.Net.WebException: Error: TrustFailure (Authentication failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
  at /spksrc/spk/mono/work-88f6281-6.1/mono-6.12.0.182/external/boringssl/ssl/handshake_client.c:1132

I'm happy to try completely uninstall and try the oldest mono one + Sonarr to see if the logs shed any light on it not booting.

mreid-tt commented 1 year ago

Thanks for the update. As I suspected the CERTIFICATE_VERIFY_FAILED errors are likely happening because the initial setup of mono failed to populate the certificate store. In the log you supplied we observed crashes with the postinstall for mono 5.20.1.34-19 and 6.12.0.182-20.

If you're game a fresh install of mono 5.8.0.108-11 and Sonarr v3 20230217-22 would be a great way to get additional insight from the service logs.

sthewissen commented 1 year ago

Did two clean installs of the versions you mention. Sonarr claims it's running, but it at the very least isn't reachable.

mono.install.log nzbdrone.install.log nzbdrone.service.log

mreid-tt commented 1 year ago

From the logs you supplied things look good. Remember that when Sonarr is first installed it has to setup the database and install the latest updates. From the service log it seems that it was doing this successfully. During this time however the web interface will not be available and the app may appear down. As in the install screen messages, give it a few minutes before you try to open the web interface.

mreid-tt commented 1 year ago

@sthewissen, did Sonarr v3 eventually settle down with the web interface becoming available?

sthewissen commented 1 year ago

Apparently, my patience was the main issue on that oldest version of Mono /w the Sonarrv3 package, it took its time but eventually got there. I probably won't be installing any of the upgrades anytime soon, but it's something! 😅

mreid-tt commented 1 year ago

Thank you for providing us with your valuable feedback. We sincerely appreciate the insights gained from your testing, particularly regarding the incompatibility of mono with 88f628x architectures.

@hgy59, considering that the issue has not been adequately addressed for 88f628x, it would be prudent to remove the builds for versions 5.20.1.34-19 and 6.12.0.182-20. This proactive measure will effectively safeguard other users from encountering the same problem in the future.

sly433 commented 12 months ago

Having the same problem on my 920+ running Mono 6.12.0.182-20 and DSM 7.2-64570 Update 1, sonar & radar cannot connect to my Jackett indexer even though Jackett can successfully test all indexers...

hgy59 commented 12 months ago

@hgy59, considering that the issue has not been adequately addressed for 88f628x, it would be prudent to remove the builds for versions 5.20.1.34-19 and 6.12.0.182-20. This proactive measure will effectively safeguard other users from encountering the same problem in the future.

=> done.

hgy59 commented 12 months ago

Having the same problem on my 920+ running Mono 6.12.0.182-20 and DSM 7.2-64570 Update 1, sonar & radar cannot connect to my Jackett indexer even though Jackett can successfully test all indexers...

@sly433 This is a different problem as it is related only to ARMv5 (88f628x) archs and DS-920+ is x64 (apollolake). Please open a new issue and provide detailed (log) information.

mreid-tt commented 12 months ago

@sthewissen, as we have worked around the problem by removing 88f628x builds (newer than v5.8.0.108-11) from download, we will be closing this issue.