Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding a new TV to Plex corrupts the SQLite db

Featured Replies

I've been facing an issue where my com.plexapp.plugins.library.db DB corrupts.  I've narrowed it down with this repro:

  • Download a new TV show
  • Place it in my TV media directory
  • Plex will notice a new show was added and start to add it to my Plex library
  • The DB will corrupt

I then need to restore my db files from the previous days backup.  I then click "Scan Library Files" in Plex to find the missing TV show, it finds and adds it without issue. 

Things work great until it automatically finds new media.

This is how I restore:

DATE="2019-06-01"
rm -f com.plexapp.plugins.library.db-shm
rm -f com.plexapp.plugins.library.db-wal
rm -f com.plexapp.plugins.library.blobs.db
rm -f com.plexapp.plugins.library.db
cp com.plexapp.plugins.library.blobs.db-$DATE  com.plexapp.plugins.library.blobs.db
cp com.plexapp.plugins.library.db-$DATE com.plexapp.plugins.library.db

Anyone have any idea of what could be going on?

I've tried changing my config directory from /mnt/user/appdata/plex to /mnt/user/cache/plex and that causes 100% corruption 100% of the time. I can't even get Plex to start when I point at /mnt/user/cache/plex.

 

I've ran SMART on the disk that contains the DB and there are no errors.

I run a VM on the SSD cache drive and have no issues.

My cache drive (SSD) has this SMART self-test history:

 

Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Vendor (0x60)       Completed without error       00%      4108         -
# 2  Offline             Completed without error       00%         0         -
# 3  Offline             Completed without error       00%         0         -
# 4  Offline             Completed without error       00%         0         -
# 5  Vendor (0x54)       Completed without error       00%         0         -
# 6  Vendor (0xb3)       Unknown status (0xe)          60%       211         -
# 7  Vendor (0x9d)       Unknown status (0xe)          50%     57544         -
# 8  Vendor (0xa5)       Unknown status (0xe)          50%     57032         -
# 9  Offline             Completed without error       00%         0         -
#10  Offline             Completed without error       00%        64         -
#11  Offline             Completed without error       00%         0         -
#12  Offline             Completed without error       00%         0         -
#13  Offline             Completed without error       00%         0         -

 

And this SMART error log:

Warning: ATA error count 2830 inconsistent with error log pointer 4

ATA Error Count: 2830 (device log contains only the most recent five errors)
	CR = Command Register [HEX]
	FR = Features Register [HEX]
	SC = Sector Count Register [HEX]
	SN = Sector Number Register [HEX]
	CL = Cylinder Low Register [HEX]
	CH = Cylinder High Register [HEX]
	DH = Device/Head Register [HEX]
	DC = Device Command Register [HEX]
	ER = Error register [HEX]
	ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 2830 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.776  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.776  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.745  SET FEATURES [Enable write cache]

Error 2829 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.729  SET FEATURES [Enable write cache]

Error 2828 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.714  SET FEATURES [Enable write cache]

Error 2827 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.698  SET FEATURES [Enable write cache]

Error 2826 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.698  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.698  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.682  SET FEATURES [Enable write cache]

 

It's /mnt/cache, not /mnt/user/cache.

The last still goes through the fuse system and might cause sqlite database corruption.

You do have a cache drive? If not, you need to move the plex appdata to on disk and use /mnt/diskX as that goes directly to disk the same way as using /mnt/cache.

  • Author

Thank you very much. I’m out right now but will test this as soon as I return and update this thread with the results.

  • Author

No luck when using /mnt/cache. I copied everything there and the corruption still occurs, even if I restore from a good copy.

  • Author

/mnt/disk3 doesn't work either.

  • Author

I was able to get it up and running on /mnt/disk3. Problem was permissions on the db files. Added +w and I'm good there now. I'll see how things go for a few days and report back. 

  • Author

One additional note, /mnt/cache works as well, same permissions issue. add "chmod +w *" on the db files fixed my loading issue. I'll run it on the cache drive for a few days. I guess with this, I'll need to backup to the array manually?

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.