Problem installing server on laptop after Linux re-installation from backup

Server Version#: ?
Player Version#:
I had Plex installed on my laptop running Linux, but owing to some problems I re-installed everything from a Live-USB backup. My media is stored on an external disk. After the re-installation of Linux from the backup, Plex does not see the directory where my media is kept. I tried re-installing Plex, uninstalling it completely and re-installing it, but the problem continues. The installation process indicates a number of errors as shown below.

The following NEW packages will be installed:
  plexmediaserver
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/75.7 MB of archives.
After this operation, 193 MB of additional disk space will be used.
Selecting previously unselected package plexmediaserver.
(Reading database ... 295683 files and directories currently installed.)
Preparing to unpack .../plexmediaserver_1.32.6.7557-1cf77d501_amd64.deb ...
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Pre-installation Validation complete.
Unpacking plexmediaserver (1.32.6.7557-1cf77d501) ...
Setting up plexmediaserver (1.32.6.7557-1cf77d501) ...
PlexMediaServer install: PlexMediaServer-1.32.6.7557-1cf77d501 - Installation starting.
PlexMediaServer install: 
PlexMediaServer install: Now installing based on:
PlexMediaServer install:   Installation Type:   New
PlexMediaServer install:   Process Control:     systemd
PlexMediaServer install:   Plex User:           plex
PlexMediaServer install:   Plex Group:          plex
PlexMediaServer install:   Video Group:         render
PlexMediaServer install:   Metadata Dir:        /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer install:   Temp Directory:      /tmp 
PlexMediaServer install:   Lang Encoding:       en_US.UTF-8
PlexMediaServer install:   Processor:           Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
PlexMediaServer install:   Intel i915 Hardware: Found
PlexMediaServer install:   Nvidia GPU card:     Not Found
PlexMediaServer install:  
PlexMediaServer install: Completing final configuration.
useradd: group plex exists - if you want to add this user to that group, use -g.
PlexMediaServer install: ERROR: Cannot create user "plex".  Error:  0
groups: ‘plex’: no such user
usermod: user 'plex' does not exist
PlexMediaServer install: ERROR: Cannot add 'plex' to video group 'render'. Error:  0
PlexMediaServer install: WARNING:  Could not add 'plex' to video group 'video'.  Error  0
usermod: user 'plex' does not exist
chown: invalid user: ‘plex:plex’
PlexMediaServer install: ERROR: Cannot set ownership of '/var/lib/plexmediaserver' to user 'plex:plex'. Error:  0
PlexMediaServer install: Plex Media Server: ver PlexMediaServer-1.32.6.7557-1cf77d501 - Installation failed. Final configuration not performed.
PlexMediaServer install: Assistance is available in our Support Forums.
PlexMediaServer install: both
Processing triggers for desktop-file-utils (0.26-1) ...
dpkg: error processing package plexmediaserver (--configure):
 installed plexmediaserver package post-installation script subprocess returned error exit status 255
Processing triggers for gnome-menus (3.36.0-1.1) ...
Processing triggers for mailcap (3.70+nmu1) ...
Errors were encountered while processing:
 plexmediaserver
E: Sub-process /usr/bin/dpkg returned an error code (1)

Apparently the plex:plex user may not have been removed by the Plex uninstall.

Anyway, I’m appealing for help. That’s what the installation script suggests too!

EDIT: After some effort I managed to install Plex with no errors reported. However, It doesn’t find my media folders when I try to add a library. It doesn’t show me all folders on my system. It’s probably a permissions problem, but I don’t know exactly how to change them. I had it working before the re-installation, but I don’t what steps I took to make it work. It took me along time and in the end I don’t recall exactly what I did.

Any help would be appreciated.

Im going to agree that it is probably permissions https://support.plex.tv/articles/200288596-linux-permissions-guide/

Oh, This is NOT cool!!!

If I send you a PM, would you please share a few files with me?
There’s no reason for these errors to pop up.

There is something causing a complete meltdown of the script.

This is running as root ??

As for permissions, where is the media and what are the directory permissions.
755 is the best to use for basic permissions to get you started.
(644 for files ) with you being the owner of the media and the media files NOT mounted by the automounter

I read the guide as carefully as I could, but honestly as useful as it is about permissions, it doesn’t end with concrete instructions for the layman about what to do.

@Plexmandahl

Which distribution and version are you using please?

I’m the engineer who wrote the installation scripts so know what they can, can’t. should, and shouldn’t do.

What you have shown baffles me and I’m VERY curious

@ChuckPa I would greatly appreciate any help you can give me. It’s so frustrating not to get it working!

I’m not running Plex as root, if this is what you mean.

The media is on a partition on an external disk attached to my laptop. The disk also happens to have another partition formatted to NTFS, but my partition is formatted as ext4. It works in all other respects anyway. The path to the media folder is /media/my-username/My-Backups/TV. I tried all sorts of permissions, but only on the My-Backups and TV folders.

Plex is running as plex:plex (user:group).

Plex never runs as root (unless you override the default installation)

Which distro are you using.

You referred to NTFS.

If you’re trying to install on NTFS using WSL – you won’t have much luck.

WSL / WSL2 isn’t strong enough to run a minimal Debian environment
That explains the contractions about user plex existing and then not existing.

Is this what you’re doing?
(You didn’t say which distro & version you’re using – That info would be really helpful)

On any supported Linux, PMS just installs and runs.
It will configure the directories (/var/lib/plexmediaserver) and go

Permissions are very simple but WILL get caught up if the Automounter (Gnome/Nautilus) is doing the mount because that blocks plex from seeing the media .

I’m running Plex on MX Linux. What’s irritating me is that despite a few problems that I had when I first installed it, I managed to get it working. I recall it was something to do with permissions, but unfortunately I didn’t take notes because I was very tired after many hours of trying to get it to work.

When I re-installed MX Linux I had a different problem and I changed the permissions on the partition that has my media files directory on it. This is what must have broken it.

I used to have Plex on Windows and that’s why the disk already has an NTFS partition on it.

Plex is happily working in all other respects except in seeing my media directory. It only sees a few other directories, certainly not my Home directory (as it shouldn’t I guess).

Please let me know what other information would be helpful.

EDIT: The permissions on my path to the media directory are as follows:
ls -al /media
drwxr-x—+ 6 root root 4096 Oct 16 23:54 media

ls -al /media/fred
drwxr-xr-x 12 fred fred 4096 Oct 17 00:50 fred (that is My-username)

ls -al /media/fred/My-backups
drwxr-xr-x 4 fred fred 4096 Oct 17 01:21 TV

ls -al /media/fred/My-backups/TV
drwxr-xr-x 3 fred fred 4096 Oct 17 01:21 (name of directory)

MX bothers me but as long as it doesn’t bother – ok for now.

As for your media, Mounting NTFS for Plex to use takes a few steps.

Because of that. I have a How-To already written.
Please take a look and see if it helps.

You’re correct. Plex should not see your home directory not anything else you’ve not expressly given permission to (that’s how Linux works – ultra strict)

Here’s the link to the How-To.
Don’t hesitate to ask if you’ve any trouble following.

Thank you for the link. I think I confused you about NTFS. It’s really irrelevant to the problem other than that an NTFS partition resides on the same external disk where I have my MX data partition which is formatted as ext4.

I’m trying to get Plex to see the directories in my ext4 partition. Did the permissions list that I posted earlier give any clue?

you want plex to get into the directories on the mounted drive / partition, right?

Whether internal or external, NTFS, EXT4. AFS. BTRFS, XFS or even ZFS the permissions of the mount point directory matter

In the How-To I linked. Scroll down to step “C”.

Look at this part
 It’s critical

Having created the directories as root, verify empty (unmounted) directory permissions are 0755 before mounting

This applies to other partitions you are going to use for media with Plex.

The system apps are all root – so that doesn’t matter.
You own everything so already have permission.
Plex is unprivileged so you have to open
– first the mount point
– then mount the partition
– lastly confirm the permissions again with the partition mounted and into the subdirectories

I have a few commands to help you fix permissions for your media inside the EXT4 partition when you’re ready

Thank you! I’m going through the procedure, but I don’t understand the critical point that you emphasize. The directory /disks has the following permissions:

ls -al /disks

total 8
drwxr-xr-x 2 fred fred 4096 Oct 17 06:14 .
drwxr-xr-x 20 root root 4096 Oct 17 06:14 ..

Is this correct?

Hopefully we’ll get it to work with my external disk!

YES
 that’s what the directory itself, before you mount the disks should look like.

Now, create a directory for each disk you want to mount like I show in the example.

You can mount once by hand to confirm it works.
We’ll then tweak if we need to.

The last thing we’ll do is make the permanent entries in /etc/fstab (to mount) so it will happen automatically at startup before Plex starts

I don’t see a directory /etc/fstab in Section D of your note.

Section “D”.

As root, we edit /etc/fstab (the filesystem table mount config)
/etc is the directory. fstab is the file. :slight_smile:

I apologize for bothering you again, I don’t have any of the suggested editors. I have FeatherPad. Is it alright to use it?

I presume that I’ll create a file fstab inside /etc. Am I correct? (I’m being extra careful, I don’t like to risk it!)

As long as you have a Linux text editor – that’s all that matters.

Just don’t break /etc/fstab (it’s critical)

Yes. you create entries in /etc/fstab for the partitions you want mounted and where you want them mounted.

The file fstab has this content:

# Pluggable devices are handled by uDev, they are not in fstab
UUID=b84d9028-4638-429b-a165-6148f4973cc0 / ext4 noatime 1 1
UUID=F89B-A1C5 /boot/efi vfat noatime,dmask=0002,fmask=0113 0 0
/swap/swap swap swap defaults 0 0

The # text is in red!

moderator edit: Formatting.

sure, they are trying to discourage you from using /etc/fstab without knowing what you’re doing.

udev does not override /etc/fstab. it’s /etc/fstab first then udev picks up stragglers

In your notes you use as an example ```
UUID=50f1a141-bc8a-48ba-9b29-8a7bee8043e9 /disks/media3 ext4 defaults,auto,rw,nofail 0 1

What would be the equivalent to media3 in my case? I’m not sure.