SDB:Setup Mediatomb in openSUSE

Jump to: navigation, search
This article describes the process of, setting up Mediatomb media server software for use with openSUSE.

About Mediatomb

Mediatomb is open source media server software for Linux. Mediatomb allows you to stream your music and video files to other media devices, such as (but not limited to) game consoles, etc.


The following conditions must be met in order for mediatomb to work at all. The Computer section below is closer to your system's hardware requirements.


  • A supported media device (supported by mediatomb)
  • Network Interface (for example, Ethernet network card,router)


The following software packages (files ending in .rpm) must be installed, before one can start setting up mediatomb.


The main mediatomb software package is required regardless, as this package contains mediatomb itself. The other packages are for the mediatomb database of your media files. It depends on your Linux distribution as to which type of database mediatomb uses.

You only need one of the bottom 2 software packages.

Installation guide

The required software packages are at PackMan online software repository

You need to run YaST as root, (see SDB:Login_as_root for help).
The following steps will install the mediatomb software onto your system, provided that all prerequisites have been met.

Using YaST

1) Add the PackMan online software repository to your repo list. (see Additional package repositories page for more information).

2) Open YaST > Software > Software Management

3) Type mediatomb into the search box and press enter (making sure you tick the box next to mediatomb).

4) Accept the proposal from YaST to install mediatomb.

Using your Web browser

1) Open your Web browser.

2) Goto PackMan online software repository

3) Click on your openSUSE version.

4) Click on the One Click Install feature.

5) Accept the proposal from YaST to install mediatomb.

Configuration guide

There are 2 ways you can setup mediatomb, as a service that runs in the background or run by the user like any other piece of software, under the user account you are currently logged into. But first you need to configure your firewall.

Firewalls guide

You need to make sure certain network ports are "open" for your network devices to be able to "see" your PC. The following assumes that you would like to use TCP port 49152, for mediatomb to bind to. UDP port 1900 needs to be open in your firewall as well.
Warning: If you do not add these exceptions to your firewall, mediatomb will not work.
You must run YaST as root (see SDB:Login_as_root for more information). The following guide also assumes you have already installed mediatomb on your computer.

Tip:You can configure mediatomb to operate on a particular TCP port if you wish, see sections below.

Open YaST > Security and Users > Firewall > Allowed Services > Advanced


This dialog box will allow you to add extra TCP & UDP ports, to your firewall's allowed list of services.

Add the necessary TCP & UDP ports to the TCP Ports & UDP Ports fields (see above sceenshot, for an example). Your computer's firewall should now allow mediatomb to "see" your media device, and vice versa.

Configuring mediatomb under a local user account

By default mediatomb uses a file called config.xml in the /home/USERNAME/.mediatomb folder (where USERNAME is your user name). You can edit this file to change settings for mediatomb or you can change at least some settings, via the mediatomb web interface.

Warning: You need to make sure you have configured your firewall before the following will work.
You need to run mediatomb after installation, so that config.xml can be created.

mediatomb first use/creating config.xml steps

Step 1

Open a terminal window (Konsole in KDE).

Step 2

Type mediatomb and then press enter.

This should now create config.xml.

Configuring mediatomb as a service

To run mediatomb as a system service, you need to edit some of the configuration files installed by mediatomb's software package (RPM package).

The following assumes that you have setup your firewall to allow network communications on UDP port 1900 and TCP port 49152. If you have not done this the following will not work.
Warning: To configure and start/stop the mediatomb service you must do it as root.

First Steps

The first step is to edit /etc/mediatomb.conf

Below is a copy of /etc/mediatomb.conf (mediatomb's system-wide configuration file)

## This is a sambel configuration file for the MediaTomb daemon script
## used on Fedora Core

## By default the configuration will be created in /etc/mediatomb

## Network interface on which the server will run, you need to edit this!

## User defined command line options that may be passed to the server

## MediaTomb will be started on port 50500

## MediaTomb will run as mediatomb

## Location of the PID file

## Location of the log file

## Location of the config file/database

As the following states, you will need to edit this section of mediatomb.conf

## Network interface on which the server will run, you need to edit this!

If your network interface's system name is eth1, that's what you need to replace eno1 with.

You can choose which TCP port mediatomb binds to, in the section below;

## MediaTomb will be started on port 50500

Mediatomb will bind to TCP port 49152 in this example, 50500 was changed to 49152 for the purpose of this guide.

Starting and Stopping the mediatomb service

You can start the service though YaST (the easy way) or though the shell.

Using YaST

Open YaST > System > Services Manager

Select the mediatomb system service and click on the Start/Stop button.

Using the shell

You can use the following commands (as root) to start/stop and check status of the mediatomb system service;

rcmediatomb start
rcmediatomb stop
rcmediatomb status

If the mediatomb service fails to start, you may need to do some more configuration. You can run the following commands to check the service;

systemctl -l status mediatomb.service
journalctl -xn

If you see the following from the systemctl -l status mediatomb.service command;

mediatomb.service - LSB: MediaTomb daemon
   Loaded: loaded (/etc/init.d/mediatomb)
   Active: failed (Result: resources) since Fri 2016-04-29 21:12:30 ACST; 11s ago
  Process: 16771 ExecStart=/etc/init.d/mediatomb start (code=exited, status=5)

Apr 29 21:12:30 your_pc's_name_here mediatomb[16771]: /usr/bin/mediatomb not installed
Apr 29 21:12:30 your_pc's_name_here systemd[1]: PID file /var/run/ not readable (yet?) after start.
Apr 29 21:12:30 your_pc's_name_here systemd[1]: Failed to start LSB: MediaTomb daemon.
Apr 29 21:12:30 your_pc's_name_here systemd[1]: Unit mediatomb.service entered failed state.

You will need to edit /etc/init.d/mediatomb as well; because mediatomb's system service is looking for a executable, that does not exist. As the following error message indicates.

Apr 29 21:12:30 your_pc's_name_here mediatomb[16771]: /usr/bin/mediatomb not installed

Therefore you need to change some lines the above mentioned script, that starts the mediatomb system service. If your system has the mediatomb-mysql software package installed, see the below example of a modified script for the mediatomb system service. If your system has the mediatomb-sqlite package installed replace mediatomb-mysql with mediatomb-sqlite instead.

Below is a example of a /etc/init.d/mediatomb script, that uses mysql for mediatomb's database format.

# mediatomb This script starts and stops the mediatomb daemon
# processname: mediatomb
# description: mediatomb is a daemon process which provides a UPnP service
# config: /etc/mediatomb
# config: /etc/mediatomb/config.xml
# pidfile: /var/run/

# Provides:     mediatomb
# Required-Start:   $local_fs $remote_fs $network
# Required-Stop:    $local_fs $remote_fs $network
# Default-Start:    3 5
# Default-Stop:     0 1 2 6
# Short-Description:    MediaTomb daemon
# Description:      This script starts and stops the mediatomb daemon

# Source function library.
. /etc/rc.status

# Source networking configuration.
#. /etc/sysconfig/network

# Set default mediatomb configuration.

# either make an installation in /etc/mediatomb and leave this blank,
# or specify an alternative config file location using the -c option
# Note: be aware, that -i parameter is used to set the ip of the 
# interface specified above

. /etc/mediatomb.conf

# make sure to run it as $MT_USER

test -x "/usr/bin/mediatomb-mysql" || { echo "/usr/bin/mediatomb not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

[ ${MT_INTERFACE} = "NOT_SET" ] && echo "Please edit /etc/mediatomb.conf and change \
the MT_INTERFACE variable to your network device (eth0, eth1, etc.)" && exit 0


IFACE_IP=`ifconfig | grep -i "$MT_INTERFACE" -A 1|grep "inet addr"|cut -d " " -f 12|cut -d ":" -f 2`
[ -d /var/lock/subsys/ ] || mkdir -p /var/lock/subsys/

# By default it's all good

# See how we were called.
case "$1" in
		# Start daemon.
		echo -n "Applying multicast settings to $MT_INTERFACE... "
		# those settings are necessary for us to react to M-SEARCH requests
		route add -net netmask $MT_INTERFACE >/dev/null 2>&1
		ifconfig $MT_INTERFACE allmulti
		touch $MT_PIDFILE

		mkdir -p "/$MT_HOME/$MT_CFGDIR"

		echo -n "Starting mediatomb: "
		mediatomb-mysql $MEDIATOMB $IFACE_IP $MT_OPTIONS
		rc_status -v
		[ $RETVAL = 0 ] && touch /var/lock/subsys/mediatomb
		# Stop daemons.
		echo -n "Shutting down mediatomb: "
		killproc mediatomb
		rc_status -v

		[ $RETVAL = 0 ] && rm -f /var/lock/subsys/mediatomb
		$0 stop
		$0 start
		$0 stop
		$0 start
		[ -e /var/lock/subsys/mediatomb ] && $0 restart
		if test -e $MT_PIDFILE ; then
			echo " seems running"
			echo " not running"
		echo "Usage: $0 {start|stop|restart|status|condrestart}"


As you can see, now there is a real executable file (that does actually exist) there.

Automatically start service when system starts

You can have the mediatomb service start when the system does. The easy way to do this is by using YaST Services Manager.

Using the YaST Services Manager

To enable/disable the automatic starting of the mediatomb system service, follow the steps below;

Open YaST > System > Services Manager

Then select the mediatomb service and click on the Enable/Disable button pictured below;


And that's it, the mediatomb service should start every time your system does!

Adding media files to the database

Below is a sceenshot of the mediatomb web interface.


Accessing the mediatomb web interface

Step 1

Open your web browser.

Step 2

There are two ways you can access the mediatomb web interface, in your web browser's address bar type localhost:TCP_port_here or YOUR_PC'S_IP_ADDRESS_HERE:TCP_port_here.


The above example uses TCP port 49152 and as my computer's local IP address.


The above example uses the TCP port 49152 once again.


Click on the icon inside the black squire below to add your media files. This option will just add the file(s) you have selected, to the mediatomb database of your media file(s).


Click on the icon inside the black squire below to add your media files. This option will add the folder as an "autoscan" directory. Therefore if you add more media files to the selected folder, mediatomb will automactaclly "see" them (you therefore will not have to do anything, after this step to add files to the mediatomb database for the selected folder.)


Editing mediatomb's configuration file

Below is an example of config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <ui enabled="yes" show-tooltips="yes">
      <accounts enabled="no" session-timeout="30">
        <account user="mediatomb" password="mediatomb"/>
    <name>MediaTomb Media Server</name>
      <sqlite3 enabled="yes">
    <protocolInfo extend="yes"/><!-- For PS3 support change to "yes" -->
       Uncomment the lines below to get rid of jerky avi playback on the
       DSM320 or to enable subtitles support on the DSM units
      <add header="X-User-Agent: redsonic"/>

    <!-- Uncomment the line below if you have a Telegent TG100 -->
      <ffmpegthumbnailer enabled="yes">
      <mark-played-items enabled="no" suppress-cds-updates="yes">
        <string mode="prepend">*</string>
  <import hidden-files="no">
    <scripting script-charset="UTF-8">
      <virtual-layout type="builtin">
      <extension-mimetype ignore-unknown="no">
        <map from="mp3" to="audio/mpeg"/>
        <map from="ogx" to="application/ogg"/>
        <map from="ogv" to="video/ogg"/>
        <map from="oga" to="audio/ogg"/>
        <map from="ogg" to="audio/ogg"/>
        <map from="ogm" to="video/ogg"/>
        <map from="asf" to="video/x-ms-asf"/>
        <map from="asx" to="video/x-ms-asf"/>
        <map from="wma" to="audio/x-ms-wma"/>
        <map from="wax" to="audio/x-ms-wax"/>
        <map from="wmv" to="video/x-ms-wmv"/>
        <map from="wvx" to="video/x-ms-wvx"/>
        <map from="wm" to="video/x-ms-wm"/>
        <map from="wmx" to="video/x-ms-wmx"/>
        <map from="m3u" to="audio/x-mpegurl"/>
        <map from="pls" to="audio/x-scpls"/>
        <map from="flv" to="video/x-flv"/>
        <map from="mkv" to="video/x-matroska"/>
        <map from="mka" to="audio/x-matroska"/>
        <!-- Uncomment the line below for PS3 divx support -->
        <!-- <map from="avi" to="video/divx"/> -->
        <!-- Uncomment the line below for D-Link DSM / ZyXEL DMA-1000 -->
        <!-- <map from="avi" to="video/avi"/> -->
        <map from="audio/*" to="object.item.audioItem.musicTrack"/>
        <map from="video/*" to="object.item.videoItem"/>
        <map from="image/*" to="object.item.imageItem"/>
        <treat mimetype="audio/mpeg" as="mp3"/>
        <treat mimetype="application/ogg" as="ogg"/>
        <treat mimetype="audio/x-flac" as="flac"/>
        <treat mimetype="image/jpeg" as="jpg"/>
        <treat mimetype="audio/x-mpegurl" as="playlist"/>
        <treat mimetype="audio/x-scpls" as="playlist"/>
        <treat mimetype="audio/x-wav" as="pcm"/>
        <treat mimetype="audio/L16" as="pcm"/>
        <treat mimetype="video/x-msvideo" as="avi"/>
        <treat mimetype="video/mp4" as="mp4"/>
        <treat mimetype="audio/mp4" as="mp4"/>
        <treat mimetype="application/x-iso9660" as="dvd"/>
        <treat mimetype="application/x-iso9660-image" as="dvd"/>
      <YouTube enabled="no" refresh="28800" update-at-start="no" purge-after="604800" racy-content="exclude" format="mp4" hd="no">
        <favorites user="mediatomb"/>
        <standardfeed feed="most_viewed" time-range="today"/>
        <playlists user="mediatomb"/>
        <uploads user="mediatomb"/>
        <standardfeed feed="recently_featured" time-range="today"/>
  <transcoding enabled="no">
      <transcode mimetype="video/x-flv" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="oggflac2raw"/>
      <transcode mimetype="audio/x-flac" using="oggflac2raw"/>
      <profile name="oggflac2raw" enabled="no" type="external">
        <agent command="ogg123" arguments="-d raw -o byteorder:big -f %out %in"/>
        <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
      <profile name="vlcmpeg" enabled="no" type="external">
        <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit"/>
        <buffer size="14400000" chunk-size="512000" fill-size="120000"/>

The option below, tells mediatomb which TCP port to always use.


Where number is the number of the TCP port you whould like mediatomb to always use.

Troubleshooting guide

Q) Why is mediatomb not displaying any of my media files on my media device?

A) You need to create a database of your media files using the mediatomb web interface at http://localhost:49152/ (this will only work if you are using TCP port 49152.)

You also need to make sure mediatomb is actually running, you can have mediatomb start automatically with openSUSE if you wish.

You can also use your computer's local IP address to start the mediatomb web interface.

Q) The mediatomb system service will not start and systemctl -l status mediatomb.service command gives me the following error messages;

mediatomb.service - LSB: MediaTomb daemon
   Loaded: loaded (/etc/init.d/mediatomb)
   Active: failed (Result: resources) since Fri 2016-04-29 20:13:06 ACST; 7min ago
  Process: 14103 ExecStart=/etc/init.d/mediatomb start (code=exited, status=0/SUCCESS)

Apr 29 20:12:57 your_pc_name_here mediatomb[14103]: Applying multicast settings to eno1... Starting mediatomb: ..done
Apr 29 20:12:57 your_pc_name_here systemd[1]: PID 14124 read from file /var/run/ does not exist or is a zombie.
Apr 29 20:13:06 your_pc_name_here systemd[1]: mediatomb.service never wrote its PID file. Failing.
Apr 29 20:13:06 your_pc_name_here systemd[1]: Failed to start LSB: MediaTomb daemon.
Apr 29 20:13:06 your_pc_name_here systemd[1]: Unit mediatomb.service entered failed state.

A) You need to make sure your network interface is running, as the mediatomb service will not run unless your network is. Connect your PC to your router and make both are turned on (and connected).

See also

Related articles

External links