├── .gitignore ├── scripts ├── lffmpeg └── enable_gpu_jails.sh ├── Installation_BastilleBSD.md ├── FAQ.md ├── README.md └── Installation_TrueNAS_GUI.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.vs 2 | -------------------------------------------------------------------------------- /scripts/lffmpeg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ffmpeg -hwaccel vaapi "$@" 4 | -------------------------------------------------------------------------------- /scripts/enable_gpu_jails.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo '[devfsrules_bpfjail=101] 4 | add path 'bpf*' unhide 5 | 6 | [plex_drm=10] 7 | add include $devfsrules_hide_all 8 | add include $devfsrules_unhide_basic 9 | add include $devfsrules_unhide_login 10 | add include $devfsrules_jail 11 | add include $devfsrules_bpfjail 12 | add path 'dri*' unhide 13 | add path 'dri/*' unhide 14 | add path 'drm*' unhide 15 | add path 'drm/*' unhide' >> /etc/devfs.rules 16 | 17 | service devfs restart 18 | 19 | kldload /boot/modules/i915kms.ko 20 | -------------------------------------------------------------------------------- /Installation_BastilleBSD.md: -------------------------------------------------------------------------------- 1 | # Installation Overview using BestilleBSD 2 | ## Overview 3 | 4 | There is now a community Template for BastilleBSD users made by @leandroscardua ! 5 | 6 | If you already familiar with BastilleBSD, you can go directly to deploy step 7 | 8 | As of Jellyfin >= 10.7.7, installation requires `pkg` >= 1.17.0. This is for the newer `.pkg` format. 9 | 10 | ### Before starts the deploy step 11 | https://bastillebsd.org/getting-started/ 12 | 13 | jellyfin = will be the name of the jail, if you want you can change the name. 14 | step 4 = That configuration will open the port 8096 on host and redirect to the 8096 on the jails. 15 | 16 | ### Deploy step 17 | 18 | 1. bastille create jellyfin 19 | 20 | 2. bastille bootstrap https://gitlab.com/bastillebsd-templates/jellyfin 21 | 22 | 3. bastille template jellyfin https://gitlab.com/bastillebsd-templates/jellyfin 23 | 24 | 4. bastille rdr jellyfin tcp 8096 8096 25 | 26 | ## Updating Jellyfin Installation 27 | 28 | This is similar to installing Jellyfin but with fewer steps: 29 | 30 | - Connect to the jail 31 | bastille console jellyfin 32 | 33 | - Stop the jellyfin service 34 | service stop jellyfin 35 | 36 | - Use `pkg` to install said package 37 | pkg install jellyfin 38 | 39 | - Start the jellyfin server 40 | service start jellyfin 41 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | ## Troubleshooting and other things to note 2 | - I have networking issues like DNS failures or the GUI not responding. 3 | - Make sure you have VNET turned on for your jail. 4 | - If you have VNET and use IPV6 make sure your jail has `ip6=inherit` if using ipv6. Using `ip6=new` will not work. 5 | - Don't try and have jellyfin monitor SMB shares as `libinotify` does not impliment this well. 6 | - Turn off file monitoring This is a known issue in `libinotify` 7 | - From your profile menu select "Dashboard" under "Administration". Click Libraries. On each library click the triple dot and select "Manage Library". Unselect "Enable real time monitoring". Click OK. 8 | - I am getting SQL related errors. 9 | - This should be resolved in current versions but try this: `ln -s /usr/local/lib/libsqlite3.so /usr/local/lib/libe_sqlite3`. `libmap` is used instead of symlinking a library but in very rare cases this can fail. 10 | - Jellyfin can't see my mounts. 11 | - Double check your permissions. Jellyfin does not need to be the owner, but its GID should be a part of a group that can access the mount/file. This is also your reminder to keep UID/GID consistent between host and guest systems. 12 | - The posters aren't rendering. I am seeing `libSkiaSharp` version related errors in the log. 13 | - Tests don't seem to cover if the right version of `libSkipSharp` is bundled with Jellyfin. I try and check the upstream log for what version is now required but I may have missed it. Open a ticket to remind me to rebuild the library. 14 | - System kernel panic or reboot when using VAAPI 15 | - Try this in the BIOS/UEFI : 16 | - Try forcing the integrated GPU as first GPU 17 | - Set at least 128Mb of ram to the integrated GPU and 256 of pre allocated DMVT 18 | - Plug in a monitor or a dummy HDMI connector (some integrated GPU seem to require a monitor for memory allocation) 19 | - My configuration/db/cache got lost/delete during an upgrade! 20 | - Very old versions, <= 10.7.7 including those using the older `.txz` format, stored data in a different place inside the install location for jellyfin (e.g., `/usr/local/jellyfin-server/db/`). Packages made before an official port (<=v10.8.9 including the initial TrueNAS plugin) used `/var/db/jellyfinserver` and `/var/cache/jellyfinserver` Newer packages including those from ports use `/var/db/jellyfin` and `/var/cache/jellyfin`. You can manually move (`mv`) (see here for details: https://github.com/Thefrank/jellyfin-server-freebsd/issues/49#issuecomment-1540190015)) the data or override where jellyfin reads/stores these (`sysrc jellyfin_data_dir=` and `sysrc jellyfin_cache_dir=`) 21 | Jellyfin can't find FFmpeg. 22 | - Jellyfin recently changed how it looks for FFmpeg. You might have to manually point Jellyfin to where FFmpeg is installed. 23 | - FFmpeg is OS/ABI specific. If you jail is FreeBSD 13.1 then don't try and run FreeBSD 13.2 binaries on it. The warnings when doing `pkg update` and `pkg upgrade` should not be ignored. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # (Unofficial) Jellyfin Server for FreeBSD 2 | 3 | Microsoft does not have an official build of dotNET for FreeBSD. See [HERE](https://github.com/dotnet/runtime/issues/14537) for more details. 4 | This repo currently only contains binary components for [Jellyfin-Server](https://github.com/jellyfin/jellyfin) (FreeBSD AMD64) and [Jellyfin-Web](https://github.com/jellyfin/jellyfin-web/) (Portable) in addition to the required and pre-built libSkiaSharp. 5 | 6 | # Upcoming changes to this repo! 7 | 8 | Once a source build option is available for FreeBSD ports, this repo may no longer carry binaries outside of the prebuilt Skia library. This too will be removed when a ports build of Skia is possible. 9 | 10 | Those needing an update ASAP should use the ports version as a guide for building an update. 11 | 12 | I will try and keep the binaries updated. For those that just want them. 13 | 14 | This repo will remain open for those needing questions answered. 15 | 16 | ## Divergence from main project 17 | 18 | This product builds cleanly with a working dotNET SDK under FreeBSD 13.3+. No code modification is required unless you want HWaccel support. 19 | Check "building" if you would like to learn more. 20 | 21 | # Known Issues 22 | 23 | - `libinotify` runs into resource limitations when used to monitor a large number of files. This is typically experienced as DNS or SSL errors. 24 | - Cause: Oversimplified as [Everything is a file](https://en.wikipedia.org/wiki/Everything_is_a_file) 25 | - Workaround: Make sure that "Enable real time monitoring" is disabled for every library. This option is checked by default. 26 | - `ffmpeg` sees very slow transcode rates when compared to other platforms. See [HERE](https://github.com/Thefrank/jellyfin-server-freebsd/issues/67). 27 | - Cause: Unknown. 28 | - Workaround: There is no known workaround for this. This appears to be a FreeBSD or build issue. 29 | - IPv6 support does not work in all jail situations (e.g., TrueNAS CORE created jails, `ipv6=new`, or `vnet=OFF`) 30 | - Cause(s): 31 | - TrueNAS CORE sets up jails in a way that might cause discovery to fail on ipv6 networks. 32 | - FreeBSD exposes a limited amount of data to the jail based on OS or jail security level. 33 | - dotNET uses dual-sockets and runs into issues if only 4 or 6 is visible. 34 | - Workaround: See the [FAQ](FAQ.md) for various workarounds. In some cases, a workaround might not be available. 35 | 36 | # Bugs 37 | 38 | Please **DO NOT** bring bugs about this build or platform to the main jellyfin team. This is **Unofficial**. Open a ticket if you are having issues but please check their official [Issues](https://github.com/jellyfin/jellyfin/issues) first and make sure you have read the [FAQ.md](FAQ.md) first. 39 | 40 | ## License(s) 41 | 42 | - Jellyfin is under GPLv2 43 | - Skia is under BSD-3-CLAUSE 44 | - Bundled combination of the above would likely fall under GPLv2 or some dual license? 45 | 46 | ## One more thing 47 | 48 | Microsoft does not currently support dotNET5+ on FreeBSD so this package and its binaries might have limited support across FreeBSD versions. If you are knowledgeable in the inner-workings of FreeBSD please drop over to https://github.com/dotnet/runtime/issues/14537 if you would like to help out getting dotNET on to FreeBSD. 49 | -------------------------------------------------------------------------------- /Installation_TrueNAS_GUI.md: -------------------------------------------------------------------------------- 1 | # Installation Overview using TrueNAS GUI 2 | ## Overview 3 | 4 | There is now a community plugin for TrueNAS CORE users made by @spz2k9 ! 5 | 6 | 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 7 | 8 | As of Jellyfin >= 10.7.7, installation requires `pkg` >= 1.17.0. This is for the newer `.pkg` format. 9 | As of Jellyfin >= 10.8.9, an official port exists. 10 | 11 | ## The Easy Way 12 | 13 | 1. Use the Community Plugin 14 | 15 | --- 16 | 17 | ## The Advanced Way 18 | 19 | 20 | ### Jail Setup 21 | 22 | 1. From the main screen select Jails 23 | 24 | 2. Click ADD 25 | 26 | 3. Click Advanced Jail Creation 27 | 28 | 4. Name (any name will work): Jellyfin 29 | 30 | 5. Jail Type: Default (Clone Jail) 31 | 32 | 6. Release: 13.1-Release (or newer) 33 | 34 | 7. Configure Basic Properties to your liking but add AT LEAST ONE of 35 | - [x] VNET 36 | - [X] IPv6 37 | 38 | * (Not having VNET means things like DLNA will not work) 39 | * (You may also encouter other networking issues! See: troubleshooting) 40 | * (The service file will try and work around user configuration issues but is not perfect) 41 | 42 | 8. Configure Jail Properties to your liking but add 43 | - [x] allow_raw_sockets 44 | 45 | * (Highly suggested for easier troubleshooting) 46 | - [x] allow_mlock 47 | 48 | * (This is REQUIRED) 49 | 50 | 9. Configure Network Properties to your liking 51 | 52 | 10. Configure Custom Properties to your liking 53 | 54 | 11. Click Save 55 | 56 | 57 | Summary for base FreeBSD users: 58 | 59 | Required: 60 | - Unprivileged mlock (usually allow_mlock=1, allow.mlock=1, or security.bsd.unprivileged_mlock: 1) 61 | - At least one of: 62 | - VNET (usually, vnet=1 or security.jail.vnet: 1) 63 | - If using IPv6: ip6=inherit 64 | 65 | Suggested: 66 | - raw sockets (usually allow_raw_sockets=1 or security.jail.allow_raw_sockets: 1) 67 | 68 | ## Jellyfin Installation 69 | 70 | Back on the jails list find your newly created jail for jellyfin and click "Shell" 71 | 72 | `pkg install jellyfin` 73 | 74 | Don't close the shell out yet we still have a few more things! 75 | 76 | ## Configuring Jellyfin 77 | 78 | Now that we have it installed a few more steps are required. 79 | 80 | ### User and Group Setup 81 | 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. 82 | 83 | We still are not done with the shell! 84 | 85 | ### Service Setup 86 | 87 | Time to enable the service 88 | 89 | `sysrc jellyfin_enable=TRUE` 90 | 91 | If you want to use a different UID/GID please change that now: 92 | 93 | `sysrc jellyfin_user="USER_YOU_WANT"` 94 | 95 | `sysrc jellyfin_group="GROUP_YOU_WANT"` 96 | 97 | Almost done, let's start the service: 98 | 99 | `service jellyfin start` 100 | 101 | If everything went according to plan then jellyfin should be up and running on the IP of the jail (port 8096)! 102 | 103 | (You can now safely close the shell) 104 | 105 | ## Updating Jellyfin Installation 106 | 107 | This is similar to installing Jellyfin but with fewer steps: 108 | 109 | - Stop the current jellyfin server inside the jail shell (NOT THE JAIL) (`service jellyfin stop`) 110 | 111 | - `pkg upgrade` 112 | 113 | - Start the jellyfin server (`service jellyfin start`) 114 | 115 | ## Hardware encoding (Intel) 116 | 117 | ### Packages and script to add inside the Jail 118 | 119 | - Back on the jails list find your newly created jail for jellyfin and click "Shell" : 120 | - Install vautils : `pkg install libva-utils` 121 | - Install intel driver : [VAAPI driver support page](https://github.com/intel/media-driver#decodingencoding-features) 122 | - 4th gen and older : `pkg install libva-intel-driver` 123 | - 5th gen and newer : `pkg install libva-intel-media-driver` 124 | 125 | - Add lffmpeg script to add missing VAAPI command 126 | 127 | Create the lffmpeg script file (available here : [url](scripts/lffmpeg)) 128 | 129 | ``` 130 | cd /usr/local/bin 131 | ee lffmpeg 132 | ``` 133 | 134 | Paste the file content : 135 | 136 | ``` 137 | #!/bin/sh 138 | ffmpeg -hwaccel vaapi "$@" 139 | ``` 140 | 141 | Close the editor with [ESC] and enter 142 | 143 | - Make lffmpeg script executable 144 | 145 | `chmod +x lffmpeg` 146 | 147 | ### Script to add on the TrueNas Core Host 148 | 149 | - Loading kernel module + adding jail config to pass /dev/dri and /dev/drm 150 | - Open a ssh shell on the TrueNas host 151 | Create a script file in the root folder (available here : [url](script/enable_gpu_jails.sh)) : 152 | 153 | `ee /root/enable_gpu_jails.sh` 154 | 155 | Paste the file content : 156 | 157 | ``` 158 | #!/bin/sh 159 | 160 | echo '[devfsrules_bpfjail=101] 161 | add path 'bpf*' unhide 162 | [plex_drm=10] 163 | add include $devfsrules_hide_all 164 | add include $devfsrules_unhide_basic 165 | add include $devfsrules_unhide_login 166 | add include $devfsrules_jail 167 | add include $devfsrules_bpfjail 168 | add path 'dri*' unhide 169 | add path 'dri/*' unhide 170 | add path 'drm*' unhide 171 | add path 'drm/*' unhide' >> /etc/devfs.rules 172 | 173 | service devfs restart 174 | 175 | kldload /boot/modules/i915kms.ko 176 | ``` 177 | 178 | Close the editor with [ESC] and enter 179 | 180 | - Make script executable 181 | `chmod +x /root/enable_gpu_jails.sh` 182 | 183 | - Run the script 184 | `/root/enable_gpu_jails.sh` 185 | 186 | ### Required editing to the Jail and Test 187 | 188 | - Stop the Jellyfin jail 189 | - Open the Edit for the jail 190 | - Navigate to the 'Jail Properties' tab 191 | - Look for the devfs_ruleset (should be the first option on the left) 192 | - Change the rulset number to 10 193 | - Save and start the jail 194 | - Open a shell 195 | - type 'vainfo' and look for entrypoints like : 'VAProfileH264Main : VAEntrypointEncSlice' (there can be multiple) 196 | - add the group video to the Jellyfin user (replace jellyfinserver if the user was changed with the sys_rc command during service setup 197 | - `pw group mod video -m jellyfinserver` 198 | - close the shell 199 | - Connect to the Jellyfin UI 200 | - Verify that playback does work before enabling hardware encoding 201 | - Once software playback is working go to Server --> Playback from the Dashboard 202 | - Change the 'Hardware acceleration:' option from 'None' to 'VAAPI' 203 | - Find the "ffmpeg path" option (arround the middle of the page) 204 | - Change the value from 'ffmpeg' to '/usr/local/bin/lffmpeg' 205 | - Save 206 | - Hardware encoding should now be working 207 | - If everthing now works 208 | - Return to the TrueNas Core UI and navigate to Tasks --> Init/Shutdown Scripts 209 | - Click [ADD] 210 | - Change Type to 'Script' 211 | - Navigate to '/root/enable_gpu_jails.sh' 212 | - Change When to 'PostInit' 213 | - Click [Submit] --------------------------------------------------------------------------------