# Preferences.xml is empty

**URL:** <https://forums.plex.tv/t/preferences-xml-is-empty/777289>\
**Category:** Plex Media Server\
**Tags:** server-linux\
**Created:** [February 19, 2022, 10:40pm UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289 "2022-02-19T22:40:10Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 19, 2022, 10:40pm UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/1 "2022-02-19T22:40:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 19, 2022, 11:08pm UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/2 "2022-02-19T23:08:56Z")

</div>

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

Where was the symlink set for ?

Are you running systemd or init ?

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 19, 2022, 11:31pm UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/3 "2022-02-19T23:31:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 19, 2022, 11:45pm UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/4 "2022-02-19T23:45:43Z")

</div>

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.

> [@Linux Tips](https://forums.plex.tv/t/linux-tips/276247/3):
>
> Customizing your Plex configuration on systemd based systems This information is intended for those systems where cat /proc/1/comm returns systemd. On systems which use Systemd (Ubuntu 16+, Fedora, Centos 7, Debian 8,) you create this customization file which SystemD reads prior to launching PMS. This file is independent of the default configuration and service control mechanisms in /lib/systemd/system/plexmediaserver.service. Your customization override is preserved across updates, uninstal…

1. Create the override which defines

```auto
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

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 20, 2022, 12:19am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/5 "2022-02-20T00:19:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 20, 2022, 2:11am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/6 "2022-02-20T02:11:53Z")

</div>

I think something basic has happen.

Let’s back up and walk through this?

1. Check the ID. Should get user and group plex

```auto
id plex

```

1. Check if writable

```auto
sudo bash
su -s /bin/sh plex
whoami
[-w "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server"] && echo Is writable

```

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 20, 2022, 3:01am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/7 "2022-02-20T03:01:35Z")

</div>

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

```auto
[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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 20, 2022, 3:57am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/8 "2022-02-20T03:57:31Z")

</div>

That all looks good.

Silly question time.

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

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 20, 2022, 4:15am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/9 "2022-02-20T04:15:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 20, 2022, 9:35am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/10 "2022-02-20T09:35:07Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 21, 2022, 5:41pm UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/11 "2022-02-21T17:41:47Z")

</div>

> [@jigmcgalliger](#):
>
> but the plex software ain’t able to find the files for the metadata it’s built up over the years it seems.

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.

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 22, 2022, 12:59am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/12 "2022-02-22T00:59:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 22, 2022, 1:15am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/13 "2022-02-22T01:15:39Z")

</div>

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](https://plex.tv/claim)

4. COPY the token it gives you.

5. Return to the terminal window.

```auto
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

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 22, 2022, 1:59am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/14 "2022-02-22T01:59:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [February 22, 2022, 2:54am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/15 "2022-02-22T02:54:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jigmcgalliger](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jigmcgalliger](https://forums.plex.tv/u/jigmcgalliger)\
**Post date:** [February 26, 2022, 12:17am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/16 "2022-02-26T00:17:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [May 27, 2022, 12:17am UTC](https://forums.plex.tv/t/preferences-xml-is-empty/777289/17 "2022-05-27T00:17:28Z")

</div>

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