Plexmediaserver corrupted database

Hi, i think i had an issue with a disk power cable that i now fixed, but no service is starting.

root@DietPi:\~# journalctl -fu plexmediaserver.service
Feb 06 14:07:45 DietPi systemd\[1\]: plexmediaserver.service: Scheduled restart job, restart counter is at 2.
Feb 06 14:07:45 DietPi systemd\[1\]: Starting plexmediaserver.service - Plex Media Server…
Feb 06 14:07:45 DietPi systemd\[1\]: Started plexmediaserver.service - Plex Media Server.
Feb 06 14:07:45 DietPi Plex Media Server\[2720\]: Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=1 (N4soci10soci_errorE)
Feb 06 14:07:45 DietPi systemd\[1\]: plexmediaserver.service: Main process exited, code=exited, status=255/EXCEPTION
Feb 06 14:07:46 DietPi systemd\[1\]: plexmediaserver.service: Failed with result ‘exit-code’.
Feb 06 14:07:51 DietPi systemd\[1\]: plexmediaserver.service: Scheduled restart job, restart counter is at 3.
Feb 06 14:07:51 DietPi systemd\[1\]: plexmediaserver.service: Start request repeated too quickly.
Feb 06 14:07:51 DietPi systemd\[1\]: plexmediaserver.service: Failed with result ‘exit-code’.
Feb 06 14:07:51 DietPi systemd\[1\]: Failed to start plexmediaserver.service - Plex Media Server.

Sonarr, bazarr and radarr are starting fine. I have the plexmediaserver mounted in a raid5 arrayt via bind, but i think this folder was not available during the hard drive issue. The issue probably was that when upgrading the server’s CPU i must have left a loosen sata power cable and a disk was resetting the link all the time. Now i have tighten all cables and the thing got fixed but plexmediaserver is screwed. How can i regenerate the corrupted data or DB without reinstalling?

Best regards.

I think i fixed, i realized that plexmediaserver keeps backups and restored one of those.

1 Like

Now i’m dealing with some strange behavior of dietpi-drive_manager

It seems that drive_manager freezes because there is a mounted folder from an external hard drive i used to copy some media (USB hard drive) that it is not connected right now and is still shows in mount

root@DietPi:\~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=1958964k,nr_inodes=489741,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=600,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=396060k,mode=755,inode64)
/dev/sdc1 on / type ext4 (rw,noatime,lazytime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=41,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1535)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,nosuid,nodev,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/credentials/systemd-journald.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
systemd-1 on /mnt/backup type autofs (rw,relatime,fd=57,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=3731)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,lazytime,size=3145728k,inode64)
tmpfs on /var/log type tmpfs (rw,nosuid,nodev,noatime,lazytime,size=1048576k,inode64)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
/dev/md3 on /mnt/raid5 type ext4 (rw,noatime,stripe=512)
/dev/md3 on /mnt/dietpi_userdata type ext4 (rw,noatime,stripe=512,x-systemd.after=local-fs.target)
/dev/md3 on /opt type ext4 (rw,noatime,stripe=512,x-systemd.after=local-fs.target)
/dev/md3 on /var/lib/plexmediaserver type ext4 (rw,noatime,stripe=512,x-systemd.after=local-fs.target)
tmpfs on /run/credentials/getty@tty1.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
root@DietPi:\~#

the mount is

systemd-1 on /mnt/backup type autofs

Sonarr and even accessing to tha tfolder in the terminal causes the terminal to not give back the prompt. dietpi-drive_manager just hangs there for ages

I once managed to access the drive_manager throug dietpi-launcher and the backup external disk was not there, i just wanted to remove it.

It is not in the fstab also

root@DietPi:\~# cat /etc/fstab
# You can use “dietpi-drive_manager” to setup mounts.
# NB: It overwrites and re-creates physical drive mount entries on use.
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------
#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs size=3G,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=1G,noatime,lazytime,nodev,nosuid
#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf, glusterfs, mergerfs, bind, Btrfs subvolume
#----------------------------------------------------------------
/mnt/raid5/plexmediaserver  /var/lib/plexmediaserver  none  bind,nofail,x-systemd.after=local-fs.target  0  0
/mnt/raid5/opt  /opt  none  bind,nofail,x-systemd.after=local-fs.target  0  0
/mnt/raid5/dietpi_userdata /mnt/dietpi_userdata none bind,nofail,x-systemd.after=local-fs.target 0 0
#----------------------------------------------------------------
# SWAP SPACE
#----------------------------------------------------------------
#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
UUID=ede52685-b675-4db7-8920-ea48aabebaf3 / ext4 noatime,lazytime,rw 0 1
UUID=a523a189-4b48-49b4-81af-d7508e38261e /mnt/raid5 ext4 noatime,lazytime,rw,noauto,x-systemd.automount

how can i fix this? because i cannot add a directory to sonarr because when i click in /mnt in keeps spinning for ages, i think its because backup folder is there.

Cheers.

simply force an unmount

sudo umount -f /path/to/mountpoint

or reboot the system.

It never gives me the prompt back.

What exactly do you mean by that?

Unlike Windows, Linux typically does not provide any feedback when a command has been successfully executed. This has nothing to do with DietPi, but applies to all Linux-based systems. Normally, feedback is only provided when an error occurs or when you have a script that explicitly generates output.

Or do you mean that it then hangs? In that case, the system is unable to perform the unmount correctly, but should come back after a timeout. The easiest way to resolve this is to reboot the system.

I ended up rebooting and deleting the mount point. I’m running into all sort of different problems, this time on plex, i add some movies and series in their folders, re-scan de media and they never show up. I even created another directory to import from, and nothing. I’m issuing this commands in dietpi for ownership and it always worked fine.

chown -R radarr:dietpi /mnt/raid5/peliculas/
chmod 777 /mnt/raid5/peliculas/*
chown -R sonarr:dietpi /mnt/raid5/series/
chmod 777 /mnt/raid5/series/*

should i reinstall plexmediaserver all together? journalctl shows nothing.

I ended up reinstalling plexmedia server but had to do it manually through the .deb file because dietpi wont download plexmanager due to some key issues in the repository. I hope i can make backups of the collection since i spend time fixing titles, posters and correcting year versions of thing that have the same name.

Cheers!

Your commands only apply to the files inside the folders, but the folder itself need execute permissions so plex can enter it. The user is also almost not important, since plex, radarr and sonarr users belong to the dietpi group.

chmod -R 777 /mnt/raid5/peliculas
chmod -R 777 /mnt/raid5/series
chown -R radarr:dietpi /mnt/raid5/peliculas
chown -R sonarr:dietpi /mnt/raid5/series

edit:

If you want to be more strict and don’t use 777, you can do

chown -R :dietpi /mnt/raid5/peliculas
chown -R :dietpi /mnt/raid5/series

chmod -R 775 /mnt/raid5/peliculas
chmod -R 775 /mnt/raid5/series

chmod g+s /mnt/raid5/peliculas
chmod g+s /mnt/raid5/series

The developers at Plex themselves tampered with their repository, which led to the errors. Dietpi-update issues (plexmediaserver). · Issue #7925 · MichaIng/DietPi · GitHub