Bug#769325: mediatomb: Mediatomb does not work with systemd

Patrick Häcker pat_h at web.de
Sat Jan 24 14:28:30 UTC 2015


Dear Héctor,

sorry for the delay until I found the time to answer.

> > So this is definitely inconsistent (using the port number from
> > /etc/default/mediatomb in systemd and using the port number from
> > /etc/mediatomb/config.xml in the init script) and completely
> > non-transparent to the user.
> 
> For reference, Fedora which did the systemd units ships with:
>   http://pkgs.fedoraproject.org/cgit/mediatomb.git/tree/mediatomb.service
> 
> So, IIUC, you suggest to release mediatomb without a preconfigured
> port because it causes conflicts when user has those settings
> configured in config.xml file. I might need to do some testing on that
> before pushing it forward.
I probably didn't think about that, but it sounds like a good idea, to either 
add the port to the sysvinit script, or to remove it from the systemd call. 
This would lead to a consistent Mediatomb behavior when switching the init 
system. Currently, Mediatomb can break when switching from sysvinit to 
systemd. The latter solution has the advantage, that there can be no 
conflicting port definition between the configurations in 
/etc/default/mediatomb and /etc/mediatomb/config.xml.

> > The reason can be seen in
> > /var/log/mediatomb:
> > ERROR: You can not specify interface and IP at the same time!
> > (Remember, that the ip has been set in /etc/mediatomb/config.xml)
> 
> Same conflict between config.xml and daemon configuration.

> I agree with your analysis, adding a NEWS note might be consistent.
 
> Let's focus on Jessie release, we need to do minimal, less intrusive
> changes to be able to pass release team acceptance.
> My plan is to drop MT_PORT and MT_INTERFACE from systemd unit file, if
> that works for all of us.
Unfortunately, I think that does not work in all cases. With your proposed 
change if a user configured the interface in /etc/default/mediatomb, his 
configuration changes by switching from sysvinit to systemd, as his 
configuration option is loaded from /etc/init.d/mediatomb, but not from 
/lib/systemd/system/mediatomb.service.

I think it will not even work with the port in all cases, as if a testing or 
unstable user configured the port in /etc/default/mediatomb and used systemd, 
his port has been respected before this change, but will not anymore after 
this change. But I think this is acceptable if accompanied with a NEWS note, 
as testing and unstable user should be able to cope with that and the behavior 
has not been in the archive for long.

> > I recommend to patch Mediatomb to exit with an error if the interface (and
> > ip) is configured in both /etc/mediatomb/config.xml and
> > /etc/default/mediatomb with differing values.

> For next release, are you willing to work/propose a patch that exits
> gratefully when there is a config mismatch between config.xml and
> default config? I would be willing to support that idea.
> 
> Do you think that is good compromise?
Yes, I really appreciate your patient and impressive handling of this bug 
report. However, I think my proposal is flawed. If Mediatomb checks, if 
/etc/init.d/mediatomb and /etc/mediatomb/config.xml contain conflicting 
variables, Mediatomb will also warn, if it has not been started by the init 
script or the unit file at all, which is wrong, because then there is no 
conflict. Depending on the implementation it will even warn, if 
/etc/mediatomb/config.xml is not used at all.

Fortunately, the proposal can be fixed, for example if Mediatomb detects how 
it has been started (by init script or by unit file or independently). 
However, this sounds like a hard problem.

Alternatively, the init script or the unit file have to do the checks, because 
they have all the information they need. I do not know if systemd can handle 
such a setup, but I guess, that it can execute some shell code, too.

Surprisingly, if we only want to support the default situation (where no 
variables have been removed from /etc/default/mediatomb), it's very simple to 
check if there are options in /etc/mediatomb/config.xml which will be ignored, 
as the options are already set in /etc/default/mediatomb:

> egrep --quiet '<ip>|<interface>' $MT_HOME/$MT_CFGDIR/config.xml \
> && echo "Warning: <ip> or <interface> definition in \
> $MT_HOME/$MT_CFGDIR/config.xml will be ignored \
> and the values defined in /etc/default/mediatomb will be used instead"

This check could easily be extended to test for <port>, too. Do you think this 
would work?

Kind regards
Patrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/attachments/20150124/8634677a/attachment.sig>


More information about the pkg-multimedia-maintainers mailing list