Unable to claim server

Server Version#: 1.41.1.9057
Player Version#:
<If providing server logs please do NOT turn on verbose logging, only debug logging should be enabled>
Plex Media Server Logs_2024-11-02_22-35-58.zip (335.0 KB)

Server: Ubuntu 24.04 VM

Hi,
I’ve been running my Plex media server for years with no issues. However, last Sunday 27/10 I suddenly lost access. I followed a guide that instructed me to remove certain properties from Preferences.xml and reclaim the server by tunneling in so the browser would appear to be accessing from the VM itself - which worked, until today. I tried doing the same again, but unsuccessfully.
It seems like my server is no longer able to communicate with plex.tv, but I’m not sure what has changed. Any help would be appreciated!

From your logs,

Nov 02, 2024 22:33:46.694 [125915728194360] DEBUG - [Req#a] Plugin: setting environment variable: 'PYTHONPATH=/usr/lib/plexmediaserver/Resources/Python/python27.zip:/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/site-packages'
Nov 02, 2024 22:33:46.695 [125915728194360] DEBUG - [Req#a] Spawned plug-in com.plexapp.agents.imdb with PID 3259
Nov 02, 2024 22:33:46.695 [125915728194360] DEBUG - [Req#a] [com.plexapp.agents.imdb] Sending command: GET /:/prefixes
Nov 02, 2024 22:33:46.782 [125915824663352] WARN - [HttpClient/HCl#6] HTTP error requesting GET https://plex.tv/api/v2/user/privacy?X-Plex-Token=xxxxxxxxxxxxxxxxxxxxficate or SSH remote key was not OK) (SSL: no alternative certificate subject name matches target host name 'plex.tv')

There appears to be corruption/damage to the local copy of your certificate.

sudo bash
systemctl stop plexmediaserver
cd "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache"
rm cert-v2.p12

Also make certain permissions are ok to write/save the certificate when the new one is downloaded (while still in the “Cache” directory)

sudo chown -R plex:plex .

I would look around to confirm permissions for plex:plex are correct elsewhere in the files (just to be certain)

Thanks,
I followed your instructions to remove the certificate, but I don’t seem to have that file at all.

I made sure plex:plex was set as owner for the entire Cache hierarchy (and checked that all other folders had the same owner), then tried starting the server to see if it downloaded the certificate, but it didn’t.

ok… so no cert at all?

[chuck@lizum Plex Media Server.2002]$ ls Cache/
cert-v2.p12            CloudUsersF.dat                Flags.dat         relayHostKey.txt    va-dri-linux-x86_64/
cl-icds-linux-x86_64/  CloudUsersServices.dat         OCSP/             Shaders/
CloudAccessV2.dat      CloudUsersSubscriptionsV2.dat  PhotoTranscoder/  Transcode/
CloudAccountV2.dat     CloudUsersV2.dat               Privacy.dat       UpdateChannels.dat
[chuck@lizum Plex Media Server.2003]$ 

Stop PMS
using the linux text editor of your choice (as root) open Preferences.xml

Look for PlexOnlineToken="" (Null token).

If you find it, delete it (PlexOnineToken="" ) and save Preferences.xml
Restart PMS

Now try to clain it. It should be MUCH more cooperative

Sadly, it did not work. After restarting the server, it just put PlexOnlineToken=“” back into the Preferences.xml file.

Earlier, I tried using the UserCredentialReset.sh tool, but it seems to have a similar problem. The section that queries the plex.tv api for the token using curl, fails with Error: 60, which , after a bit of searching, does suggest a certificate problem on my server.

I grabbed the log after trying to claim the server again, just now.
Plex Media Server.log (178.0 KB)

Both UserCredentialReset.sh will report error 60 when the host has a FQDN involved.

When you type hostname, do you get a FQDN style name (e.g. name.local or a simple name?

If you get anything which resembles a FQDN, and that domain isn’t defined in PMS (which is the catch-22 when claiming/installing), it will fail.

The other thing which makes it fail is when date/time (date/time of the host) is not in sync with network time (NTP servers).

My code is a simple curl POST

# Get Credentials
echo "Getting new credentials from Plex.tv"
LoginInfo="$(curl -X POST -s \
                  -H "X-Plex-Client-Identifier: ${ClientId}" \
                  -H "X-Plex-Product: Plex Media Server"\
                  -H "X-Plex-Version: 1.1" \
                  -H "X-Plex-Provides: server" \
                  -H "X-Plex-Platform: Linux" \
                  -H "X-Plex-Platform-Version: $HostType $(uname -r)" \
                  -H "X-Plex-Device-Name: PlexMediaServer" \
                  -H "X-Plex-Device: $HostType" \
                  "https://plex.tv/api/claim/exchange?token=${ClaimToken}")"

# If errors, redo claim sequence
Result=$?
if [ $Result -ne 0 ]; then
  echo "ERROR: Could not get credentials from plex.tv (Error: $Result)"
  exit 1
fi

There is one other way to try but you must be ssh’d / on a terminal window on the host.

  1. Stop Plex
  2. Edit Preferences.xml and delete the Name=“Value” pairs for:
    – PlexOnlineUsername
    – PlexOnlineMail
    – PlexOnlineToken
    – PlexOnlineHome
  3. Save the file
  4. Start PMS
  5. Go get a claim token and copy it
  6. Come back to the terminal window
curl -X POST 'http://127.0.0.1:32400/myplex/claim?token=PASTE_TOKEN_HERE'

then hit enter (you only have 5 minutes for the token so don’t waste time

  1. After you hit Enter, there will be a delay
  2. IF it works correctly, you’ll get a slew of XML ending in </MyPlex>

This is confirmation PMS and Plex.tv have negotiated new credentials and updated Preferences.xml

The server has a simple name:

plex@dingo-plexvm:~$ hostname
dingo-plexvm

Before writing my initial post, I came across a suggestion that the server time could be an issue, and this whole thing did indeed start the day after switching from daylight savings time. I found that the server was off by one hour and using the wrong timezone, so I switched it to the correct timezone and restarted. It’s now accurate to <1 second, from what I can tell, but It didn’t seem to make any difference.

plex@dingo-plexvm:~$ timedatectl status
               Local time: Mon 2024-11-04 00:35:41 CET
           Universal time: Sun 2024-11-03 23:35:41 UTC
                 RTC time: Sun 2024-11-03 23:35:41
                Time zone: Europe/Copenhagen (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

The result of the procedure:
Plex Media Server.log (152.9 KB)

plex@dingo-plexvm:~$ curl -X POST 'http://127.0.0.1:32400/myplex/claim?token=claim-BxdrUJZY4x8t6T9Sd-wP'
<html><head><title>Internal Server Error</title></head><body><h1>500 Internal Server Error</h1></body></html>

Possibly it would be easier to reinstall the entire thing and hope that fixes whatever the issue is, but I recently got hw transcoding to work, so I would like to avoid that. :slight_smile:

I went ahead and reinstalled the server. Backed it up and started over with basically the same setup, and it now seems back to normal.
It would’ve been nice to learn what had gone wrong, but I had eventually spent 5x the time it’d take to reinstall, trying to locate the problem. Everything we tried pointed to an issue with certificates, but nothing I tried in that regard made any difference, so I chose the easy way out.

Thanks for the assistance. :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.