Mediatomb on Ubuntu - init script
Cyclonite
Tampa, Florida Icrontian
I'm hopin' one of you linux gods can help me here. I don't profess to know what I'm doing in Linux. I've tried a couple different distros at different points in my life, and right now I'm using Ubuntu 7.10.
I installed Mediatomb using the instructions from their website for the Feisty install. After installing, I prepped the config.xml and launched the server. It worked great. I can browse to the WebUI and add the directories. My PS3 recognizes it and the music streams just fine.
Now on to my problem. I want this to run at startup as a service (daemon?), so I took a look around and found I have to use an init script. One is included when you install Medatomb, and it's already placed in /etc/init.d. So I take a look at it and alter the required settings. My issue comes when it tries to run at startup. At first it was giving me the UPnp Error -117 referenced in the documentation on the site. SO I decided to follow the instructions:
The init script adds this when you specify an interface in /etc/default/mediatomb. This is where my next problem comes in: It gives me an error saying it cannot find the specified interface. Specifically, eth1. This is the interface my network cable is connected to, and it has an IP address.
I assumed the interface may not have been fully up yet, so I tried to delay the script startup. I'm not sure if I was successful in delaying it, but either way, I still get the error.
I tried specifying the loopback interface "lo" for the init script, and the server starts up without a hitch. Obviously that doesn't help me share files, but maybe it'll help someone point me in the right direction.
Thanks in advance for your help. I can provide any output you may need. You might have to tell me how to get it though.
I installed Mediatomb using the instructions from their website for the Feisty install. After installing, I prepped the config.xml and launched the server. It worked great. I can browse to the WebUI and add the directories. My PS3 recognizes it and the music streams just fine.
Now on to my problem. I want this to run at startup as a service (daemon?), so I took a look around and found I have to use an init script. One is included when you install Medatomb, and it's already placed in /etc/init.d. So I take a look at it and alter the required settings. My issue comes when it tries to run at startup. At first it was giving me the UPnp Error -117 referenced in the documentation on the site. SO I decided to follow the instructions:
4.1. Network Setup
Some systems require a special setup on the network interface. If MediaTomb exits with UPnP Error -117, or if it does not respond to M-SEARCH requests from the renderer (i.e. MediaTomb is running, but your renderer device does not show it) you should try the following settings (the lines below assume that MediaTomb is running on a Linux machine, on network interface eth1):
# route add -net 239.0.0.0 netmask 255.0.0.0 eth1
# ifconfig eth1 allmulti
Those settings will be applied automatically by the init.d startup script.
The init script adds this when you specify an interface in /etc/default/mediatomb. This is where my next problem comes in: It gives me an error saying it cannot find the specified interface. Specifically, eth1. This is the interface my network cable is connected to, and it has an IP address.
I assumed the interface may not have been fully up yet, so I tried to delay the script startup. I'm not sure if I was successful in delaying it, but either way, I still get the error.
I tried specifying the loopback interface "lo" for the init script, and the server starts up without a hitch. Obviously that doesn't help me share files, but maybe it'll help someone point me in the right direction.
Thanks in advance for your help. I can provide any output you may need. You might have to tell me how to get it though.
0
Comments
I am not sure, if I understand you right, but did you edit the init script directly? That is not a good thing. All settings should be made in /etc/default/mediatomb.
Do you get the error messages at boot or when you issue "/etc/init.d/mediatomb start" at the command line?
And I forgot to mention that, sorry. If I run "/etc/init.d/mediatomb start" from the command line, it works fine as well.
When I get home tonight, I'll post my init script and the other related files.
Init script:
And here's the /etc/default/mediatomb text:
And here's a portion of /var/log/mediatomb showing what happens at startup:
Also, just so you don't think I'm using the wrong interface, ifconfig:
You could check the directories /etc/rc0.d, where the symlink for starting your network should be, and /etc/rc2.d, where i think the mediatomb symlink should be. It looks like S**mediatomb, where ** is a two digit number. The higher the number the later the service gets started in the corresponding runlevel.
"update-rc.d -f mediatomb remove"
"update-rc.d mediatomb defaults 99"
At least you're verifying my actions were correct. Sometimes I feel like a dummy with Linux. Haha.
I know what you mean . Like in this case. Why the heck, would an init-script work perfektly when called by hand and won't when called during boot? Sorry, but I am out of ideas on this one.
But maybe, looking at the error message again, you could add entries in /etc/mediatomb/config.xml for these two errors:
2008-02-06 21:51:29 INFO: Config: option not found: /server/interface using default value:
2008-02-06 21:51:29 INFO: Config: option not found: /server/ip using default value:
Maybe that helps
I started researching udev - networking specifically - and stumbled across another location that is used for naming the interfaces: /etc/network/interfaces. Heh. How obvious is that one?
Anyway, it turns out that file only had a listing for lo. I added eth0 and eth1, so now it looks like:
After rebooting, the server comes up just fine.
//Edit: And as a side not, this is the first result when Googling "mediatomb init." Heh.
Never would have thought about that one, since the devices were shown by ifconfig, so i just figured, they were configured right in /etc/network/interfaces. I guess, since ubuntu uses NetworkManager for configuring network devices, these settings are no longer made during install.
Maybe you should write a mail to the developers, so they could put that into their docs or find a fix for that problem.
Happy streaming ...
sudo update-rc.d -f mediatomb remove
sudo update-rc.d mediatomb defaults 99
sudo gedit /etc/network/interfaces