-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
nixos/jellyfin: better defaults for hardware acceleration #175439
Conversation
DeviceAllow = [ | ||
"/dev/dri/*" | ||
]; | ||
SupplementaryGroups = [ "video" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wiki also suggests render
. However I don't think nixos has such a group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my system, /dev/dri/render*
devices belongs to the render group (and /dev/dri/card*
to the video group), so I think it is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
$ ls /dev/dri/render* -l
crw-rw-rw- 1 root render 226, 128 May 28 22:38 /dev/dri/renderD128
@@ -64,14 +64,16 @@ in | |||
AmbientCapabilities = ""; | |||
CapabilityBoundingSet = ""; | |||
|
|||
# ProtectClock= adds DeviceAllow=char-rtc r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not so sure what to do with this one? Do I still need to pass an empty DeviceAllow
before I make additions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess its not relevant anymore because we are already dropped ProtectClock before that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would personally replace this line with ProtectClock = true
, now. I think I remember putting that comment here because there was a conflict between ProtectClock = true
and DeviceAllow = ""
/ PrivateDevices = true
, but it shouldn't bother us anymore. In any case, I don't see a usecase for jellyfin to modify the hardware / system clock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It cannot do this anyway because the system call filter below blocks such system calls. I don't think an unprivileged user could do this anyway and setuid is not allowed either.
The "render" group came from the jellyfin documentation, just added it ( https://jellyfin.org/docs/general/administration/hardware-acceleration.html ) I thought about adding a flag for enabling access to /dev/dri, however i am unsure if it would really provide some security benefits in contrast to the complexity of users trying to find out why hardware transcode does not work. |
"/dev/dri/*" | ||
]; | ||
SupplementaryGroups = [ "video" ]; | ||
PrivateDevices = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to explicitly set it to false here? I'm not aware of an option set here that sets PrivateDevices = true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason was that when keeping it set to true still does not work for me ... i have not investigated further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a note we should probably keep the comment original
Disabled to allow Jellyfin to access hw accel devices endpoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my wording was a bit ambiguous: I don't mind having PrivateDevices set to false, but since it should be the default behavior, why not remove this line entirely?
I haven't tested this yet, but in principle I'm all for it. One thing to note is from the
From what I understand, this would mean that |
@minijackson i will test your proposal |
see also: |
I checked the different parameters, however i have not managed to get jellyfin to transcode without setting Upstream also essentially gave up: jellyfin/jellyfin@dd8b9e9#diff-3d806a09406ac27e205da315a5f9ad987eec663f657b3dda296b4712c8a73d73R27 according to #163491 (comment) adding nvidia-specific whitelisting works, however i cannot get it running for vaapi with my intel card. Error:
adding "render" supplementaryGroup is mandatory for transcoding to work |
we should use upstream settings unless we need to do something nixos specific |
I synced this up now with upstream. |
StateDirectory = "jellyfin"; | ||
StateDirectoryMode = "0700"; | ||
CacheDirectory = "jellyfin"; | ||
CacheDirectoryMode = "0700"; | ||
UMask = "0077"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the only settings we add. Everything else should be pretty much the same as upstream.
@@ -49,56 +49,61 @@ in | |||
after = [ "network.target" ]; | |||
wantedBy = [ "multi-user.target" ]; | |||
|
|||
# This is mostly follows: https://github.com/jellyfin/jellyfin/blob/master/debian/jellyfin.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean https://github.com/jellyfin/jellyfin/blob/master/fedora/jellyfin.service (fedora instead of debian)? I got confused because following the link I saw no hardening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like they dropped stuff again from debian.
@ofborg test jellyfin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
Description of changes
I have not tested any of that. I just changed this based on recent additions to the wiki: https://nixos.wiki/wiki/index.php?oldid=7605&rc_id=7898
cc @makefu for testing
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes