# systemd and minidlna

## elmar283

After switching from OpenRC to Systemd I have some problems with minidlna.

If I start it the pid-file is not created. If I start a movie from my TV the service is disabled.

This is the output of the status after starting:

```
zaphodbeeblebrox system # sudo systemctl status minidlna.service

● minidlna.service - MiniDLNA is a DLNA/UPnP-AV server software

   Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled)

   Active: activating (start) since za 2014-07-19 21:34:04 CEST; 37s ago

  Process: 23859 ExecStart=/usr/sbin/minidlnad -f /etc/minidlna.conf -P /var/run/minidlna/minidlna.pid (code=exited, status=0/SUCCESS)

   CGroup: /system.slice/minidlna.service

           └─23860 /usr/sbin/minidlnad -f /etc/minidlna.conf -P /var/run/minidlna/minidlna.pid

jul 19 21:34:04 zaphodbeeblebrox.elmarotter.eu systemd[1]: PID file /var/run/minidlna/minidlna.pid not readable (yet?) after start.

```

And this after failing:

```

zaphodbeeblebrox run # sudo systemctl status minidlna.service

● minidlna.service - MiniDLNA is a DLNA/UPnP-AV server software

   Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled)

   Active: failed (Result: timeout) since za 2014-07-19 21:35:34 CEST; 1min 40s ago

  Process: 23859 ExecStart=/usr/sbin/minidlnad -f /etc/minidlna.conf -P /var/run/minidlna/minidlna.pid (code=exited, status=0/SUCCESS)

jul 19 21:34:04 zaphodbeeblebrox.elmarotter.eu systemd[1]: PID file /var/run/minidlna/minidlna.pid not readable (yet?) after start.

jul 19 21:35:34 zaphodbeeblebrox.elmarotter.eu systemd[1]: minidlna.service start operation timed out. Terminating.

jul 19 21:35:34 zaphodbeeblebrox.elmarotter.eu systemd[1]: Failed to start MiniDLNA is a DLNA/UPnP-AV server software.

jul 19 21:35:34 zaphodbeeblebrox.elmarotter.eu systemd[1]: Unit minidlna.service entered failed state.

```

Can anyone help me with this problem?

----------

## elmar283

It seems that the script is not able to create a directory on /run/. After I added the directory /var/minidlna and gave it the right permissions it works. But still it is strange that systemctl doesn't seem to have write permissions.

----------

## elmar283

This does only tempory fix the problem. After reboot I have make the directory all over again. So it won't start on boot.  :Sad: 

Has anyone a sullution or know where to file a bug or where a bug is already be filed about this?

----------

## Melsion

Same problem here... any ideas?

----------

## Melsion

Doing some testing, I see minidlna starts and works for a while (systemd says it's starting), but after a minute or so it looks like systemd kills it and says "failed"...

----------

## Adel Ahmed

as a work around

I have created a bashrc entry that creates the directories(chmods them) and then starts the minidlna service manually(systemctl start)

that's not a solution, but it'll get things going till your problem is fixed

----------

## elmar283

I have added a local script to start MiniDNLA:

```

elmarotter@zaphodbeeblebrox /etc/systemd/system $ cat minidlna-local.service 

[Unit]

Description=MiniDLNA is a DLNA/UPnP-AV server software

After=syslog.target local-fs.target network.target

[Service]

User=minidlna

Group=minidlna

Type=forking

ExecStart=/usr/sbin/minidlnad -f /etc/minidlna.conf 

[Install]

WantedBy=multi-user.target

```

EDIT: also see this forum for local scripts: https://forums.gentoo.org/viewtopic-t-995866-highlight-systemd+wlp3s0.html

----------

