Ubuntu

Mediatomb Init Script not working : upnp error -117

Reported by Steven Harper on 2008-04-05
88
This bug affects 11 people
Affects Status Importance Assigned to Milestone
mediatomb (Debian)
New
Unknown
mediatomb (Ubuntu)
Undecided
Daniel van Vugt
network-manager (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: mediatomb

When I start the server on a command line

sudo /etc/init.d/mediatomb

everything works - also on first install the server is started correctly

However I want the server to start correctly (as its linked in /etc/rc2.d/S20mediatomb)

When I look in the logs (/var/log/mediatomb.log) a good startup looks like this

2008-04-05 19:45:01 INFO: Loading configuration from: /etc/mediatomb/config.xml
2008-04-05 19:45:01 INFO: Checking configuration...
2008-04-05 19:45:01 INFO: Setting filesystem import charset to UTF-8
2008-04-05 19:45:01 INFO: Setting metadata import charset to UTF-8
2008-04-05 19:45:01 INFO: Setting playlist charset to UTF-8
2008-04-05 19:45:01 INFO: Configuration check succeeded.
2008-04-05 19:45:01 INFO: Initialized port: 49153
2008-04-05 19:45:01 INFO: Server bound to: 192.168.2.4
2008-04-05 19:45:02 INFO: MediaTomb Web UI can be reached by following this link:
2008-04-05 19:45:02 INFO: http://192.168.2.4:49153/

If I look at the log after a normal boot I have this

2008-04-05 19:47:22 INFO: Loading configuration from: /etc/mediatomb/config.xml
2008-04-05 19:47:22 INFO: Checking configuration...
2008-04-05 19:47:22 INFO: Setting filesystem import charset to ANSI_X3.4-1968
2008-04-05 19:47:22 INFO: Setting metadata import charset to ANSI_X3.4-1968
2008-04-05 19:47:22 INFO: Setting playlist charset to ANSI_X3.4-1968
2008-04-05 19:47:22 INFO: Configuration check succeeded.
2008-04-05 19:47:22 ERROR: main: upnp error -117
2008-04-05 19:47:22 ERROR: upnp_cleanup: UpnpUnRegisterRootDevice failed

thats the last line in the log...

I think that its something that the init script relies on in the users ~/.bashrc

Related branches

lp:~vanvugt/ubuntu/oneiric/mediatomb/fix-212441
Merged into lp:ubuntu/oneiric/mediatomb at revision 17
Luke Yelavich: Approve on 2011-06-03
Evan Broder: Pending requested 2011-05-25
Ubuntu branches: Pending requested 2011-05-25
Steven Harper (stevenharperuk) wrote :

I have also tried adding the following into the /etc/init.d/mediatomb

route add -net 239.0.0.0 netmask 255.0.0.0 eth0
ifconfig eth0 allmulti

However id doesn't work, maybe it has something to do with network manager - and the default file

/etc/network/interfaces

which only contains

auto eth0
iface eth0 inet dhcp

Steven Harper (stevenharperuk) wrote :

Fixed it manually

I have added the following to my /etc/network/interfaces
--------------------------
auto eth0
iface eth0 inet dhcp
--------------------------
so my whole file now is

--------------------------
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
--------------------------

The problem is that most (i suspect over 90%) people will alway rely on the GDM to set their network up, so the /etc/network/interfaces will never get an entry

Whats needed is either DBUS integration to detect the current adapters, or maybe just a warning message on first start (this may scare off most people)

What I would do is if there are no adapters detected, then maybe either

Have an optional hard coded one in /etc/mediatomb/config.xml
run the ifconfig command and take the first non-loopback entry with an IP

Changed in mediatomb:
status: New → Confirmed
Alexander Sack (asac) wrote :

NM doesnt manage devices in /etc/network/interfaces.

Changed in network-manager:
status: New → Invalid
Eugene Cormier (eugene-cormier) wrote :

This bug still exists in Jaunty, but now adding to interfaces:
auto eth0
iface eth0 inet dhcp

doesn't fix it.....
I first tried adding eth0 to my /etc/network/interfaces file ....and that did nothing, then I tried messing with the boot order (in /etc/rc5.d I noticed that mediatomb was K20 and that NM was later, so I switched mediatomb to K55) but that did nothing ......put everything back to normal and just start it manually each reboot

So the question here is.....what changed in Jaunty, what is the actual process that starts networking before the gui, and where do I find it ......mediatomb is a really great app....this really seems like it should be easy to fix (apart from the network before gui things of course) ......maybe the easy solution is to have it start after the gui starts??

Koen Beek (koen-beek) on 2009-05-03
summary: - Init Script on Hardy not working
+ Mediatomb Init Script not working : upnp error -117
Koen Beek (koen-beek) wrote :

The Mediatomb FAQ page http://mediatomb.cc/dokuwiki/faq:faq contains the following suggestion for Ubuntu :

- Launch the Sessions Preferences program ( System→Preferences→Sessions or Startup Applications)
- Click “Add”
- Name: Mediatomb , Command: mediatomb -d
- Click “Add”

config used will now be in ~/.mediatomb/config.xml in stead of /etc/mediatomb/config.xml

mwolfe38 (mwolfe38) wrote :

I had this same problem with 8.10 until I removed network manager and assigned my ip manually (because network manager had some issues with static ip's at the time).
So now I have 9.04 and it seems to manage static ip's just fine but this problems persists.

Adding mediatomb to my session isn't a very good solution imo because I may have my computer on but not logged in and thus mediatomb will not be running..

I thought it would have been an issue with needing to start mediatomb after NM but according to a post above that didnt work. Any resolution to this yet? I may uninstall nm on this box again as I use a static local ip anyways.

Koen Beek (koen-beek) wrote :

The mediatomb faq suggest another solution that can be used for head-less machines (no need to log in) which is a bit more complex, I haven't tried it

<quote>
For a “headless” server where you can't log in, try this workaround: edit file /etc/network/interfaces adding these 2 lines:

auto eth0
iface eth0 inet dhcp

Please note the following if using this method:

    * As soon as you save changes to /etc/network/interfaces, your ethernet port will become disabled. So make sure you are logged in via the physical console (not ssh or telnet) when editing!
    * After your edit is complete, you must run /etc/init.d/networking restart to re-enable your ethernet.
    * Network Manager will report that your network is manually configured. This shouldn't be a problem for most people.
    * This workaround is for dhcp. If you are sophisticated enough to be using a static IP address, you should know what to do :-)
    * You may still need to add a sleep command to /etc/init.d/mediatomb, as described below for OS X, to get reliable startup without error -117.
</quote>

Richard Bailey (rmjb) wrote :

Unfortunately the workaround proposed in the mediatomb faq no longer works on Jaunty as detailed by comment #4.

I also tried setting eth0 in the interface file and tried removing network manager and tried moving mediatomb to start after NetworkManager in rc2 (the apparent default runlevel) but none of those worked.
I also tried a script with a sleep of 60 seconds then it would restart mediatomb and that also didn't work.

I wanted to emulate the behaviour of the ntp daemon which seems to start with the network. On further investigation I found the directories if-up.d and if-down.d in /etc/network which contain scripts that run when the network comes up and goes down respectively.

Emulating a line from the ntp script I created two scripts for mediatomb. The one in if-up.d executes:

invoke-rc.d mediatomb restart

and in if-down.d it executes:

invoke-rc.d mediatomb stop

After I rebooted my machine mediatomb now starts up automatically with the network.

I'm attaching a tar archive with the two scripts, you can cd to /etc/network and untar the archive there.

Last thing, the links in the rcX directories are now pointless so I removed mine by executing:

sudo update-rc.d -f mediatomb remove

And finally, you can always check /var/log/mediatomb.log for details on if mediatomb is running.

John Holland (john-holland) wrote :

I had the same problem until I tried Richards solution. Now it seems to be working fine. I do however, guard against lo events and mediatomb removal.

Thanks Richard.

Brian Millan (brian.millan) wrote :

This fix worked for me as well, however, I share a folder with Samba from the MediaTomb server to a Windows XP machine. Even though MediaTomb now starts up every time at boot, the share disappears on the Windows machine!

Brian

This fix really helped!

One remark - the restart option does not contain the command to set up a route for broadcasting the availability of the mediatomb server. To solve the problem (which could be considered a fault in the mediatomb startup script) I've copied this part of the script from the start option to the restart option:

  # try to add the multicast route
  if [ "$VERBOSE" != no ]; then
   {
    log_action_begin_msg \
    "$NAME: Trying to add the multicast route"
    $ROUTE_ADD $INTERFACE \
    && log_action_end_msg 0
   } || {
    true && \
    log_warning_msg "Failed to add multicast route. skipping."
   }
  else
   $ROUTE_ADD $INTERFACE >/dev/null 2>&1 || true
  fi

Klaus

loula (alex-loula) wrote :

I was facing a similar issue, but mine was not related with network. I'm using static IP.

My problem was that the filesystem charset was not loaded correctly. I have <filesystem-charset>UTF-8</filesystem-charset> on my config.xml. However after boot the loaded charset was the "ANSI_X3.4-1968". If I restarted the mediatomb (/etc/init.d/mediatomb restart) after login, the charset "UTF-8" was loaded correctly.

I'm using the latest development code (0.12) from SVN. I changed the src/config_manager.cc file as below:
Right after this line:
if (setlocale(LC_ALL, "") != NULL)
Change this:
temp = nl_langinfo(CODESET);
To:
temp = "UTF-8";

Since I'm not a C/C++ expert, I guess there are best solutions. However this is working for me:

2010-01-29 14:43:18 INFO: Loading configuration from: /home/mediatomb/.mediatomb/config.xml
2010-01-29 14:43:18 INFO: Checking configuration...
2010-01-29 14:43:18 INFO: Setting filesystem import charset to UTF-8
2010-01-29 14:43:18 INFO: Setting metadata import charset to UTF-8
2010-01-29 14:43:18 INFO: Setting playlist charset to UTF-8
2010-01-29 14:43:18 WARNING: You enabled the YouTube feature, which allows you
                             to watch YouTube videos on your UPnP device!
                             Please check http://www.youtube.com/t/terms
                             By using this feature you may be violating YouTube
                             service terms and conditions!

2010-01-29 14:43:18 INFO: Configuration check succeeded.
2010-01-29 14:43:18 INFO: Initialized port: 50500
2010-01-29 14:43:18 INFO: Server bound to: 10.1.0.100
2010-01-29 14:43:19 INFO: MediaTomb Web UI can be reached by following this link:
2010-01-29 14:43:19 INFO: http://10.1.0.100:50500/

Alecz20 (alexguzu) on 2010-05-04
Changed in network-manager (Ubuntu):
status: Invalid → Confirmed
Alecz20 (alexguzu) wrote :

I am re-opening this bug because it still persists on a fresh installation of Ubuntu 9.04 Server Edition.

The suggestion in comment #4 does not fix it, and is also the default for the server install anyhow.

The solution provided in comment #8 is merely a workaround and if this is considered "a FIX" (which I think not), it should be done when installing mediatomb.

Also, what does error -117 mean?

Martin (martin-klose) wrote :

the same problems still exists in 10.10 server edition. autostart doesn't work. error 117

Martin (martin-klose) wrote :

Since none of the fixes seem to be doing anything. I put a little 'sleep 10' in the start function in /etc/init.d/mediatomb. et voila this works for me and gives you guys time to fix it.... :-))

Daniel van Vugt (vanvugt) wrote :

Here is a more elegant solution using Upstart...

/etc/init.d/mediatomb stop
mv mediatomb.conf /etc/init/ # mediatomb.conf is attached
mv /etc/init.d/mediatomb /etc/init.d/mediatomb.old
rm -f /etc/rc?.d/[SK]??mediatomb
start mediatomb

Daniel van Vugt (vanvugt) wrote :

FIX: Attached a patch for mediatomb source 0.12.1-0ubuntu1. This replaces /etc/init.d/mediatomb with a more modern Upstart script /etc/init/mediatomb.conf and fixes LP: #212441.

The patch contains deb packaging/script changes only. No code changes.

Daniel van Vugt (vanvugt) wrote :

As I have now posted a fix for this bug and it has nothing to do network-manager, I don't think this bug should "affect" network-manager at all.

Changed in network-manager (Ubuntu):
status: Confirmed → Invalid
Daniel van Vugt (vanvugt) wrote :

Here's a smaller nicer patch to solve the problem. This one should be compatible with upstream Debian. By compatible I mean "won't break" upstream Debian, but the patch still only fixes the bug for upstart-based distros like Ubuntu.

Changed in mediatomb (Debian):
status: Unknown → New
Daniel van Vugt (vanvugt) wrote :

Fix now available for maverck and natty in my PPA: https://launchpad.net/~vanvugt/+archive/mediatomb

tags: added: patch
Changed in mediatomb (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
status: Confirmed → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mediatomb - 0.12.1-0ubuntu2

---------------
mediatomb (0.12.1-0ubuntu2) oneiric; urgency=low

  * Introduce Upstart support to fix start-on-boot failure (LP: #212441)
  * Fix build gcc-4.6 build failure (missing correct header) (LP: #770964)
  * Added libav 0.7 support (LP: #784431)
 -- Daniel van Vugt <email address hidden> Sun, 15 May 2011 23:09:43 +0800

Changed in mediatomb (Ubuntu):
status: In Progress → Fix Released
Changed in mediatomb (Debian):
status: New → Fix Released
Changed in mediatomb (Debian):
status: Fix Released → New
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.