There is now a community plugin for TrueNAS CORE users made by @spz2k9 !
If you are installing from base FreeBSD, I have included some general details that you can use for you jail at the end of the "Jail Setup" section
As of Jellyfin >= 10.7.7, installation requires pkg
>= 1.17.0. This is for the newer .pkg
format.
As of Jellyfin >= 10.8.9, an official port exists.
- Use the Community Plugin
-
From the main screen select Jails
-
Click ADD
-
Click Advanced Jail Creation
-
Name (any name will work): Jellyfin
-
Jail Type: Default (Clone Jail)
-
Release: 13.1-Release (or newer)
-
Configure Basic Properties to your liking but add AT LEAST ONE of
-
VNET
-
IPv6
- (Not having VNET means things like DLNA will not work)
- (You may also encouter other networking issues! See: troubleshooting)
- (The service file will try and work around user configuration issues but is not perfect)
- Configure Jail Properties to your liking but add
-
allow_raw_sockets
- (Highly suggested for easier troubleshooting)
-
allow_mlock
- (This is REQUIRED)
-
Configure Network Properties to your liking
-
Configure Custom Properties to your liking
-
Click Save
Summary for base FreeBSD users:
Required:
- Unprivileged mlock (usually allow_mlock=1, allow.mlock=1, or security.bsd.unprivileged_mlock: 1)
- At least one of:
- VNET (usually, vnet=1 or security.jail.vnet: 1)
- If using IPv6: ip6=inherit
Suggested:
- raw sockets (usually allow_raw_sockets=1 or security.jail.allow_raw_sockets: 1)
Back on the jails list find your newly created jail for jellyfin and click "Shell"
pkg install jellyfin
Don't close the shell out yet we still have a few more things!
Now that we have it installed a few more steps are required.
Creation of a user and group is handled by the package on installation but if you want to use your own, set that up now.
We still are not done with the shell!
Time to enable the service
sysrc jellyfin_enable=TRUE
If you want to use a different UID/GID please change that now:
sysrc jellyfin_user="USER_YOU_WANT"
sysrc jellyfin_group="GROUP_YOU_WANT"
Almost done, let's start the service:
service jellyfin start
If everything went according to plan then jellyfin should be up and running on the IP of the jail (port 8096)!
(You can now safely close the shell)
This is similar to installing Jellyfin but with fewer steps:
-
Stop the current jellyfin server inside the jail shell (NOT THE JAIL) (
service jellyfin stop
) -
pkg upgrade
-
Start the jellyfin server (
service jellyfin start
)
- Back on the jails list find your newly created jail for jellyfin and click "Shell" :
-
Install vautils :
pkg install libva-utils
-
Install intel driver : VAAPI driver support page
- 4th gen and older :
pkg install libva-intel-driver
- 5th gen and newer :
pkg install libva-intel-media-driver
- 4th gen and older :
-
Add lffmpeg script to add missing VAAPI command
Create the lffmpeg script file (available here : url)
cd /usr/local/bin ee lffmpeg
Paste the file content :
#!/bin/sh ffmpeg -hwaccel vaapi "$@"
Close the editor with [ESC] and enter
-
Make lffmpeg script executable
chmod +x lffmpeg
-
- Loading kernel module + adding jail config to pass /dev/dri and /dev/drm
-
Open a ssh shell on the TrueNas host Create a script file in the root folder (available here : url) :
ee /root/enable_gpu_jails.sh
Paste the file content :
#!/bin/sh echo '[devfsrules_bpfjail=101] add path 'bpf*' unhide [plex_drm=10] add include $devfsrules_hide_all add include $devfsrules_unhide_basic add include $devfsrules_unhide_login add include $devfsrules_jail add include $devfsrules_bpfjail add path 'dri*' unhide add path 'dri/*' unhide add path 'drm*' unhide add path 'drm/*' unhide' >> /etc/devfs.rules service devfs restart kldload /boot/modules/i915kms.ko
Close the editor with [ESC] and enter
-
Make script executable
chmod +x /root/enable_gpu_jails.sh
-
Run the script
/root/enable_gpu_jails.sh
-
- Stop the Jellyfin jail
- Open the Edit for the jail
- Navigate to the 'Jail Properties' tab
- Look for the devfs_ruleset (should be the first option on the left)
- Change the rulset number to 10
- Save and start the jail
- Open a shell
- type 'vainfo' and look for entrypoints like : 'VAProfileH264Main : VAEntrypointEncSlice' (there can be multiple)
- add the group video to the Jellyfin user (replace jellyfinserver if the user was changed with the sys_rc command during service setup
pw group mod video -m jellyfinserver
- close the shell
- Connect to the Jellyfin UI
- Verify that playback does work before enabling hardware encoding
- Once software playback is working go to Server --> Playback from the Dashboard
- Change the 'Hardware acceleration:' option from 'None' to 'VAAPI'
- Find the "ffmpeg path" option (arround the middle of the page)
- Change the value from 'ffmpeg' to '/usr/local/bin/lffmpeg'
- Save
- Hardware encoding should now be working
- If everthing now works
- Return to the TrueNas Core UI and navigate to Tasks --> Init/Shutdown Scripts
- Click [ADD]
- Change Type to 'Script'
- Navigate to '/root/enable_gpu_jails.sh'
- Change When to 'PostInit'
- Click [Submit]