PMS db corrupted - running in BINHEX docker on Unraid

Server Version#: 1.32.2.7100 (running from binhex-plex package on Docker, up-to-date as of 2023/05/30), on Unraid 6.11.5

I’ve been monitoring the Plex Dashboard recently, and I have been getting pushj notifications on my phone explaining the Server database seems to be corrupt.
Because I was having issues displying lyrics for my Music library, I decided to delete the library and start it again from scratch, all the while using the proper agents to scan the embeded meta.

For some reason, the library has been delete about 22 times, but keeps reappearing in the player’s listings. I’m guessing I need some help here :crazy_face:

I’ve been reading up on the PlexDBRepair script on GitHub, and from the dev thread (featuring @ChuckPA). I’m not sure if the script is actually functional on a Docker image, and I honestly wouldn’t know where to begin on how to install the script and run it from within Docker.

If anyone (such as @ChuckPa ) can give me a hint as to how to perform this operation, Id really appreciate. Over 300GB of MP3s arent available right now and I’m going slightly mad.
Thanks for any help!

1 Like

I’m only of help after you go completely mental :rofl:

At the landing page of the GitHub, you will find the

README.md

Reading this (It’s also shown on the landing page), you’ll find all the instructions.

I’ve always been completely mental. Do I get a LifeTime Pass? :rofl:

I read the readme. One thing is unclear to me: the location of where to put this file to begin with. Because I’m running PMS as a Docker (binhex-plex), does the file have to be in a specific location?
Does it have to be located relative to Unraid (bare-metal Linux) or binhex-plex (the “virtual” docker container)?
To my understanding, my PMS install is at /mnt/user, and the AppData Config path is /mnt/user/appdata/binhex-plex. For the container however, those become /media and /config. If I have to install these from WITHIN the Docker, I’m totally unclear how to perform this. I’d have no clue as to how to get inside the docker as it runs.

I’ll presume (because you’re still sane; I’ll rely on what liitle you have left :joy: ) that the installation has to be done relative to Unraid, but in the proper location…?

you want to place the file (DBRepair.sh) in the real filesystem where you can see it in /config when inside the container. That’s the trick.

1 Like

Failed. I was able to get the file, copy it to the server, copy the file to the exact location, extract the .tar file, cd into the installation folder, chmod +x the file, then invoke the ./DBRepair.sh file.

Here is the error message:

root@sebunraid1:/mnt/user/appdata/binhex-plex/PlexDBRepair-1.0.6# ./DBRepair.sh
Error: Unknown host. Current supported hosts are: QNAP, Syno, Netgear, Mac, ASUSTOR, WD (OS5), Linux wkstn/svr
                     Current supported container images:  Plexinc, LinuxServer, HotIO, & BINHEX

Not quite sure what the system is not detecting. I am using the 1.0.6 version. And I am on binhex.

Perhaps I’m in the wrong folder?
My Appdata Config path in real is /mnt/user/appdata/binhex-plex.
The container path is /config.
Should work. Should I see a specific file in this folder? Maybe that will give me a clue.
Or should I stop the container?

Get into the command line of the container.

check for the following:

  1. grep "IMAGE_ID=archlinux" /etc/os-release
  2. file exists; /home/nobody/start.sh
  3. grep PLEX_MEDIA /home/nobody/start.sh

This is the new test. He gave me this info so I can be version independent.

Here’s what I get:

sh-5.1# grep "IMAGE_ID=archlinux" /etc/os-release
IMAGE_ID=archlinux
sh-5.1# cd /home/nobody
sh-5.1# ls
dbrepair.sh  start.sh
sh-5.1# grep PLEX_MEDIA /home/nobody/start.sh
export PLEX_MEDIA_SERVER_USER='nobody'
export PLEX_MEDIA_SERVER_HOME='/usr/lib/plexmediaserver'
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR='/config'
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS='6'
        export PLEX_MEDIA_SERVER_TMPDIR='/config/tmp'
        export PLEX_MEDIA_SERVER_TMPDIR="${TRANS_DIR}"
export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
"${PLEX_MEDIA_SERVER_HOME}/Plex Media Server"
sh-5.1#

@couzin2000

OK. that’s what I get too.

:thinking:

Let me un**** this. Sorry

No worries or apologies needed. I can be patient. And helpful if required.
But please un**** this soon :rofl:

I just found it. Dotting the i’s and t’s now.
You’ll see 1.0.7 shortly.

1 Like

That was quick.

TOTAL PEBKAC :roll_eyes:

Line 605 (if you want to do it now)

    # BINHEX Plex image
    elif [ -e /etc/os-release ] &&  grep "IMAGE_ID=archlinux" /etc/os-release  1>/dev/null  && \
         [ -e /home/nobody/start.sh ] &&  grep PLEX_MEDIA /home/nobody/start.sh 1> /dev/null ; then

I’ll wait to get your copy when it’s available. No rush.

See?

Now it works LOL

[root@lizum /]# ./DB.sh 
 
 
 
      Plex Media Server Database Repair Utility (BINHEX)
                       Version v1.0.6
 

Select

  1 - 'stop'      - (Not available. Stop manually)
  2 - 'automatic' - database check, repair/optimize, and reindex in one step.
  3 - 'check'     - Perform integrity check of database
  4 - 'vacuum'    - Remove empty space from database
  5 - 'repair'    - Repair/Optimize  databases
  6 - 'reindex'   - Rebuild database database indexes
  7 - 'start'     - (Not available. Start manually)

  8 - 'import'    - Import watch history from another database independent of Plex. (risky)
  9 - 'replace'   - Replace current databases with newest usable backup copy (interactive)
 10 - 'show'      - Show logfile
 11 - 'status'    - Report status of PMS (run-state and databases)
 12 - 'undo'      - Undo last successful command

 99 - 'quit'      - Quit immediately.  Keep all temporary files.
      'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : 
1 Like

Up here we call that a “code 18”… specifically the 18 inches BKAC :rofl:

The other tag we use is ID-10-T

:man_facepalming:

v1.0.7 is now available.

root@sebunraid1:~# cp /mnt/cache/downloads/PlexDBRepair-1.0.7.tar.gz /mnt/user/appdata/binhex-plex
root@sebunraid1:~# cd /mnt/user/appdata/binhex-plex
root@sebunraid1:/mnt/user/appdata/binhex-plex# ls
Plex\ Media\ Server/  PlexDBRepair-1.0.6.tar.gz  perms.txt        supervisord.log.1  supervisord.log.3  supervisord.log.5  transcode/
PlexDBRepair-1.0.6/   PlexDBRepair-1.0.7.tar.gz  supervisord.log  supervisord.log.2  supervisord.log.4  tmp/
root@sebunraid1:/mnt/user/appdata/binhex-plex# sudo tar -xvf PlexDBRepair-1.0.7.tar.gz
PlexDBRepair-1.0.7/
PlexDBRepair-1.0.7/Contributing.md
PlexDBRepair-1.0.7/DBRepair-Windows.bat
PlexDBRepair-1.0.7/DBRepair-Windows.zip
PlexDBRepair-1.0.7/DBRepair.sh
PlexDBRepair-1.0.7/License.md
PlexDBRepair-1.0.7/README.md
PlexDBRepair-1.0.7/ReleaseNotes
root@sebunraid1:/mnt/user/appdata/binhex-plex# cd PlexDBRepair-1.0.7
root@sebunraid1:/mnt/user/appdata/binhex-plex/PlexDBRepair-1.0.7# sudo chmod +x DBRepair.sh
root@sebunraid1:/mnt/user/appdata/binhex-plex/PlexDBRepair-1.0.7# ./DBRepair.sh
Error: Unknown host. Current supported hosts are: QNAP, Syno, Netgear, Mac, ASUSTOR, WD (OS5), Linux wkstn/svr
                     Current supported container images:  Plexinc, LinuxServer, HotIO, & BINHEX
root@sebunraid1:/mnt/user/appdata/binhex-plex/PlexDBRepair-1.0.7#

S***. This is a problem.

Let me RERUN it as published. I hope github didn’t fubar it.

All good here – sorry.

Blast the image and container.
Download fresh image and recreate the container.
Nothing of your PMS will change (if you have everything stored in a directory you can see )

( I do this with docker run sequence )

[root@lizum /]# chmod +x ./DBRepair.sh 
[root@lizum /]# ./DBRepair.sh 
 
 
 
      Plex Media Server Database Repair Utility (BINHEX)
                       Version v1.0.7
 

Select

  1 - 'stop'      - (Not available. Stop manually)
  2 - 'automatic' - database check, repair/optimize, and reindex in one step.
  3 - 'check'     - Perform integrity check of database
  4 - 'vacuum'    - Remove empty space from database
  5 - 'repair'    - Repair/Optimize  databases
  6 - 'reindex'   - Rebuild database database indexes
  7 - 'start'     - (Not available. Start manually)

  8 - 'import'    - Import watch history from another database independent of Plex. (risky)
  9 - 'replace'   - Replace current databases with newest usable backup copy (interactive)
 10 - 'show'      - Show logfile
 11 - 'status'    - Report status of PMS (run-state and databases)
 12 - 'undo'      - Undo last successful command

 99 - 'quit'      - Quit immediately.  Keep all temporary files.
      'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : 

Use this URL:

I don’t put the windows stuff in the main distro – somehow you got it.