[HOWTO] replace mt-daapd with forked-daapd (iTunes server)

TwonkyMedia, PS3, XBOX360, iTunes, & other media players

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby ADoko » Wed Dec 08, 2010 9:28 pm

webdevnz wrote:[
Hi there.
What modifications did you make and how where they implemented in order for this to start, I'm having the same issue.
Cheers


Here's the patch for the S20dbus script in /opt/etc/init.d
Code: Select all
--- ./S20dbus   2010-11-09 11:04:46.000000000 -0800
+++ ./S20dbus   2010-12-07 12:36:11.778290580 -0800
@@ -23,7 +23,7 @@
 set -e
 
 DAEMON=/opt/bin/dbus-daemon
-NAME=dbus
+NAME=`basename $0`
 DAEMONUSER=messagebus
 PIDDIR=/opt/var/run/dbus
 PIDFILE=$PIDDIR/pid
@@ -47,8 +47,17 @@
     chown $DAEMONUSER $PIDDIR
     chgrp $DAEMONUSER $PIDDIR
   fi
+
   if [ -e $PIDFILE ]; then
-    echo "$DESC already started; not starting."
+    if [ -n "`pidof dbus-daemon`" ]; then
+       echo "$DESC already started; not starting."
+    else
+      echo "$PIDFILE exists! but deamon is not running. Removing $PIDFILE..."
+      rm -f $PIDFILE
+      echo -n "Starting $DESC: "
+      ${DAEMON} --system $PARAMS
+      echo "$NAME."
+    fi
   else
     echo -n "Starting $DESC: "
     ${DAEMON} --system $PARAMS


If you want the full script just download any of the links in the first post and it will be in there. It's in the opt_etc_initd_scripts directory.

Now let me ask you a question: How are you ensuring that your scripts in /opt/etc/init.d are called during boot/init? There's a the method shown in the QNAP wiki where you add an autorun.sh script to the flash RAM. I'm not a huge fan of this method because of timing issues. The /opt directory probably won't exist when the autorun script executes or if it does then other things that your script might need to have running will not be running. I'm a much bigger fan of modifying the Optware.sh script in /opt to run all the script in /opt/etc/init.d.

So even if you patch your S20dbus script with my patch you still need to make sure it's called during boot/init.

Regards,

Anthony
User avatar
ADoko
Easy as a breeze
 
Posts: 269
Joined: Wed Dec 01, 2010 1:08 am
NAS Model: TS-401T

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby CdG80 » Thu Dec 09, 2010 12:15 am

Hi Anthony,

after completely setting up my NAS from scratch, I today started over re-applying your latest forked-daapd build. Installation went fine but after the restart, "nothing" worked... I figured out that there is an error starting dbus:

Code: Select all
[/share/Multimedia] # /opt/etc/init.d/S20dbus start
Starting system message bus: Failed to start message bus: Error in file /opt/etc/dbus-1/system.d/avahi-dbus.conf, line 1, column 0: syntax error


I checked the first line and there is a "cat" in there... probably left over from working on the code? I deleted the first line and then was able to start dbus as needed. At the moment the forked-daapd is scanning my iTunes library, so cannot connect to the forked-daapd server yet. Hope to be able to do that later this evening :-) Will let you know for sure!

Thanks a lot for your great work!

Cheers, Chris
CdG80
Starting out
 
Posts: 34
Joined: Wed Dec 01, 2010 10:49 pm
NAS Model: TS-110

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby ADoko » Thu Dec 09, 2010 3:02 am

Chris,

Actually that "cat" is a case of me "not eating my own dog food" as the saying goes. It turns out that the ./package script never creates a new avahi-dbus.conf file if one already exists. On my QNAP I correctly created that file with an old version of ./package. Then I changed the ./package script and that broke the avahi-dbus.conf file creation. However, I never saw it because the old version was always there. I've made a change in the script to obviously not put a spurious "cat" at the top of that file and to also delete the avahi-dbus.conf file when a person uninstalls.

Thanks for catching this. I'm uploading new versions of the files as I type this. I'm also going to remove all the "old" versions of the packages as they probably have this error in their ./package script.

Regards,

Anthony
User avatar
ADoko
Easy as a breeze
 
Posts: 269
Joined: Wed Dec 01, 2010 1:08 am
NAS Model: TS-401T

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby nomoreme » Thu Dec 09, 2010 7:54 am

Hi!

I've installed your forked-daapd and worked really fine with my itunes but not with my Apple TV 2: tha nas doesen't show up (maybe for the lack of compatibility with Home Sharing?). So i've tried to uninstall everything and go back to the previous state, but now it seems that the time machine server is slower than before. Is it possibile that there's something the uninstaller hasn't uninstalled? If i try a firmware update with the same version, it will clear anything?

Thanx
nomoreme
New here
 
Posts: 2
Joined: Thu Dec 09, 2010 7:48 am
NAS Model: TS-219P

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby ADoko » Thu Dec 09, 2010 8:33 am

Code: Select all
./package uninstall nodebug

should completely remove everything under /opt/unstable. If you don't need dbus then you can stop it too by:

Code: Select all
/opt/etc/init.d/S20dbus stop


At this point you can then do a reboot. After a reboot any modifications I made to the /etc/init.d directory will be overwritten (though they should already be gone) and you should be back to the standard QNAP install. You could also verify that your /opt/Optware.sh script is the standard script by looking to see that it doesn't try to run any code in /opt/etc/init.d.

Again, the uninstall script should have taken care of all of this.

You could also check to see if you have avahi-daemon and mDNSResponsderPosix running at the same time:
Code: Select all
pidof avahi-daemon
pidof mDNSResponder


If you get numbers back from both those commands a reboot will fix things.

You can also check if forked-daapd and mt-daapd are running at the same time:
Code: Select all
pidof mt-daapd
pidof forked-daapd


Same thing. You shouldn't get numbers back from both. If you do try rebooting.

Hope this helps.
User avatar
ADoko
Easy as a breeze
 
Posts: 269
Joined: Wed Dec 01, 2010 1:08 am
NAS Model: TS-401T

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby newell » Thu Dec 09, 2010 12:14 pm

A bit of test results. I am running a TS-209. The package installed perfectly with the minor avahi conf change. But when I went to start the services I got a bonjour and timemachine error - Fatal Error: kernal too old. I have the latest firmware v3.3.0 0924. So there is obviouly a problem with the 209 not having its kernal upgraded. The uninstall worked perfectly.

Update - my kernal version is: 2.6.12.6-arm1

I'd just like to add a big thankyou to ADoko. The best thing about this was the uninstall. To test something and be able to roll back on a beta product was brilliant. Keep up the good work.
newell
New here
 
Posts: 5
Joined: Sun Oct 26, 2008 8:49 am
NAS Model: TS-101/TS-201

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby ADoko » Thu Dec 09, 2010 12:50 pm

[EDIT]
Found your problem: http://www.eglibc.org/prerequisites
Your kernel is just a little too old. I'll look at GNU libc 2.9 and see if might work for you.
[/EDIT]


newell wrote:A bit of test results. I am running a TS-209. The package installed perfectly with the minor avahi conf change. But when I went to start the services I got a bonjour and timemachine error - Fatal Error: kernal too old. I have the latest firmware v3.3.0 0924. So there is obviouly a problem with the 209 not having its kernal upgraded. The uninstall worked perfectly.

Update - my kernal version is: 2.6.12.6-arm1

I'd just like to add a big thankyou to ADoko. The best thing about this was the uninstall. To test something and be able to roll back on a beta product was brilliant. Keep up the good work.


Sorry to hear that it didn't work on your system. I'm not sure which component complained about the kernel being too old. Avahi.org states that their daemon will run on the 2.4 and 2.6 linux kernels so it would seem you're kernel is sufficient. It may be another component that's not playing nice. If you give me the exact message that you saw I could grep through the sources and see what package is causing the issue. It may be as simple as downgrading the package or possibly compiling an older version of the eGlibc library.

The other thing to try is to start the services manually and see if you still get the messages. Instead of starting avahi-daemon with the S30bonjour script try this (assuming you re-install):
Code: Select all
cd /opt/unstable/sbin
./avahi-daemon --debug


It's possible that the startup script has something in it that doesn't agree with your kernel. The other thing is that I compiled these libraries against the 2.6.33.2 kernel sources. I may need to compile against the 2.6.12.6 source. That's not terribly hard to do and I'll give it a whirl this weekend if I get time.

Also, if you get a chance please execute the following in the shell:
Code: Select all
uname -a


and

Code: Select all
/lib/libc.so.6


This might give me some leads.

Regards,

Anthony
User avatar
ADoko
Easy as a breeze
 
Posts: 269
Joined: Wed Dec 01, 2010 1:08 am
NAS Model: TS-401T

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby newell » Thu Dec 09, 2010 6:14 pm

I am running it again now.

uname -a:
Linux QNAPHOME 2.6.12.6-arm1 #2 Fri Sep 24 02:08:55 CST 2010 armv5tejl unknown

/lib/libc.so.6
GNU C Library stable release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.4.3 (release) (CodeSourcery ARM Q1B 2005).
Compiled on a Linux 2.6.6 system on 2005-05-05.
Available extensions:
GNU libio by Per Bothner
crypt add-on version 2.1 by Michael Glad and others
linuxthreads-0.10 by Xavier Leroy
BIND-8.2.3-T5B
libthread_db work sponsored by Alpha Processor Inc
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

Installation. I am using the commands as per the first post.
/ARM-forked-daapd-install] # ./package install nodebug
Install new scripts in /opt/etc/init.d...
chmod 755 ./opt_etc_initd_scripts/S15replace
cp ./opt_etc_initd_scripts/S15replace /opt/etc/init.d
chmod 755 ./opt_etc_initd_scripts/S20dbus
cp ./opt_etc_initd_scripts/S20dbus /opt/etc/init.d
chmod 755 ./opt_etc_initd_scripts/S30bonjour
cp ./opt_etc_initd_scripts/S30bonjour /opt/etc/init.d
chmod 755 ./opt_etc_initd_scripts/S35timemachine
cp ./opt_etc_initd_scripts/S35timemachine /opt/etc/init.d
chmod 755 ./opt_etc_initd_scripts/S50iTunes
cp ./opt_etc_initd_scripts/S50iTunes /opt/etc/init.d
done.

Running the S15replace script to install shims...
/opt/etc/init.d/S15replace
Shutting down bonjour services: mDNSResponderPosix
Shutting down iTunes services:done.

Backing up Optware.sh in /opt...
mv /opt/Optware.sh /opt/.ORIG/Optware.sh
done.

Install new Optware.sh in /opt...
/share/Public/forked-daapd/ARM-forked-daapd-install/opt_scripts /share/Public/forked-daapd/ARM-forked-daapd-install
chmod 755 ./Optware.sh
cp ./Optware.sh /opt
/share/Public/forked-daapd/ARM-forked-daapd-install
done.

Installing the unstable tree...
/opt /share/Public/forked-daapd/ARM-forked-daapd-install
tar -xf /share/MD0_DATA/Public/forked-daapd/ARM-forked-daapd-install/unstable.tar
/share/Public/forked-daapd/ARM-forked-daapd-install
done.

No avahi user found, creating it...
mkdir -p /opt/unstable/var/run/avahi-daemon
done.

No avahi-autoipd user found, creating it...
mkdir -p /opt/unstable/var/run/avahi-autoipd
done.

No netdev group found, creating it...
addgroup netdev
done.

No dbus socket was found, creating it...
mkdir -p /opt/unstable/var/run/dbus
ln -sf /opt/var/run/dbus/system_bus_socket /opt/unstable/var/run/dbus/system_bus_socket
ln -sf /opt/var/run/dbus/pid /opt/unstable/var/run/dbus/pid
done.

Creating /opt/unstable/var/log for forked-daapd.log...
mkdir -p /opt/unstable/var/log
done.

Finished installing.

After that I manually start the services:

[/share/Public/forked-daapd/ARM-forked-daapd-install] #
</ARM-forked-daapd-install] # /opt/etc/init.d/S15replace
</ARM-forked-daapd-install] # /opt/etc/init.d/S20dbus start
/opt/var/run/dbus/pid exists! but deamon is not running. Removing /opt/var/run/dbus/pid...
Starting system message bus: S20dbus.
[/share/Public/forked-daapd/ARM-forked-daapd-install] # cd /opt/unstable/sbin
[/opt/unstable/sbin] # ./avahi-daemon --debug
FATAL: kernel too old
[/opt/unstable/sbin] #

And I get the following error.

I know this matches your findings but I thought I might as well do it so you can see the exact output.
newell
New here
 
Posts: 5
Joined: Sun Oct 26, 2008 8:49 am
NAS Model: TS-101/TS-201

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby nomoreme » Thu Dec 09, 2010 8:50 pm

@adoko thanks for the reply. I will try it later at home.
nomoreme
New here
 
Posts: 2
Joined: Thu Dec 09, 2010 7:48 am
NAS Model: TS-219P

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby ADoko » Thu Dec 09, 2010 9:50 pm

newell,

Could you try this version and see if it works?

http://rapidshare.com/files/435876036/ARM-forked-daapd-install.tar.gz

It's based on GNU libc, but the kernel is still a new kernel. I don't think it will work, but it's worth a shot.
User avatar
ADoko
Easy as a breeze
 
Posts: 269
Joined: Wed Dec 01, 2010 1:08 am
NAS Model: TS-401T

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby newell » Fri Dec 10, 2010 6:58 am

Just did the install of the version above I get the same error:

Code: Select all
Finished installing.

[/share/Public/forked-daapd/ARM-forked-daapd-install] # /opt/etc/init.d/S15replace
[/share/Public/forked-daapd/ARM-forked-daapd-install] # /opt/etc/init.d/S20dbus start
Starting system message bus: S20dbus.
[/share/Public/forked-daapd/ARM-forked-daapd-install] # /opt/etc/init.d/S30bonjour start
FATAL: kernel too old
Starting bonjour services: FATAL: kernel too old
avahi-daemon.


But I am in the process of building an old kernel Ubuntu VirtualBox using your methods so I can play around with the libc options.

Thanks for the quick build to test.
newell
New here
 
Posts: 5
Joined: Sun Oct 26, 2008 8:49 am
NAS Model: TS-101/TS-201

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby ADoko » Fri Dec 10, 2010 7:26 am

newell wrote:But I am in the process of building an old kernel Ubuntu VirtualBox using your methods so I can play around with the libc options.

Thanks for the quick build to test.


Too bad it didn't work, but it was expected. I'll play around with compiling GNU libc against your kernel, but I don't think it will be easy. GNU libc 2.9 is a prerequisite of forked-daapd and I'm guessing it will be difficult to get GNU libc to compile. (It's difficult even when you're working with a recent kernel.) I may take look at the forked-daapd source code and see what features make it need to be compiled against 2.9. Maybe there's a work-around.

-Anthony
User avatar
ADoko
Easy as a breeze
 
Posts: 269
Joined: Wed Dec 01, 2010 1:08 am
NAS Model: TS-401T

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby edrikk » Fri Dec 10, 2010 11:35 am

As another 209 owner, this would be greatly appreciated Anthony!
User avatar
edrikk
Know my way around
 
Posts: 246
Joined: Sun Jan 20, 2008 12:12 pm

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby ADoko » Sat Dec 11, 2010 8:52 am

edrikk wrote:As another 209 owner, this would be greatly appreciated Anthony!


I hate to be the bearer of bad news, but even GNU libc 2.9 requires a kernel of at least 2.6.16 to be able to compile. As it stands the only option is for the TS209 to get a new kernel or for forked-daapd to drop it's requirement of GNU libc > 2.9.

I'll look at forked-daapd and see what the reason for using GNU libc 2.9 is, but I hold little hope of getting this project to run on a TS109/TS209.

-Anthony

P.S. I really tried. I got the kernel config for the TS209 and applied all the QNAP patches. Then patched the kernel some more because it didn't like being built with gcc 4.4.5. I got it built and the extracted the kernel headers. However, GNU libc just doesn't want them. :|
User avatar
ADoko
Easy as a breeze
 
Posts: 269
Joined: Wed Dec 01, 2010 1:08 am
NAS Model: TS-401T

Re: [HOWTO] replace mt-daapd with forked-daapd (iTunes serve

Postby MCFH » Sat Dec 11, 2010 11:40 pm

Anthony,
Thanks for the great work - I have been in desperate need of this. Can I ask one thing - can you recompile with the --enable-itunes option so that it can support the iTunes XML file format. None of my AIF files have metadata in and this makes them all come up as unknown artist!

Thanks
Mark
MCFH
New here
 
Posts: 6
Joined: Thu Oct 07, 2010 4:49 am
NAS Model: NMP-1000

PreviousNext

Return to Media Streaming

Who is online

Users browsing this forum: No registered users and 2 guests