Preferences.xml is empty

Server Version#: plexmediaserver-1.25.5.5492-12f6b8c83.x86_64
Player Version#: web player

Been running plex on a centos 7 server for a few years now, yesterday I found that my libraries cannot be found, checking the service status I’m getting the following error:
Failed to load preferences at /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml

I usually have the entire plexmediaserver directory symlinked to a raid drive, but now I come to find that my symlink is no longer there (perhaps an update to plex did that? I updated last week and it was working fine) and there is a plexmediaserver there completely populated with my server’s data, well all except for the fact that Preferences.xml is empty.

This file is empty in the plexmediaserver directory as well as the symlink target directory.

How can I restore/rebuild Preferences.xml to have the entries needed to find my libraries again?

See if there are any Preferences.xml.tmp files floating around?

Where was the symlink set for ?

Are you running systemd or init ?

Ran find . -type f -name '*Preferences.xml*' and found no other preference files in the two directories I have (lib and mnt), no tmp files.

The link was ln -s /mnt/raid6tb/plexmediaserver /var/lib/plexmediaserver which was just to have the metadata systems running on a secondary HDD instead of the OS’s SSD.

I’m running systemd, the default for centos 7.

Just weird that I haven’t updated/altered plex at all in at least week and it was working yesterday with no issues.

Something weird definitely … I’ve not seen that behavior in a LONG time (0.9 stuff)

I’d like to make your system and you safer. I’d like to suggest removing the symlink.

You can customize PMS using systemd.

  1. Create the override which defines
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/Path/even with/spaces/Application Support"

(the "var=value" is treated as a single item when passed so it works perfectly for the export to the environment)

  1. Save the override.conf
  2. systemctl daemon-reload
  3. systemctl restart plexmediaserver

I set this all up years ago. The symlink wasn’t there when I first noticed the issue, I think a plex update may have overwritten it at some point in the past.

Regardless, I’ve tried both with and without the symlink. The Preferences file is empty in both directories.

There are no results from running echo $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR and printenv has nothing related to plex.

Do you think creating this environment variable will actually do anything since I have the same issue with and without the symlink?

I think something basic has happen.

Let’s back up and walk through this?

  1. Check the ID. Should get user and group plex
id plex
  1. Check if writable
sudo bash
su -s /bin/sh plex
whoami
[ -w "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server" ] && echo  Is writable

I’ve added plex to other groups for the samba raid, in case you were wondering:

[jig@coreforge ~]$ id plex
uid=997(plex) gid=1001(plex) groups=1001(plex),39(video),1002(smbgrp),994(lighttpd),991(nginx)
[jig@coreforge ~]$ sudo bash
[root@coreforge jig]# su -s /bin/sh plex
sh-4.2$ whoami
plex
sh-4.2$ [ -w "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server" ] && echo  Is writable
Is writable

Thanks.

That all looks good.

Silly question time.

Is the metadata /var/lib/plexmediaserver pointing off to a network share or a local drive ?

It’s all local to the centos7 system; I have the OS on a nvme drive and two sata HDDs in raid1. That raid drive is configured with samba for my local network. Plex runs on the same centos7 system that the raid/samba run off of.

I can access the files through the network drive on other PCs in my local network (samba) so I know the data integrity is there, but the plex software ain’t able to find the files for the metadata it’s built up over the years it seems. I’m just assuming it’s because that preferences file is blank. I’m not that much of an expert in the plex software, but I know some linux.

I’ve got a plan to modernize much of my home lab to containerization and a new OS (eventually) but I gotta wait on that for the next few months. I’m looking for an easier solution in the meantime.

I mean, I could just try a new install on this system (all the content seems fine), but this is my home production server and I hate having to reconfigure crap I worked on forever ago. Lots of libraries to remake and tons of friends [I think] I’d have to re-invite.

It’s been a while since I’ve had to clean install plex, but do you think that is a quicker, more immediate solution (maybe under two dozen libraries/friends)?

I’ll make more of my own rolling backup scripts next time (I bet there’s a more modern solution than running rysncs with cron now too lol).

Do you have a backup of “Preferences.xml” ? If so, we can use that to save the UUID/claimed status.

Let’s give this a spin. Worst case scenario is you need to reclaim it and share it again (if you’re sharing outside your home).

  1. stop plex
  2. mv Preferences.xml Preferences.xml.broken
  3. sudo chown -R plex:plex /var/lib/plexmediaserver (edit this appropriately if you have customized username or location)
  4. start plex
  5. cat Preferences,xml – make sure it’s partially populated,
  6. — OPTIONAL —
    6a. stop plex
    6b. copy the backup ‘Preferences.xml’ into position to overwrite the unclaimed one,
    6c. verify owned by plex:plex
    6d. start plex
  7. fingers crossed, it’ll come back.

Please advise of your progress.

My backups are pretty straight forward;

  1. Stop Plex
  2. cd /var/lib/plexmediaserver
  3. sudo tar cf /path/to/save/to/plex-backup-$(date).tar ./Library

be advised, you’ll want to get the date string formatting correct. What I show here is example but not exact.

Sadly, no backups of prefs on this current install.

Moving prefs and restarting the service recreated prefs with partially populated data (version, identifiers, metrics). The libraries are still not available though.

That’s was always a possibility.

  1. confirm PMS running

  2. Open a terminal window / ssh into the server command line.

  3. in your browser. Claim | Plex

  4. COPY the token it gives you.

  5. Return to the terminal window.

curl -X POST 'http://127.0.0.1:32400/myplex/claim?token=PASTE_TOKEN_HERE'

wait about 20 seconds…

You will get a flurry of output ending with </MyPlex> .
These are your account features.

The server is now claimed.

Open it by IP / loopback the first time to check the “Got it” part of the setup.
Confirm you have your library sections back as you did.

Lastly, Settings - Server to recreate those settings you lost

1 Like

Figured there was an access method. Looks good now, thanks.

As for relocating the install files to the raid drive:

  1. stop the service
  2. move the /var/lib/plexmediaserver files to the raid
  3. systemctl edit plexmediaserver
  4. Add Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/mnt/raid6tb/plexmediaserver/Library/Application Support" and save
  5. Reload the daemon and restart the service.

Right?

make certain the plex runtime username (plex) has permission (rx) at each directory level (/mnt, /mnt/raid6tb) as well as owns /mnt/raid6tb/plexmediaserver)

So something has emptied the Preferences file twice since I got this working again. I’m not sure what exactly did this but restoring the file from backup brought the service back up.

I had a cron job to restart plex once a day which I have since removed. I haven’t noticed the prefs file be cleared since, but I cannot confirm this is the cause as restarting the service shouldn’t clear the file.

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