RPi 3 B+ fails to start PMS after first reboot upon adding a library

server-raspberry-pi

#1

I've tried to reflash my drive (3 times now?) and set this up multiple times but I've ended up in the same state every time. This is a new install of Plex on a RPi 3 B+. I'm using the dev2day repo with armhf. I can reboot the PI and Plex starts normally as long as I haven't added any libraries. Once I add a library and the initial scan completes I have rebooted the PI. At this point I'm getting an SQLITE error in the logs. I've already tried the instructions to repair a corrupt database to no avail. SQLITE reports there is no problem and I've followed the repair procedure anyways. There are only six lines in the log of relevance and they are as follows.

May 05, 2018 22:16:19.506 [0x745ac0d0] ERROR - SQLITE3:(nil), 11, database corruption at line 59437 of [fc49f556e4]
May 05, 2018 22:16:19.506 [0x745ac0d0] ERROR - SQLITE3:(nil), 11, database corruption at line 59479 of [fc49f556e4]
May 05, 2018 22:16:19.506 [0x745ac0d0] ERROR - SQLITE3:(nil), 11, statement aborts at 8: [] database disk image is malformed
May 05, 2018 22:16:19.506 [0x745ac0d0] ERROR - SQLITE3:(nil), 11, database disk image is malformed
May 05, 2018 22:16:19.508 [0x745ac0d0] ERROR - Database corruption: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000
May 05, 2018 22:16:19.508 [0x745ac0d0] ERROR - Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_siz$

All of my media is on a QNAP NAS and I'm mounting the drives via fstab with a 20 second delay and a 'mount -a' in rc.local.

Not sure what else to try at this point. I guess I could try the beta builds from dynodev?


#2

How did you reboot your RPi? With sudo systemctl reboot? The error is telling you, that the database is completely broken. Either your sd card is broken or there was a power failure. Please try with a different sd card.

Ah. Btw: I just saw that you use the “new” B+. Make sure you use the most recent kernel, so update your system with sudo apt update && sudo apt upgrade. And disable overclocking.


#3

I did an rpi-update and the reboots were completed with sudo systemctl reboot.

Not knowing how I broke it previously I was slightly more meticulous when I did things this last time. I’m pretty sure that this time I did the rpi-update after the first scan was complete. Would that cause database corruption?


#4

I did an rpi-update and the reboots were completed with sudo systemctl reboot.

Do NOT use rpi-update! That’s a developer tool and will get you unstable Linux kernels. It’s only the last resort if something is broke. Always use only apt. Please reinstall the stable kernel with sudo apt-get install --reinstall raspberrypi-kernel.


#5

You know that sinking feeling when you find out that you’re your own source of all your problems…yeah that.

I’ve reinstalled the stable kernel. It looks like I’ll have to remove the old database and re-scan? Thanks for being awesome uglymagoo.


#6

@Nontheist said:
I’ve reinstalled the stable kernel. It looks like I’ll have to remove the old database and re-scan?
I’m afraid so :confused:


#7

Well it gets worse. These are all the steps I did and I’ve had the same failure.

  1. Flash 2018-04-18-raspbian stretch to the SD card
  2. boot RPi, set locale, keyboard, timezone, and enable ssh.
  3. apt-get update and apt-get upgrade
  4. install the stable arm-hf plex server
  5. map my cifs drives with fstab and edit /etc/rc.local with a 20 second delay and a mount -a
  6. added my music collection and started a scan - which lasted most of the day. I watched the status during the scan and everything looked normal. It indexed ~11592 files in 926 folders.
  7. when the scan was done, I noticed that one of the albums was missing artwork so I performed a refresh of the metadata on that album, which succeeded and artwork was added. Then I clicked on the music library and I got a 500 server error.
  8. ssh’d into pi and did sudo systemctl reboot. Pi came back up and I had no web interface. Checked the logs and I see the same errors as before. I’ve attached the Plex Media Server log and the results of sudo systemctl status plexmediaserver.service

I could attempt to make my wife swap her 16GB card for this 32GB card and try again. I don’t know how common it is to have an incompatible microSD. I have a spare 8GB card I could try as well.
:’(


#8

I just looked back at my first post - exact same errors on the same lines. Not sure if that’s relevant or not, just thought it was interesting.


#9

These lines are common for Plex database errors. See e.g. https://forums.plex.tv/discussion/293373/major-problems-since-update

If /var/lib/plexmediaserver is not mounted from a network share then your sd card has to be faulty. That’s the only explanation I can think of :confused:


#10

I pulled my wife’s class 4 16GB PNY brand card and set it up last night to run the same scan on my music folder. It worked, but that class 4 is painfully slow. I had noticed that the other card was very hot when I removed it, so I’m wondering now if this could be temperature related. I want to test a heavy underclock and see if that helps. From what I understand, a major portion of the power draw is for LAN, so I’ll set up wireless for this as well. Thanks for the help uglymagoo!


#11

Just to put a nail in this thread’s coffin - I put a heavy underclock on the PI and it worked. Whether it was a fluke or not…time will tell.

In case anyone needs it:
sudo apt-get install cpufrequtils
running cpufreq-info will tell you your current speed and available profiles
I used sudo cpufreq-set -g powersave which put me at 600MHz on all 4 cores. This is as low as you can go without further editing.

Rebooting the Pi puts the system back at normal speed, so after I scan the rest of my libraries I’ll go back to normal and see how it goes.

I wasn’t able to get wi-fi setup due to another bug on the Pi3 B+, so I can’t say if that would’ve helped.