Media Server

Typically a TV with its remote controller and built in software acts as user interface and is the DLNA client.

Therefore the DLNA server is not made visible to the regular user and a simple server as minidlna appears the same way as a featured one as gerbera.

minidlna

See man minidlnad and man minidlna.config

The configuration file is /etc/minidlna.conf and /etc/defaults/minidlna. It holds all the paths to be used as media directory and log file path.

The path to the directory or directories containing the media has to be set.

minidnlad the minidlna daemon is meant to be run as user and group minidlna

The minidlna daemon is started as usual sudo systemctl start minidlna

To see if it is happy sudo cat /var/log/minidlna/minidlna.log

The database is at /var/cache/minidlna

minidlna database and cache

With the minidlna daemon stopped sudo systemctl stop minidlna run sudo -u minidlna mindlnad -R to rebuild the media cache, observe in the console. It will not stop.

minidlna autofs issue

If sudo systemctl status autofs shows nothing, The sudo systemctl status minidlna might show an error as: /lib/systemd/system/minidlna.service:4: Failed to add dependency on autofs, ignoring: Invalid argument

The /lib/systemd/system/minidlna.service might ask for autofs, but the setup does not need autofs. Therefore delete autofs in the following line in /lib/systemd/system/minidlna.service

After=local-fs.target remote-fs.target autofs

sudo systemctl daemon-reload and sudo systemctl start minidlna

inotify errors

sudo cat /var/log/minidlna/minidlna.log might show errors as monitor.c:222: warn: WARNING: Inotify max_user_watches [29927] is low or close to the number of used watches [393] and I do not have permission to increase this limit. Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.

I notify watches are used to detect if files and directories get changed. There is a limit for those watches. It can be observed with: sudo cat /proc/sys/fs/inotify/max_user_watches

The number can be temporary increased by sudo sysctl fs.inotify.max_user_watches=<n>

for permanently edit /etc/sysctl.conf

fs.inotify.max_user_watches=<n>

and sudo sysctl -p

It is also possible to not use inotify watches. Add

inotify = no

in /etc/minidlna.conf

Since inotify watches use a lot of resources, disabling inotify watches might be considered for big media data on a small devices with not much data that changes. In this case the the minidlnad must be stopped from time to time and restarted with minidlnad -r to force a rescan of the data.

udp_notify errors

sudo cat /var/log/minidlna/minidlna.log might show errors as minissdp.c:324: error: sendto(udp_notify=10, 192.168.10.1): Required key not available

In this case the IP address comes from an additional wireguard interface. Setting in /etc/minidlna.conf

network_interface=eth0

removes those errors

Gerbera

https://gerbera.io/ is a media server an evolution of mediatomb, it allows devices as TV's to access media data.

sudo apt search gerbera to see what version would be installed and check the Internet what version is actual. Since Debian might offer just a outdated version consider to move away from the official Debian repository and add the one from gerbera, visualization, use a gentoo linux or use the easier package minidlna.

sudo apt install gerbera to get it

gerbera --version shows what version got installed

Do not run gerbera as user , use the systemd service to run https://docs.gerbera.io/en/stable/daemon.html#daemon

sudo useradd --system gerbera

sudo mkdir /etc/gerbera

sudo chown -Rv gerbera:gerbera /etc/gerbera

sudo systemctl daemon-reload to include the service that came with the installation

sudo systemctl start gerbera

As sudo systemctl start gerbera shows the web user interface can be reached as http://<hostname or ip address>:49152 if it is disabled enable the ui in /etc/gerbera/config.xml

Note

For security reasons it is recommended to have the ui disabled (it is therefore also disabled on a fresh install)

Change the name in /etc/gerbera/config.xml to something unique


Linurs startpage