Search:  
Gentoo Wiki

Mt-daapd

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

This guide uses version 0.2.1.1, but it may apply to any subsequent versions. You should use at least version 0.2.4 if you're using anything above iTunes 6.04. Older versions of mt-daapd advertise themselves in a way that newer versions of iTunes don't understand.

References

Installation

If iTunes share is the only thing you are looking for then you don't need Avahi

mt-daapd alone

  1. emerge mt-daapd

Configuration

Next, edit the /etc/mt-daapd.conf to suit your needs. The file is well documented. Shown here are only the entries which I had a look at.

File: /etc/mt-daapd.conf
web_root        /usr/share/mt-daapd/admin-root
port            3689
admin_pw        your_pw
db_dir          /var/cache/mt-daapd
mp3_dir         /mnt/storage/samba_public/mp3
servername      mt-daapd
runas           nobody
playlist        /etc/mt-daapd.playlist
extensions      .mp3,.m4a,.m4p,.ogg
logfile         /var/log/mt-daapd.log


Lastly, you'll need to fix the init script /etc/init.d/mt-daapd to reflect a change in the naming of mDNSResponder (see http://forums.gentoo.org/viewtopic-t-628046-highlight-mtdaapd.html for discussion):

File: /etc/init.d/mt-daapd
#original
need mDNSResponder

#fixed
need mDNSResponderPosix 

Apparently mt-daapd doesn't provide internal mDNS in this version (0.2.4.1)?

Running

Start the server with

# /etc/init.d/mt-daapd start

mt-daapd will then scan your mp3 directory (specified in daapd.conf) .. this step might take quite awhile depending on how many mp3s are in this folder. Fire up itunes and your itunes server should be up and running..

You can have the server start-up every time you restart your computer using

# rc-update add mt-daapd default

Before trying to connect from a client like iTunes or media-sound/rhythmbox, make sure you have opened the chosen port on the firewall (TCP 3689 and UDP 5353).

Verify and trouble shoot

This Itunes server Howto was inspired by the gentoo itunes macosxhints.com by andyt (thanks)


The server will be visible after daapd is done scanning. It will announce itself to mDNSResponder. This can be checked by running on OSX:

# mDNS -B _daap._tcp

or on Linux

# mDNSBrowse _daap._tcp

This way, you'll see whenever something announces itself as being daap.

again thanks to andyt for his tutorial that inspired me to do this gentoo-wiki

Issues

It may be important to ensure the interface you want to advertise the daapd server on is in promiscuous mode. If your server either doesn't show up in iTunes, disappears after a period of time or take a long time to appear, try putting the interface in promiscuous mode. You can find out if its promiscuous using /sbin/ifconfig - see something like this:

Code: /sbin/ifconfig output
eth0      Link encap:Ethernet  HWaddr 01:23:45:67:89:ab  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:23515 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9839 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 
          RX bytes:3778586 (3.6 Mb)  TX bytes:1569537 (1.4 Mb)

Turn on promiscuous mode with:

# ifconfig <interface> promisc

Make this permanent by adding the keyword "promisc" to the iface options:

Code: /etc/conf.d/net fragment
iface_eth0="192.168.1.100 broadcast 192.168.1.255 netmask 255.255.255.0 promisc"

[Added: 16 Nov 07]Above method does not work when using DHCP. Instead, you need to use the post_up function in /etc/conf.d/net to enable promisc mode.

Code: /etc/conf.d/net fragment when using DHCP. Substitute ra0 with your interface
config_ra0=("dhcp")
postup() {
        if [ ra0 == ${IFACE} ]; then
                ifconfig ra0 promisc
        fi
}

Clearing the Songs Database

Sometimes, the cache of songs can become corrupt if files are moved around, causing several songs in your playlist to not work, show duplicates, etc.

This can also show itself after an upgrade. You may see the logs say:

2008-02-16 16:54:16: Starting rendezvous daemon
2008-02-16 16:54:16: Rendezvous socket closed (daap server crashed?) Aborting.
2008-02-16 16:54:16: Aborting

Running from the command line with debugging turned up:

# mt-daapd -f -d 9 -m
Checking existence of /var/cache/mt-daapd
gdbm fatal: read error

To resolve this, simply delete the following file:

/var/cache/mt-daapd/songs.gdb

And then restart the service:

/etc/init.d/mt-daapd restart
Retrieved from "http://www.gentoo-wiki.info/Mt-daapd"

Last modified: Thu, 04 Sep 2008 00:10:00 +0000 Hits: 59,646