From Plex to Serviio via MiniDLNA

I’ve decided to make a switch – NUC (previously wrote about it here) is replaced by Raspberry Pi 3 B in Media Player role and NUC itself will serve File Server role from now on. In order to do that, I have made some reconfiguration and also installed Plex on my NUC (which has Ubuntu 15.10 at the moment of writing this blog post). It did not go well..

Plex was visible from other devices but as soon as I try accessing files from DLNA-enabled device, Plex occupies all CPU cores almost at 100% and nothing happens, I mean content cannot be accessed. This problem did not go away despite my several attempts at fixing it. Finally I gave up on Plex and went searching for another options.

MiniDLNA was a logical next step as this is quite popular solution for embedded devices and Linux. Well, almost worked – music and videos were all right but collection of photos did not want to show up on Kodi or similar players on any platform. Randomly some photo would display after very long delay but it was so slow to show up to be considered unusable. MiniDLNA log file showed errors like this a lot: “Returning UPnPError 701: No such object error”. Somewhere on the forums I’ve seen people saying the error is insignificant and everything should still work. Unfortunately not my case – I was unable to fix pictures display on any of the media players when MiniDLNA was serving the content.

Serviio came up next in my search after the fiasco with MiniDLNA. It is Java application that runs from terminal by default (with an option to make it a daemon), it is configured by using a web interface (a-la Plex) and to my delight it actually handles all content pretty well, the problem is resolved, thanks, Serviio!

Fixing Screen Tearing on Linux Mint 17.3

I’m on Nvidia GF770 GTX, there is a decent, though proprietary, driver for my GPU from Nvidia but what bothers me a lot is that even despite having the correct driver with 3D-capabilities, able to run demanding 3D games I am still having a trivial issue of screen tearing in games and videos.. I have tried to enable V-Sync wherever I found the setting to no effect: still the same ugly tearing all over the video or a game scene.

After some research on the topic I decided to give Compton a try and because it has resolved the issue for me I stopped at this solution, here is the detailed guide on how to set this thing up:

Raspberry Pi 3 B as Media Center

Over the weekend experimented with OpenELEC Linux flavor for Raspberry Pi 1 B. Experimented with wired and wireless connection options, unfortunately in all cases performance was very laggy on high quality HD movies, if 720p was ok in some cases, 1080 was never played at an acceptable level. I compare it with Intel NUC which I setup for media center some time ago and now using it for different purposes – comparison is very bleak, if NUC is fully capable as media center, from playing music and movies to viewing vacation photos then RPi only able to play music somewhat ok. Still I have used Xonar USB audio because embedded sound produced noticeable static when playing music.

I understand that I compare something that costs ~600 EUR to something around ~50 EUR and it does not seem fair.. Anyways, I decided to give a shot at newer model of Raspberry Pi – model 3 B. Just ordered it at Will update this post once I get my hands on what is in the kit, here is the list I got in my mailbox, accompanying my order:

Supreme Kit Including NEW Raspberry Pi 3 Model B
– Includes Raspberry Pi: Raspberry Pi 3 B **R..
– Raspberry Pi Case: Raspberry Pi Foundat..
– Select Case Colour: Official Black and G..
– Micro SD Card Size: 8GB w/ Official Adap..
– Power Supply Select: Black Universal 5V 2..
– Video Cable Select: HDMI – Black – 2m **..
– USB Cable Select: Standard – Black – 1..
– RJ45 Cable Select: Black – 2m **CAB-000..
– Keyboard & Mouse Select: Wireless – Ultra-Min..

It Has Arrived!


Please note that Asus Xonar U3 was not part of the package, I use this external audio card in conjunction with Raspberry because Pi’s internal audio has too much interference and the situation did not change for the better with this newer model, sound output is as noisy as it was on RPi 1.

This new model came with 8GB flash card that had NOOBS installed on it. I have selected OSMC from the list of possible operating systems and installed it. Please note that you have to plug the wire into the Ethernet socket in order to get some other OS different from Raspbian, this is because NOOBS will download the needed OS from Internet, which would have been possible with WiFi too but unfortunately NOOBS does not support wireless and it seems it won’t get such support in foreseeable future, so get your Ethernet ready before powering on the RPi.

What was interesting about the package is this: Rii mini wireless keyboard with touchpad (and laser pointer). From previous experience with standalone media players running Linux, sometimes problems happen that require mouse and keyboard to be hooked to the player in order to fix the issue, so previously I was taking the devices from my workstation, plugging those into the player, fixing the issue and plugging the devices back to the workstation. Not anymore! Rii is going to be very close to the RPi device, always ready to intervene in case of an issue that cannot be solved with Kodi Remote (using Kore on Android phone).



You can configure anything and everything, as I mentioned above I am using additional sound card with RPi and I had no issues setting the sound output to the card instead of RPi analog output or my TV’s HDMI. There was slight annoyance though – I had to increase buffer size because some particularly large videos were not playing smoothly. Just create file called advancedsettings.xml with this code:


And copy the created file to /home/osmc/.kodi/userdata/. Just mind that you have to SSH into your RPi running OSMC and create file there, not on your workstation :) Login / pass for default OSMC installation is osmc / osmc.


Split Traffic Per Process

The task at hand: route traffic from different processes to 2 distinct wifi adapters. First adapter is switched to normal wifi, second to the router with persistent vpn connection. I need an ability to chose which process will use which adapter.

I have searched for solution and found very similar here:

So, just adapted the above solution a little bit to suit my needs and summarized my changes below.

You have to replace several things in this script first of all user name, my username is kr0st, which is not a terrible secret :) Anyway, should be replaced with yours.
My second wifi adapter is called “wlx001ee5ef5604″ by the OS, most likely your second network adapter is named differently.
Finally this is my gateway for the second wifi:, yours could be different as well.

Please note that script resets everything you have in your iptables! Change it if you can’t allow script to do that. The script should be run as root, btw.

As a final step the script runs an instance of Firefox in which you can search “my ip” and see if traffic really goes via this route and not the default one.


mkdir /sys/fs/cgroup/net_cls/vpnonly
cd /sys/fs/cgroup/net_cls/vpnonly
echo 0x00110011 > net_cls.classid

iptables --flush
iptables --table nat --flush
iptables --delete-chain

iptables -t mangle -A OUTPUT -m cgroup --cgroup 0x00110011 -j MARK --set-mark 11
iptables -t nat -A POSTROUTING -m cgroup --cgroup 0x00110011 -o wlx001ee5ef5604 -j MASQUERADE

#!Run next line only once, all subsequent script calls should have it disabled
#echo 11 vpnonly >> /etc/iproute2/rt_tables

ip rule add fwmark 11 table vpnonly
ip route add default via table vpnonly

for i in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 0 > $i; done

cgcreate -t kr0st:kr0st -a kr0st:kr0st -g net_cls:vpnonly
cgexec -g net_cls:vpnonly firefox&