Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plex: access to media libraries not working anymore #313879

Open
sjau opened this issue May 23, 2024 · 9 comments
Open

Plex: access to media libraries not working anymore #313879

sjau opened this issue May 23, 2024 · 9 comments
Labels
0.kind: bug Something is broken

Comments

@sjau
Copy link

sjau commented May 23, 2024

Describe the bug

I updated nixos-unstable yesterday and now I get error from the front end, that all media files are unavailable.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Setup plex
  2. Setup some media library
  3. journalctl will tell that plex can't access files:
May 23 05:29:26 servi PlexMediaServer[53327]: Couldn't check for the existence of file "/home/plex/Movies/.grab": boost::filesystem::status: Permission denied [system:13]: "/home/plex/Movies/.grab"

Expected behavior

Before updateing nixos-unstable it worked fine. Now it doesn't. Reverting back to previous generation (from beginning of may) also makes it work fine.

Additional context

By default I set ownership to plex:users of the /home/plex/ folder and files. Folders have 0755 permissions, files have 0644.

I tried also adjusting the group to plex with same result.

I also tried ACLs

getfacl /home/plex/Movies
getfacl: Removing leading '/' from absolute path names
# file: home/plex/Movies
# owner: plex
# group: users
user::rwx
user:plex:rwx
group::rwx
group:plex:rwx
mask::rwx
other::rwx
default:user::rwx
default:user:plex:rwx
default:group::rwx
default:group:plex:rwx
default:mask::rwx
default:other::rwx

None of this helped.

I reverted now back to an older generation and it works fine again.

Notify maintainers

@badmutex @Forkk @thoughtpolice @MayNiklas

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.30, NixOS, 24.05 (Uakari), 24.05.git.07ea48392271`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

@sjau sjau added the 0.kind: bug Something is broken label May 23, 2024
@chewblacka
Copy link
Contributor

chewblacka commented May 23, 2024

This commit was added two weeks ago:
nixos/plex: add systemd hardening configuration

I would imagine that might be the culprit. Specifically:

ProtectHome = true;

The above basically stops Plex from seeing anything inside your home folder.

@chewblacka
Copy link
Contributor

Probably the easiest way around this is to bind-mount your media directory to a folder outside your home folder.

@sjau
Copy link
Author

sjau commented May 23, 2024

Why would I want to have it outside home?

@chewblacka
Copy link
Contributor

Why would I want to have it outside home?

So that Plex can see it. At the moment the systemd rules prevent Plex from looking inside your home directory. You can still have the files inside your home dir for convenience, just that they also need to be (bind-mounted) in a location outside for Plex.

@sjau
Copy link
Author

sjau commented May 23, 2024

Or one could just undo that one option - or at least set it to "read-only". Pretty sure I'm not the only one that uses plex in /home. For many years (6+) this has worked fine for me like this on NixOS.

@devusb
Copy link
Contributor

devusb commented May 23, 2024

Think you may also be able alter this setting on your system by something like

systemd.services.plex.serviceConfig.ProtectHome = lib.mkForce false;

where false could also be "read-only" or any other valid choice.

@sjau
Copy link
Author

sjau commented May 25, 2024

Think you may also be able alter this setting on your system by something like

systemd.services.plex.serviceConfig.ProtectHome = lib.mkForce false;

where false could also be "read-only" or any other valid choice.

That works. But I think there should be a notice also that you can set it libarieries in your home.

@zalphoid
Copy link

zalphoid commented Jul 26, 2024

Agreed with @sjau and have also been running Plex on NixOS for years and just came across this issue. I also feel like this change kinda makes setting the user for the service pointless. I assume most people are setting the user to their own user so that plex can access media in their home directory.

It might be best to just expose PretectHome as an option so users can see that it is there and set it if they need it. This way the issue is also "documented" by that option having a description.

@frosklis
Copy link

don't know if related or it's the same bug. I have /usr/share/movies with some media files, it has rx permissions for everybody. And I have plex setup like this

  services.plex = {
    enable = true;
    openFirewall = true;
    user = "plex";
    group = "plex";
  };

It says the folder is empty. Also, it looks like the folders I see from the web ui are not the ones in the server (also not the ones in the client).

First time using NixOS so no idea what I'm doing wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

5 participants