Database is readonly. How to correct permissions?

Hi,

I was having some problems with the ‘Recommended’ tab not loading so I ran the database fix from this guide here.

Since the repair Plex is not able to start due to a readonly database.

The db file is set with plex:plex as the owner and I’ve tried a few different permissions including 777.

What are the correct permissions for the database file?

Cheers,
Jon

Jan 04, 2021 12:22:21.333 [0x7fb3a7f69700] INFO - Processor Intel(R) Core(TM) i7-6700T CPU @ 2.80GHz
Jan 04, 2021 12:22:21.333 [0x7fb3a7f69700] INFO - ./Plex Media Server
Jan 04, 2021 12:22:21.333 [0x7fb3b0efd780] DEBUG - BPQ: [Idle] -> [Starting]
Jan 04, 2021 12:22:21.334 [0x7fb3b0efd780] ERROR - Unable to open named mutex 9334581e-7251-4ef7-a8ec-5bfe8e89ff68 with option 1: Permission denied
Jan 04, 2021 12:22:21.334 [0x7fb3b0efd780] DEBUG - FeatureManager: Using cached data for features list
Jan 04, 2021 12:22:21.334 [0x7fb3b0efd780] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.26.0, threadsafe=1
Jan 04, 2021 12:22:21.336 [0x7fb3b0efd780] ERROR - SQLITE3:(nil), 14, cannot open file at line 38389 of [bf8c1b2b7a]
Jan 04, 2021 12:22:21.336 [0x7fb3b0efd780] ERROR - SQLITE3:(nil), 14, os_unix.c:38389: (2) open(/var/snap/plexmediaserver/common/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-journal) - No such file or directory
Jan 04, 2021 12:22:21.336 [0x7fb3b0efd780] ERROR - SQLITE3:(nil), 1544, statement aborts at 1: [PRAGMA journal_mode=WAL] attempt to write a readonly database
Jan 04, 2021 12:22:21.336 [0x7fb3b0efd780] ERROR - Database corruption: sqlite3_statement_backend::loadOne: attempt to write a readonly database

Server Version#: 1.21.1

When you perform the repair procedure, the access permissions and the “owner” of the file are set to the user account under which the repair procedure was performed.
i.e. most likely it will be now root, instead of plex.

Thanks for the incredibly quick response there.

You were correct - the owner should be root and not plex. I had been playing around with various permissions so the following fixed the issue:

chown -R root:root Databases
chmod -R 644 Databases

Cheers,
Jon

Actually, it should be the other way around. You should never run any app as the user root. By default, Plex is running as user account plex.
(Unless you are using some special kind of Linux where this fundamental security priciple has been disabled. root is the “super user” which has full rights to do anything on your system. Which means that if any app which is running as root has a bug or a security flaw which makes it susceptible to hacking, the consequences can be disastrous.)

That was my confusion with looking at documentation and not having much success.

My Plex is installed via snap (Ubuntu 20.04.1 LTS, no special modifications).

It wasn’t working with permissions set as plex, only root and I’ve always observed via top that all the Plex services run as root. I see what you mean - this probably isn’t a good idea.

I have no experience with Snap, so it might just be a quirk of this system.

Yeah I think it works pretty differently to the standard .deb install … which is how I wish I had installed it.

It’s also not installed as a standard service and needs to be restarted via snap restart plexmediaserver.

Definitely a few ‘quirks’.

SNAP packages all run as root, in their SNAP containers, per SNAP rules.

They are nothing like their native package counterparts.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.