Gerbera DLNA initial setup

Hello everybody, have you tried to set up the new DLNA option Gerbera?
It is new from 5.0. to have option to use Gerbera instead of miniDLNA.
As I am the one having difficulty with miniDLA I wanted to try it.
Nevertheless the setup is not so simple it seams.
There is just /etc/config/gerbera file with almost empty configuration.
Have any of you tried to generate config.xml file which is necessary for proper operation?
How can it be done and what would be a setup?

  1. start the service (service gerbera start) to create the configuration file (/etc/config/gerbera)

  2. edit /etc/config/gerbera and change enabled from 0 to 1:

    config gerbera config
    option enabled ‘1’
    option debug ‘0’
    option user ‘gerbera’
    option group ‘gerbera’
    option home ‘/tmp/gerbera’

  3. start the service (again) service gerbera start

  4. get the URL of the UI from /tmp/gerbera/gerbera.html; open in browser

  5. In the UI, use the File System button show the directory tree, navigate to the folder that contains the content that you want, then click Add Item. Repeat if you have multiple folders

  6. Select the Database button, then use the folder structure to view what you added.

I’m sure there are improvements to this, but I haven’t read all of the documentation yet.

What I don’t understand is how to persist the changes that are made to /tmp/gerbera/config.xml and /tmp/gerbera/gerbera.db between reboots. When I reboot, I need to run service start gerbera to create the configuration and database. There must be a better way.

Maybe @neheb knows something about that.

The way I made it disabled by default I wanted people to edit the home directory to persistent storage. /tmp is fairly useless since changes die after a reboot. Maybe I should be explicit about that in the Gerbera start message.

Unlike miniDLNA which uses simple ini style files, Gerbera uses an XML file for configuration which makes it difficult to generate and modify it. That’s why there’s no better UCI config.

1 Like
  1. Stop and disable miniDLNA service

  2. Install gerbera package either over command line or LuCI System->Software search for gerbera and Install it

  3. gerbera will not start

root@turris:~# service gerbera start
Gerbera not enabled. Please enable in /etc/config/gerbera

  1. Enable gerbara:

root@turris:~# vi /etc/config/gerbera
option enabled ‘1’

  1. Also worth to set persitent storage (if you have USB,SSD or HDD attached)
    option home ‘/srv/gerbera’

  2. Start gerbera again will generate gerbera config.xml at directory defined in 4.

root@turris:~# service gerbera start
Created default gerbera config at /srv/gerbera/config.xml
Please edit to your liking and restart

  1. It is worth to have second ssh terminal with:

tail -f /var/log/messages

  1. Start gerbera once more time:

service gerbera start

  1. You will see in /var/log/messages following:

INFO: Gerbera UPnP Server version 1.4.0 - http://gerbera.io/
INFO: ====================================================================
INFO: Gerbera is free software, covered by the GNU General Public License version 2
INFO: Copyright 2016-2019 Gerbera Contributors.
INFO: Gerbera is based on MediaTomb: Copyright 2005-2010 Gena Batsyan, Sergey Bostandzhyan, Leonhard Wimmer.
INFO: ====================================================================
INFO: Loading configuration from: /srv/gerbera/config.xml
INFO: Checking configuration…
INFO: Setting filesystem import charset to UTF-8
INFO: Setting metadata import charset to UTF-8
INFO: Setting playlist charset to UTF-8
INFO: Configuration check succeeded.
WARNING: Sqlite3 database seems to be corrupt or doesn’t exist yet.
INFO: no sqlite3 backup is available or backup is corrupt. automatically creating database…
INFO: database created successfully.
INFO: About to migrate metadata from mt_cds_object to mt_metadata
INFO: No data will be removed from mt_cds_object
INFO: Migrated metadata - object count: 0
INFO: Initialized port: 49152
INFO: Server bound to: 10.0.0.1
INFO: The Web UI can be reached by following this link: http://10.0.0.1:49152/

  1. Web interface listen on port 49152 as found in step 8

http://10.0.0.1:49152/

  1. Bind gerbera to correct IP address (interface). In my case, gerbera bind to 10.0.0.1 which is actually WAN interface for my VDSL PPPoE connection little bit tweaked to allow direct connection to VDSL web UI. Nevertheles my local LAN sits on 192.168.1.1.

vi /srv/gerbera/config.xml

and add into <server> ... </server> section <ip> a.b.c.d </ip> configuration:

.....
</mark-played-items>
</extended-runtime-options>
<ip>192.168.1.1</ip>
</server>
<import hidden-files="no">
.....

and than you need to restart service to have corect IP:

service gerbera restart

http://10.0.0.1:49152/

  1. Make it bootable:

root@turris:~# service gerbera enable

So, hopefully this will work…

I don’t remember how TurrisOS does it, but the device needs to be mounted before Gerbera starts.

I remember having this issue with transmission where it would starts before mdadm/mounting of filesystem.

Note that although you add files through the web interface, the configuration file needs to be edited manually for actual customization.

What about using jinja2 for generating the XML from a template?

Note that although you add files through the web interface, the configuration file needs to be edited manually for actual customization.

Once DB created, it is in database. Thus it is not in config.xml. What you likely pointg out is automatical file update when new files appears?

Eh no. I mean configuration stuff like setting up custom clients and whatnot. See: http://docs.gerbera.io/en/latest/config-overview.html

Sounds excessive from a size standpoint. Then again, size is not a concern here.

I also have no experience with Jinja2.

I was able get it installed and (mostly) operational at /srv/gerbera and the UI at http://72.50.209.210:49152/.

When I tried to change the ip address:

  <server>
    <ui enabled="yes" show-tooltips="yes">
      <accounts enabled="no" session-timeout="30">
        <account user="gerbera" password="gerbera"/>
      </accounts>
    </ui>
    <ip>192.168.1.200</ip>
    <name>Gerbera (Omnia)</name>
   ...

I get an error:

Dec  1 02:06:45 turris gerbera[15726]: 2020-11-30 20:06:45 WARNING: Failed to find interface for IP: 192.168.1.200
Dec  1 02:06:45 turris gerbera[15726]: 2020-11-30 20:06:45   ERROR: Could not find ip: 192.168.1.200

There are no other hosts at that address.

Any ideas why this is occurring?

That must be IP address of your OMNIA interface and not any IP within your network range. So, I assume it should be 192.168.1.1 in your case, shouldn’t be?

Anyway, I am no sure if Gerbera is right choice since it is corrupted to scan files.
There is a limitation you can add files manually to database; however, I am not successfull to add directory or any scan… All the time:

gerbera[31054]: terminate called after throwing an instance of ‘libebml::CRTError’
gerbera[31054]: what(): Failed to seek file 0x67f570 to offset 2762170030 in mode 0: Invalid argument

Since miniDLNA works now well, I have given it up. Sad is, it was working in the past, now it utilize incompatible library…

That worked.

I had a similar experience. Manually adding a file works; adding a scan (inotify) results in database corruption.

I was able to get miniDLNA (1.2.1) and Gerbera (1.1.0) working on LXC container hosting ubuntu (focal).

If you add this to the container’s configuration, then the OS can “see” the host’s files:

# https://askubuntu.com/questions/1050460/how-to-mount-smb-share-on-ubuntu-18-04
# https://forum.test.turris.cz/t/give-lxc-contain-access-to-files-on-the-host/12930
lxc.mount.entry = /mnt/raid/ mnt/raid none bind 0 0