Been a while that I used the pine64, so thought I’ll put it to good use by setting up a DLNA/uPnP media streaming server for my LG TV.
I already have a Debian Stretch image running on it for almost an year now. Here’s the link on how to get a Stable Debian (Stretch with Mate) running. For the streaming server, I tried miniDLNA as well as Rygel. miniDLNA failed to stream Videos, while I wasn’t able to get the Rygel up without GUI. Then I found Gerbera, which is based in mediatomb and is headless along with most of the media part of the setup is through WEB GUI. Perfectly suits my needs.
Installation
So let’s get straight to the installation. Start with checking if gerbera is available in your repos with
apt-get update
apt-cache search gerbera
If you find it, install it. In my case I had to add a testing repu to my sources.list file like this:
vi /etc/apt/sources.list
deb http://http.us.debian.org/debian testing main non-free contrib
deb-src http://http.us.debian.org/debian testing main non-free contrib
Then update the repos and install gerbera
apt-get update
apt install gerbera -y
once the installation completes (depending on your internet speeds), check where the executable is and if a user has been created, which it should by default.
which gerbera
id -u gerbera
Also check if the log file is generated (in my case it wasn’t) and create it if its not there:
ls -l /var/log/gerbera
touch /var/log/gerbera
Give it permissions:
chown -Rv gerbera:gerbera /var/log/gerbera
chmod -Rv 0770 /var/log/gerbera
Enable the Web GUI:
vi /etc/gerbera/config.xml
Enable the service to start at bootup:
systemctl enable gerbera.service
systemctl is-enabled gerbera.service
Now start the service and check the GUI web link:
systemctl daemon-reload
systemctl start gerbera.service
systemctl status gerbera.service
systemctl enable gerbera.service
systemctl is-enabled gerbera.service
Now start the service and check the GUI web link.
systemctl start gerbera.service
systemctl status gerbera.service
Configuration
Configuration is pretty straightforward. Logon to the Web Gui from the service status, in my case http://my-pine64-ip:49152
Now under Filesystem tab, drill down to the folders you want to add to your server library and add them as Autoscan Directories . (Keep it simple, Audio, Video, Photos).
I have a USB drive mounted at /media/pendrive/ Under which I have added all my music to /media/pendrive/Music and /media/pendrive/Video
So I add it to gerbera as below:
1. Filesystem tab => 2. select media directory => 3. add as autoscan directory => 4. Scan mode inotify, Full initial scan and recursive => 5. Set. Then dd next directory. Screen shot below:
By now you should be all set, so now check your DLNA client, in my case, my LG Smart TV. on the Remote control, I go to Input and voila! i see gerbera as an option now!!
Issues and troubleshooting
Before it all came up online, I did get hit with couple of issues, mostly related to file permissions (which the dev’s may have missed to include in the package). If you get service start failure with below error:
root@pine64:/home/pine64# journalctl -u gerbera.service
.
.
Jan 22 22:09:52 pine64 systemd[22400]: gerbera.service: Failed at step USER spawning /usr/bin/gerbera: No such process
Jan 22 22:09:52 pine64 systemd[1]: gerbera.service: Main process exited, code=exited, status=217/USER
.
.
Jan 22 22:25:34 pine64 gerbera[2298]: Exception raised in [src/storage/sqlite3/sqlite3_storage.cc:411] waitForTask(): SQLITE3: (8) attempt to write a readonl
y database
Jan 22 22:25:34 pine64 gerbera[2298]: error: attempt to write a readonly database
.
.
Most of these issues are related to file permissions.
Fixed the sqlite3 DB error by:
root@pine64:/home/pine64# ls -l /var/lib/gerbera/gerbera.db
-rw-r--r-- 1 root root 57344 Jan 22 21:30 /var/lib/gerbera/gerbera.db
root@pine64:/home/pine64# chown -Rv gerbera:gerbera /var/lib/gerbera/gerbera.db
changed ownership of '/var/lib/gerbera/gerbera.db' from root:root to gerbera:gerbera
Others by:
chown -Rv gerbera:gerbera /var/lib/gerbera/
chmod -Rv 0750 /var/lib/gerbera/
chown -Rv gerbera:gerbera /usr/share/gerbera
chmod -Rv 0750 /usr/share/gerbera/
chown -Rv gerbera:gerbera /lib/systemd/system/gerbera.service
chmod -Rv 0750 /lib/systemd/system/gerbera.service
chown -Rv gerbera:gerbera /etc/gerbera/
chmod -Rv 0750 /etc/gerbera/
Then:
vi /gerbera/scripts/systemd/gerbera.service
user=gerbera
group=gerbera
You can also run the service and check the logs on the fly like this:
/usr/bin/gerbera -c /etc/gerbera/config.xml
/etc/gerbera/
Then:
vi /gerbera/scripts/systemd/gerbera.service
user=gerbera
group=gerbera
You can also run the service and check the logs on the fly like this:
/usr/bin/gerbera -c /etc/gerbera/config.xml
Then:
vi /gerbera/scripts/systemd/gerbera.service
user=gerbera
group=gerbera
You can also run the service and check the logs on the fly like this:
/usr/bin/gerbera -c /etc/gerbera/config.xml
That is mostly it. However, if you come accross more issues or have some fun stuff to add to this setup, do leave your comment belo