# DBRepair development

**URL:** <https://forums.plex.tv/t/dbrepair-development/822684>\
**Category:** Apps & Creations\
**Created:** [December 14, 2022, 3:57am UTC](https://forums.plex.tv/t/dbrepair-development/822684 "2022-12-14T03:57:23Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![anon5074910](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@anon5074910](https://forums.plex.tv/u/anon5074910)\
**Post date:** [December 16, 2022, 9:33pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/63 "2022-12-16T21:33:50Z")

</div>

> [@ChuckPa](#):
>
> I run this monthly because I add about 50 new episodes a month.

Thanks, sounds like my estimate of every few months was about right. Guess it really depends on the amount of content added so thanks for confirming that,

> [@ChuckPa](#):
>
> There was a suggestion to change the menu order.

I did see that suggestion from TeknoJunky. Makes sense especially if going forward this would become a somewhat semi regular maintenance tasks for server admins.

> [@ChuckPa](#):
>
> I’ll start changing “Repair” to “Repair/Rebuild” because this is more of a Rebuild than fixing data in the actual records (which PMS does)

That certainly makes a lot of sense.

BTW… wonder if its worth adding the version info (v0.6.1) to the top of the script to match the release in git ? Within here …

```auto
#########################################################################
# Plex Media Server database check and repair utility script. #
# Maintainer: ChuckPa #
#########################################################################

```

That way when we have a local copy of the script we can quickly know if there is a later version. Just a suggestion …

---

<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:** [December 16, 2022, 10:11pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/64 "2022-12-16T22:11:01Z")

</div>

> [@anon5074910](#):
>
> That way when we have a local copy of the script we can quickly know if there is a later version. Just a suggestion …

I’ll include that in the next release

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 3, 2023, 8:24pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/65 "2023-01-03T20:24:53Z")

</div>

@ChuckPa Hey, so I was working with you a few weeks ago to get this script working in unraid with Binhex plex. I used [THIS](https://github.com/bullmoose20/Plex-Stuff#pumpanddump) script in the past. It’s a collection of scripts to do various things if you use the binhex template.

Do you mind taking a peek at it and telling me if it does what your script does?

---

<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:** [January 3, 2023, 8:36pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/66 "2023-01-03T20:36:54Z")

</div>

If you go look,

1. cgroups v2 has been added
2. binhex has been added

From what i see on that page you linked, that looks more like a PMS-function tool.

I work at the database only (SQLite level).  
I don’t do anything with the internal contents.

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 3, 2023, 11:12pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/67 "2023-01-03T23:12:26Z")

</div>

Oh good news! Is it all baked into the master release? [GitHub - ChuckPa/PlexDBRepair: Database repair utility for Plex Media Server databases](https://github.com/ChuckPa/PlexDBRepair)

Do you place tar in the hidden docker folder? Or the appdata folder? (I’m on Unraid, if that matters which doesnt expose the docker folder, just the appdata folder.

---

<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:** [January 3, 2023, 11:39pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/68 "2023-01-03T23:39:02Z")

</div>

@Sittingmongoose

You place the tarball in whichever directory `/config` points to .

This way, when you open the container,

```auto
cd /config
tar xf PlexDBRepair-xxxxxxx.tar.gz

... etc...

```

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 4, 2023, 9:03pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/69 "2023-01-04T21:03:47Z")

</div>

Forgive my ignorance, I am having a hard time actually getting to the /config folder of my Hotio plex image on Unraid. I got this far.

 ![image](https://global.discourse-cdn.com/plex/original/4X/f/3/b/f3b1d87980177ad7379bd15de723538c21f408e0.png)  
But I haven’t been able to access that folder to actually put the Tar file in it.

---

<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:** [January 4, 2023, 9:18pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/70 "2023-01-04T21:18:38Z")

</div>

If you can’t put it in your /config, try putting it at the top of one of your media directories

Once you get into the container, you can move it to wherever you want.

When I create containers, I specify where I want `/config` stored in the file system.  
Docker can create its screwy UUIDs but I want easy access to `/config` which is also persistent between container instances.

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 4, 2023, 9:58pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/71 "2023-01-04T21:58:52Z")

</div>

My /config is set to /mnt/cache/appdata/plex/ However I think this is different from the config folder you’re looking for.

 ![image](https://global.discourse-cdn.com/plex/original/4X/e/b/2/eb2807a7311ca96a20c97f709387938e8930c3ab.png)

---

<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:** [January 4, 2023, 10:12pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/72 "2023-01-04T22:12:10Z")

</div>

Stop. 🙂

you missed a few steps.

1. Copy the file to where /config is in your file system ✅
2. Enter the container (docker exec -it plex bash) - ☹
3. Stop Plex - ☹
4. `cd /config`✅
5. `./DBRepair.sh`✅

The tool only runs in the namespace of where PMS runs.

- If PMS is native to the host, run the tool on the host (inside the host OS)
- If PMS is installed in a container, run the tool inside the same container.

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 5, 2023, 12:10am UTC](https://forums.plex.tv/t/dbrepair-development/822684/73 "2023-01-05T00:10:45Z")

</div>

I am getting close!! The only thing I cant figure out is how to kill plex. My normal methods kill the bash into the docker. And the command on your git is producing weird results.  
 ![image](https://global.discourse-cdn.com/plex/original/4X/8/9/0/890605f5f593d6d4b1fca3269ab3a1bd1701ee6e.png)

---

<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:** [January 5, 2023, 1:07am UTC](https://forums.plex.tv/t/dbrepair-development/822684/74 "2023-01-05T01:07:03Z")

</div>

Check your quotes there.

When you see `>` , you have a dangling quote

you can also `kill -15 $(pidof Plex\ Media\ Server)`

-or-

```auto
ps -ef | grep -i plex

```

find Plex Media Server

```auto
kill -15 PID

```

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 5, 2023, 3:47am UTC](https://forums.plex.tv/t/dbrepair-development/822684/75 "2023-01-05T03:47:28Z")

</div>

So it seems like it kills it for a few seconds and then it comes right back.

 ![Screenshot 2023-01-04 at 10.45.46 PM](https://global.discourse-cdn.com/plex/original/4X/2/8/7/287bbb6f0ab625931f2a5f37e6cda0a43706d5df.jpeg)

Using kill -15 $(pidof Plex\ Media\ Server), resulted in \> 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:** [January 5, 2023, 5:18am UTC](https://forums.plex.tv/t/dbrepair-development/822684/76 "2023-01-05T05:18:09Z")

</div>

@Sittingmongoose

See the `s6-supervise` ? You’ll have to shut down the service.

As I show in the README on Github

```auto
To launch in a Docker container:
        sudo docker exec -it plex /bin/bash

        # Stop Plex when using official Plex,inc image
        /plex_service.sh -d
--or--
        # Stop Plex when using Linuxserver.io Plex image
        s6-svc -d /var/run/service/svc-plex
--or--
        # Stop Plex in binhex containers
        kill -15 $(pidof 'Plex Media Server')

        tar xf PlexDBRepair-0.6.1.tar.gz
        cd PlexDBRepair-0.6.1
        chmod +x DBRepair.sh
        ./DBRepair.sh

```

Looks like you need to use `s6-svc`

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 5, 2023, 5:26am UTC](https://forums.plex.tv/t/dbrepair-development/822684/77 "2023-01-05T05:26:11Z")

</div>

Killing the s6 process did the same. Came right back.

 ![Screenshot 2023-01-05 at 12.23.25 AM](https://global.discourse-cdn.com/plex/original/4X/4/b/a/4ba7e2afebf916be435412c5d2776b5a1694b949.jpeg)

Again I’m sorry for my lack of capability here.

---

<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:** [January 5, 2023, 3:43pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/78 "2023-01-05T15:43:01Z")

</div>

@Sittingmongoose

whose image are you attempting to use ?

what does `ls -la / /var/run/service` return?

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 5, 2023, 3:58pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/79 "2023-01-05T15:58:05Z")

</div>

Hotio on UnRAID

Here you go.

 ![image](https://global.discourse-cdn.com/plex/original/4X/2/9/8/29840654d1cd6333eb13e86c459f858bfe29b607.jpeg)

---

<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:** [January 5, 2023, 4:42pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/80 "2023-01-05T16:42:56Z")

</div>

1. I am completely unable to get unraid to boot in an ESXi VM (their trial)

2. I cannot help with that image without finding the Plex control

3. You need to ask them how to do it.

Maybe, from inside the container

```auto
  find / -name \*plex\*

```

If you find a start script, it’ll give clues how to stop it.

---

<div class="post-metadata">

**Author:** ![Sittingmongoose](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sittingmongoose](https://forums.plex.tv/u/Sittingmongoose)\
**Post date:** [January 5, 2023, 7:19pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/81 "2023-01-05T19:19:53Z")

</div>

> [@ChuckPa](#):
>
> If you go look,
> 
> 1. cgroups v2 has been added
> 2. binhex has been added
> 
> From what i see on that page you linked, that looks more like a PMS-function tool.
> 
> I work at the database only (SQLite level).  
> I don’t do anything with the internal contents.

So I have a friend helping me, got the service to die, but realized I wrote Binhex to you and not Hotio. I am using Hotio which has a very different folder structure.

---

<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:** [January 5, 2023, 7:45pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/82 "2023-01-05T19:45:00Z")

</div>

Extending the tool to support Hotio isn’t difficult if the folder structure is known.

If you’ll share with me what you find, I’ll add it

[Previous page](https://forums.plex.tv/t/dbrepair-development/822684.md?page=3)

[Next page](https://forums.plex.tv/t/dbrepair-development/822684.md?page=5)
