LinuxGeek28's picture

Getting started with TurnKeyLinux templates as Linux Containers in LXD.

This tutorial assumes you have a working LXD instalation (version 3.23 or greater) and does not cover setup and configuration of LXD -- there are plenty of these guides.

Pro tip 1: If possible, use the snap version of LXD to get the most current features.
# sudo snap install lxd  (on ubuntu systems)

Pro tip 2: add your user to the lxd group so that you don't need to use sudo before every command (requires logging out/in to take effect)

This guide was adapted from:  
https://ubuntu.com/tutorials/create-custom-lxd-images#1-overview
https://linuxcontainers.org/lxd/getting-started-cli/
https://us.images.linuxcontainers.org/
https://help.ubuntu.com/lts/serverguide/lxd.html
https://www.turnkeylinux.org/docs/builds


===========================
Visit and download your desired images:
===========================
http://mirror.turnkeylinux.org/turnkeylinux/images/proxmox/

e.g.

debian-9-turnkey-core_15.0rc1-1_amd64.tar.gz

===========================
Create a metadata file:
===========================
The metadata.yaml file describes things like image creation date, name, architecture and description.
To create an LXD image, we need to provide such a file. Here’s an example of how simple metadata file should look:

# nano metadata.yaml

architecture: "x86_64"
creation_date: 1584391985 # use `date +%s` command
properties:
architecture: "x86_64"
description: "Debian Stretch Turnkey Core"
os: "debian"
release: "stretch"

After creating the metadata file, create a tarball containing this file:

# tar -cvzf metadata.tar.gz metadata.yaml

=====================================
Importing LXD images
=====================================
Next, import the two tarballs into LXD image:

# sudo lxc image import metadata.tar.gz debian-9-turnkey-core_15.0rc1-1_amd64.tar.gz --alias tkl-core-9

We can now create a new container from this image:
syntax: lxc launch <image/alias name> <new container name>

# lxc image list

# lxc launch tkl-core-9 tkldemo

====================================
Connect to terminal as root and set initial password:
====================================

# lxc exec <<container-name>> bash

Set initial root password:

root@container# passwd

root@container# exit

======================================================
Now Run inital TKL setup using ssh
(IP can be found by running 'lxc list')
======================================================

# lxc list

# ssh root@i.p.address  (using root password from above)

After completing initial setup....

Connect to webmin on port 12321
Connect to web terminal on port 12320
http://i.p.address
https://i.p.address

see more at:  https://www.turnkeylinux.org/core
or the page for the appliance you downloaded.

 

Forum: 
LinuxGeek28's picture

to get HW acceleration/transcoding in Mediaserver (intel i965) you must add the gpu device to the video group, add the video group to jellyfin user, and install the driver software

see here:

https://jellyfin.org/docs/general/administration/hardware-acceleration.h...

host:  lxc config device add <container> mygpu gpu gid=44

root@mediaserver ~# apt install i965-va-driver vainfo

root@mediaserver ~# usermod -aG video jellyfin 

root@mediaserver ~#  systemctl restart jellyfin
Jeremy Davis's picture

Thanks for sharing this gem!

I wonder if there is value in pre-configuring some of this?

I initially thought that we could pre-install some of the components, but the bloat of including all possible drivers OOTB is overkill IMO. And even just vainfo appears to have some significant dependencies. So I guess that just leaves the user/group stuff... Not sure if there is a ton if value in just pre-configuring that? I'd be interested in your thoughts.

LinuxGeek28's picture

First, thanks for taking an interest....

One of the reasons I was so interested in getting a Jellyfin mediaserver working was because HW Transcoding and the DVR add-in do not require a paid subscription like PleX and Emby.  Utilizing HW Transcoding significantly reduces the CPU horsepower (and cost) needed run a capable server.

I do agree that it is a bit much to try to include the drivers OOTB, but, it would be simple (and should be done) to add the jellyfin user to the video group.

Using  an Ubuntu host and an Ubuntu container didn't require installing drivers in the container to get accelerated pass-thru video (not sure about Proxmox).  Anyway, I fought with this issue for about 3 days trying to figure out why I kept getting errors on my Debian container (when all the instructions made it look so dang simple).

Had I used the .iso installer and put it on bare metal (or even a VM), I may not have had the problems I did.  I am sure the linux container and my general lack of experience using them added to my challenges.

Since free HW Acc. is such a key feature to Jellyfin, I think it would be helpful to add some additional comments to the "Usage Detail" section of the Mediaserver info page that to get HW transcoding working... you will need to make sure the video drivers are installed for your particular HW as they may not be included in the default Debian server install.

Finally, include link to the Jellyfin HW Acceleration page for the rest of the details: https://jellyfin.org/docs/general/administration/hardware-acceleration.html

Cheers, Dave.

Jeremy Davis's picture

Whilst I am intimately familiar with the internals of TurnKey and it's build process, when it comes to individual appliances and platforms, my knowledge tends to be broad rather than deep. So having some greater insight into specific appliances and/or software is really useful. So thanks so much for sharing.

Regarding your suggestions, I've noted them as a "feature request" on our "Issue tracker".

Add new comment