Synology 7 Upgrade - Lost All History

As for the comment about this being typed wrong, this is what the install script did 3 or so years ago when I first got this Synology… It created my directory with all caps

/volume1/PLEX

@mpalermo73

Check your PM (Green dot - upper right)

Re the “PLEX” – WOW, That was before I took over. My apologies.

What I’ve done with my latest change will sweep up every capitalization variation of “Plex” now

Yes. I’ve been doing this stuff a long time, and I learned the hard way too. This is why when I’m doing similar filesystem hunt ‘n’ peck stuff, I do things like

find . -iname '*plex*'
iname is case insensitive name search

[pP][lL][eE][xX]
for regex type things with full case insensitivity

Again, I learned the hard way too. :grinning:

~-~-~-~

Yes I see the DM. :+1: :+1: I’m typing.

To live by a REGEX…

To die by a REGEX…

:rofl:

@ChuckPa I ran into a potential snag on the migration. I don’t want to take up @mpalermo73 thread, so can make a new one if that is better. My short list of what I have done so far:

  1. Uninstall PMS from DSM6
  2. Install DSM7
  3. Manually install PMS v.1.24.5.5173 downloaded from link in guide. *“Successful” install after about 15 seconds with no error.
  4. Change permissions on Plex folder giving PlexMediaServer full control.
  5. Manually install PMS v.1.24.5.5173. *"Successfu"l install after about 15 seconds with no error.
  6. Uninstall PMS (App only) and reinstall. *“Successful” install after about 15 seconds with no error.
  7. Uninstall PMS+Erase and reinstall. Migration appears to working and has been running over 1 hour. However, received error below after about 30 minutes into migration.

I walked away from the migration and came back to the DSM to see an error popup from the installation that said I needed to re-login to DSM to continue. However, I am still logged in and I confirmed that my timeout is still set to 50,000 minutes. I see this in Package Center with the installation maybe still working:

My migration log currently shows this:
Plex Media Server migration to DSM 7 started: Sun Oct 31 12:02:06 PDT 2021
=== Sun Oct 31 12:02:06 PDT 2021 === Start: Change ownership
=== Sun Oct 31 12:28:51 PDT 2021 === Completed: Change ownership
=== Sun Oct 31 12:28:51 PDT 2021 === Start: Convert symbolic links
=== Sun Oct 31 12:35:48 PDT 2021 === Completed: Convert symbolic links
=== Sun Oct 31 12:35:48 PDT 2021 === Start: Migrate Plex Media Server

DSM will show this error. It’s STUPID.
The idle-time logout has fired and wants you to log out.

If you log out – there is no harm.

You will lose access to watching the popup but it will keep running.

  1. use TaskManager / Resource Monitor – Processes

  2. Wait for “Plex/Migration.log” to show it it’s done Cleaning /volumeX/Plex

You’re at the point where its moving the “Plex Media Server” folder from Plex to its new location in PlexMediaServer/AppData.

This is the critical part.

Let it run and you’ll be OK.

( I wrote the code to “move”. For reasons I don’t understand, DSM 7 will COPY the files one at a time… even on the same volume… which is just DUMB)

@ChuckPa Thanks for all the help. Migration looks to have completed successfully and media is playing on various devices. Migration log shows this:
Plex Media Server migration to DSM 7 started: Sun Oct 31 12:02:06 PDT 2021
=== Sun Oct 31 12:02:06 PDT 2021 === Start: Change ownership
=== Sun Oct 31 12:28:51 PDT 2021 === Completed: Change ownership
=== Sun Oct 31 12:28:51 PDT 2021 === Start: Convert symbolic links
=== Sun Oct 31 12:35:48 PDT 2021 === Completed: Convert symbolic links
=== Sun Oct 31 12:35:48 PDT 2021 === Start: Migrate Plex Media Server
=== Sun Oct 31 14:02:25 PDT 2021 === Completed: Migrate Plex Media Server
=== Sun Oct 31 14:02:25 PDT 2021 === Completed: Migrate Plex Media Server
=== Sun Oct 31 14:02:25 PDT 2021 === Start: Clean /volume1/Plex
=== Sun Oct 31 14:02:25 PDT 2021 === Completed: Clean /volume1/Plex

If you would like anything from me to help see why I never got the error on the initial install, please let me know and I’ll pull it.

@apoptosis81

Working with @mpalermo73 , we identified the root cause.

In the work to create this new platform “DSM 7” (it’s nothing like DSM 6 at the application level), I had overlooked one thing.

That oversight is what’s now sitting in QA for review and inclusion.

The specific issue is:

  1. Early versions of the Plex installer created the Plex share as PLEX and not Plex as it should have. I had seen this in DSM 5 (which is no longer supported) but not DSM 6. Apparently the Synology docs are missing a few bits of info.

  2. When I created my new method to find the Plex share (brute force search), I neglected to handle all possible capitalization combinations. (e.g. plEX) .

  3. Anything not matching [Pp]lex was overlooked. My change now properly checks ALL characters.

  4. The workaround is to rename the Plex shared folder to be as the installer expects. Future releases won’t have this issue.

I’m good to go if you are.

Is all your media properly accessible by the new username PlexMediaServer ?

I’m having a similar problem to the others here. One difference, while I read that I would need to set permissions, I missed that I should uninstall Plex before updating to DSM 7. I updated to DSM 7, uninstalled Plex, installed the DSM 7 version of Plex Server, set permissions, uninstalled and installed again. The install took only a couple of seconds and no libraries migrated. I have tried uninstalling, uninstalling with erase option, and even manually deleting the PlexMediaServer shared folder. When I again install, I get no libraries migrated.

By the way, I neither clicked the “Repair” option nor installed from the Synology package store.

Any way to trigger the migration so I don’t lose the status of thousands of files?

Thanks!

@ChuckPa Yeah I granted access to my music and video directories and all media that have tried to play through various plex apps have been successful.

@Frank4263

Check the name of the shared folder… Is it “PLEX” as seen in the file system ?

No. The shared folder is “Plex”. The old server path is “/Plex/Library/Application Support/Plex Media Server”

@Frank4263

If you can confirm everything is still in the “Plex” shared folder,

  • Uninstall + Erase of the DSM 7 app.

  • Install the SPK again (manual).

If, no later than the 2nd iteration, it doesn’t engage (“Installing” or error messages telling you to fix permissions) then we need to dig deeper at the Synology command line.

Thanks for the quick response.

Under the original Plex folder, there are files under Media and Metadata folders so I believe those are the original libraries.

I uninstalled Plex using the “Erase all of Plex Media Server from System” option. The PlexMediaServer shared folder is still there but contained very few files. I deleted the PlexMediaServer shared folder. The PlexMediaServer user was still there and had R/W access to both the Plex shared folder and my media folder.

I installed Plex Media Server ver. 1.24.5.5173 which I had downloaded from Plex earlier today. I used the “Install with Claim Token” option. After about 5 seconds, I get a “Successfully Claimed Server” message.

Opening Plex, it appears as a new install with no libraries. I can add libraries but I lose all my customizations, watched status, etc.

I just don’t understand what I could be doing wrong. Thanks again.

@Frank4263

I would like you to do the following;

  1. Create a Scheduled Task - User Script,
  2. Runs as root
  3. Emails you the results.
  4. The task settings (Script contents)
#!/bin/bash

echo  Searching for Plex:
echo  Found:  /volume*/[Pp][Ll][Ee][Xx]*

echo Volume top level
ls -la /volume*

It will look like this
Screenshot from 2021-10-31 20-55-39

It will take 1-2 seconds to run.

Please show me the results.

Here are the results

Task Scheduler has completed a scheduled task.

Task: Plex Test
Start time: Sun, 31 Oct 2021 21:12:28 GMT
Stop time: Sun, 31 Oct 2021 21:12:28 GMT
Current status: 0 (Normal)
Standard output/error:
Searching for Plex:
Found: /volume1/Plex /volume1/PlexMediaServer
Volume top level
total 219424
drwxr-xr-x  35 root                root                     4096 Oct 31 20:15 .
drwxr-xr-x  22 root                root                     4096 Oct 31 16:45 ..
-rw-------   1 Antivirus           Antivirus                2048 Jan 20  2013 .quarantine
drwxr-xr-x   2 root                root                     4096 Oct 31 11:44 @AntiVirus
-rw-------   1 root                root                 14447591 Oct 22 20:18 @Plex.core.gz
drwxr-xr-x   2 root                root                     4096 Oct 31 16:46 @S2S
drwx------   2 root                users                    4096 Dec 12  2020 @SynoDrive
drwxr-xr-x   2 SynoFinder          SynoFinder               4096 Oct 31 16:46 @SynoFinder-etc-volume
drwxr-xr-x   2 root                root                     4096 Dec 22  2020 @SynoFinder-log
drwxr-xr-x   3 root                root                     4096 Jul 27  2019 @SynologyApplicationService
drwxr-xr-x   6 root                root                     4096 Jul 27  2019 @SynologyDriveShareSync
drwxr-xr-x  23 root                root                     4096 Oct 31 12:04 @appconf
drwxr-xr-x  23 root                root                     4096 Oct 31 12:04 @appdata
drwxr-xr-x  23 root                root                     4096 Oct 31 12:04 @apphome
drwxr-xr-x  19 root                root                     4096 Oct 31 20:15 @appstore
drwxr-xr-x  19 root                root                     4096 Oct 31 20:15 @apptemp
drwx------   2 root                root                     4096 Oct 31 11:36 @autoupdate
drwxr-xr-x   2 root                root                     4096 Oct 31 20:23 @config_backup
drwxr-xr-x   9 admin               users                    4096 Oct 31 11:43 @database
drwxrwxrwx+  9 root                root                     4096 Oct 31 20:06 @eaDir
drwx------   3 root                root                     4096 May 29  2017 @iSCSI
-rw-------   1 root                root                   428890 Apr  5  2021 @pkg-SynologyMom.core.gz
d-wx------   2 Antivirus           Antivirus                4096 Jan 20  2013 @quarantine
drwxrwxrwx   4 root                root                     4096 Nov  7  2014 @spool
drwxr-xr-x   2 root                root                     4096 Oct 31 11:47 @ssbackup
drwxr-xr-x   7 SurveillanceStation SurveillanceStation      4096 Oct 31 16:46 @surveillance
-rw-------   1 root                root                489218048 Jun 21  2017 @synoelasticd.core
drwxr-xr-x   7 root                root                     4096 Oct 31 16:46 @synologydrive
-rw-------   1 root                root                   843776 Aug 10  2014 @synovideostatio.core
drwxrwxrwt   7 root                root                     4096 Oct 31 21:01 @tmp
drwxr-xr-x   6 root                root                     4096 Oct 31 11:40 @userpreference
drwxr-xr-x   2 root                root                     4096 Oct 31 11:57 @webdav
drwxrwxrwx   5 root                root                     4096 Jun 18  2019 NAS
drwx------+  6 plex                users                    4096 May 18  2019 Plex
d---------+  4 root                root                     4096 Oct 31 20:15 PlexMediaServer
-rw-------   1 root                root                    27648 Oct 31 16:44 aquota.group
-rw-------   1 root                root                    26624 Oct 31 16:44 aquota.user
drwx--x--x+  5 root                root                     4096 Nov 20  2018 homes
drwxrwxrwx   3 root                root                     4096 May 12  2015 music
drwxrwxrwx   3 root                root                     4096 May 12  2015 photo
drwxrwxrwx   4 root                root                     4096 Jul 27  2018 surveillance
-rw-------   1 root                root                     5120 May 12  2015 synoquota.db
drwxrwxrwx   3 root                root                     4096 May 12  2015 video


From Media

@Frank4263

One last time before I get ugly with it (it’s not behaving as it should)

  1. Again confirm your metadata is still in the “Plex” shared folder
  2. Uninstall + Erase
  3. Delete the PlexMediaServer shared folder
  4. Manual Install - NORMAL installation,

You might have uncovered a timing problem in my installer which shouldn’t exist.
If it does, I have some deep diving to do

The metadata folder under Plex contains folders for Albums, Artists, Movies and TV Shows. Each of those 4 have folders of 0 - 9 and a - f. Long random names within each of those.

Followed the steps again with normal install this time. Install still quick and get pop-up with Installation Successful and warning about setting permissions.

Still no libraries migrated.

As a retired programmer, I always hated debugging those bugs that “shouldn’t exist” so I appreciate your help. Thanks again.

Are you good at reading bash ?

Here’s the logic.

  # No existing DSM 7 installation.  Look for a DSM 6 installation.
  elif [ ! -e "$PlexPkgHome/Plex Media Server" ]; then

    # And if there appears to be a DSM 6-based Plex installation
    # Use first-found directory. "Plex" is default for all DSM 6+ installations.  Users might have moved and used wrong case.

    SourceShare=""
    [ "$(echo /volume[1-9]*/[Pp][Ll][Ee][Xx]]/Library/Application\ Support/Plex\ Media\ Server)" != "/volume[1-9]*/[Pp][Ll][Ee][Xx]/Library/Application Support/Plex Media Server" ] && \
      SourceShare="$(echo /volume[1-9]*/[Pp][Ll][Ee][Xx] | awk '{print $1}')"

    if [ "$SourceShare" != "" ] && [ -d "$SourceShare/Library/Application Support/Plex Media Server" ]; then

      # Test for Plex share access
      if [ "$(synoacltool -get "$SourceShare" | grep "user:PlexMediaServer:allow:rwxpdDaARWcCo:fd--")" = "" ]; then
        MessageText M-ACL-Failure-Plex-Share
        MessageText M-ACL-Procedure
        exit 150
      fi

      # Verify contents are not still in Linux mode but are owned by admin
      if [ "$(synoacltool -get "$SourceShare/Library"                                       | grep Linux)" != "" ] || \
         [ "$(synoacltool -get "$SourceShare/Library/Application Support"                   | grep Linux)" != "" ] || \
         [ "$(synoacltool -get "$SourceShare/Library/Application Support/Plex Media Server" | grep Linux)" != "" ]; then

        MessageText M-ACL-Failure-Plex-Subdirs
        MessageText M-ACL-Procedure
        exit 150
      fi

      # Final check to confirm we have ACL control of subdirectories before continuing.
      Errors=0

      find "$SourceShare/Library/Application Support" -maxdepth 5 -type d | while read Dir
      do
        [ "$(synoacltool -get "$Dir" | grep "user:PlexMediaServer:allow:rwxpdDaARWcCo:fd--")" = "" ] && Errors=$((Errors + 1))
      done

      # If any errors,  do the above again.
      if [ $Errors -gt 0 ]; then

        MessageText M-Cannot-Migrate-ACL-Incomplete
        MessageText M-ACL-Procedure
        exit 150
      fi

      # Perform normal migration of existing Plex server data
      "$ScriptDir/dsm7-migration-tool" "$SourceShare" "$PlexPkgHome"
      [ $? -ne 0 ] && exit $?
    fi
  fi
fi

As I look at that… :man_facepalming: Might have found it.

The permissions of your Plex share might be such that I can’t probe INTO the “Plex” share far enough to see if the contents are a valid Plex server.

That said,

Run the permissions process :slight_smile:

When you are done applying permissions,

Again:

  1. Uninstall Plex
  2. Delete the PlexMediaServer shared folder
  3. Now adjust for maximum :smoking:

I may have written all this but I’m continuing to learn all the different ways it can go wrong thanks to DSM 7.

If what I suspect is true –

It’s a lockout condition. You and the old Plex user can see the files --NOTHING else.

I’ll need to figure out a way around that (early detection somehow) if possible.

PS: I’m retired myself. This was supposed to be my relaxation :rofl:

Sorry, the bash code is greek to me.

Following the instructions, I did find an issue. I have been giving the Plex shared folder read/write permissions for the PlexMediaServer user. The instructions you referenced say it should have full access. I do not have the custom column for the Plex shared folder as I do for the new PlexMediaServer shared folder. Could that be the issue? Any thoughts on why the Plex folder doesn’t allow me to select custom?