minidlna does not start via systemctl (OS_13.1)

I’m trying to get minidlna started during boot, but starting minidlna via systemctl does not seem to work.

Minidlna works, data is streamed too.

Details:
rpm: minidlna-1.1.4 from home:aevseev (http://download.opensuse.org/repositories/home:/aevseev/openSUSE_13.1).

Starting minidlna with the following command works:

/usr/sbin/minidlnad -f /etc/minidlna.conf -P /var/run/minidlna.pid -S

The command above is taken from the systemctl unit (or what is the name for it):

/etc/systemd/system/multi-user.target.wants/minidlna.service

The -S is especially for systemctl (see minidlnad --help)

The result of the systemctl command is:

# systemctl start minidlna.service
Job for minidlna.service failed. See 'systemctl status minidlna.service' and 'journalctl -xn' for details.

# systemctl status minidlna.service
minidlna.service - DLNA/UPnP-AV media server
   Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled)
   Active: failed (Result: timeout) since do 2014-12-04 10:55:13 CET; 11min ago
     Docs: man:minidlnad(8)
           man:minidlna.conf(5)
  Process: 11832 ExecStart=/usr/sbin/minidlnad -f /etc/minidlna.conf -P /var/run/minidlna.pid -S (code=exited, status=0/SUCCESS)


dec 04 10:53:43 os131-1 systemd[1]: Starting DLNA/UPnP-AV media server...
dec 04 10:53:43 os131-1 minidlnad[11832]: minidlna.c:1026: warn: Starting MiniDLNA version 1.1.4.
dec 04 10:53:43 os131-1 minidlnad[11832]: minidlna.c:1065: warn: HTTP listening on port 8200
dec 04 10:55:13 os131-1 systemd[1]: minidlna.service operation timed out. Terminating.
dec 04 10:55:13 os131-1 minidlnad[11832]: minidlna.c:154: warn: received signal 15, good-bye
dec 04 10:55:13 os131-1 systemd[1]: Failed to start DLNA/UPnP-AV media server.
dec 04 10:55:13 os131-1 systemd[1]: Unit minidlna.service entered failed state.

journal -xn does not reveal anything else.

What’s preventing systemctl to start minidlna? It seems to timeout after 90s, is that a sign for something?

Please post minidlna.service.

minidnla.service looks as follows:

# cat /etc/systemd/system/multi-user.target.wants/minidlna.service
[Unit]
Description=DLNA/UPnP-AV media server
Documentation=man:minidlnad(8) man:minidlna.conf(5)
Wants=network.target
ConditionFileIsExecutable=/usr/sbin/minidlnad


[Service]
Type=forking
ExecStart=/usr/sbin/minidlnad -f /etc/minidlna.conf -P /var/run/minidlna.pid -S
PIDFile=/var/run/minidlna.pid
Restart=on-abnormal


[Install]
WantedBy=multi-user.target



Try removing -S option. If it does what I suspect it does, service definition should be different.

Curious how you installed minidina since it requires libavformat.so.54()(64bit) but no openSUSE 13.1 package exists that provides that library. Did you install a version of that library that was intended for another OS or version?

TSU

That did the trick. So although the “-S” is especially designed for systemctl it breaks minidlna instead :cry:

os131-1:~ # minidlnad --help
......
        -S changes behaviour for systemd

With the -S argument it looks like the process remains in the foreground. From the code:

else if (GETFLAG(SYSTEMD_MASK))
{
         pid = getpid();
}
else
{
         pid = process_daemonize();

So for now the workaround seems to be to leave out the -S option.

TSU: It requires libavformat.so.56 and that library is available for openSUSE. You confused it with libavutil.so.54, which is also available for openSUSE. minidlna and its dependencies are provided via the home:aevseev repository.

Well, if you tell systemd that service will fork (Type=forking) and at the same time tell service to not fork, you are bound to have problems …

What value should be used instead of forking (type=)?

Well … personally I think that Type=forking and removing -S is the right solution. Otherwise if you want to keep -S use Type=simple.

Thanks a lot!