You are not logged in.

#1 2012-10-05 08:26:06

SBolz
Member
Registered: 2012-10-05
Posts: 4

[SOLVED] directory /run/mpd gets deleted at reboot

Hello

I had MPD up and running, everything worked fine, until reboot.
I then found out, that the folder /run/mpd which should contain mpd.pid gets deleted at reboot.
Why does this folder get deleted?
When i manually create the folder again and chown it to mpd, it all works fine again.

Thanks for your help,
SBolz

Last edited by SBolz (2012-10-06 08:03:49)

Offline

#2 2012-10-05 08:54:51

Teho
Member
Registered: 2010-01-30
Posts: 200

Re: [SOLVED] directory /run/mpd gets deleted at reboot

/run is a tmpfs directory so all its content is stored in RAM and is lost when the computer is shutdown.


HP Elitebook 8560w | Arch Linux | KDE

Offline

#3 2012-10-05 09:29:21

SBolz
Member
Registered: 2012-10-05
Posts: 4

Re: [SOLVED] directory /run/mpd gets deleted at reboot

Thanks for your reply.

So if /run is a tempfs, how can the MPD create this /run/mpd/mpd.pid file as described in the wiki?
The wiki states "Usually the init-script should properly create /run/mpd/ when starting."
Apparently it doesn't. How can i make sure it gets created and the user mpd has writing permissions for it?

Offline

#4 2012-10-05 12:51:51

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,832
Website

Re: [SOLVED] directory /run/mpd gets deleted at reboot

Just run the mpd setup script from archwiki mpd page. Its meant for usermode, but it also asks if you want to enable the daemon.
This will not use any strange paths at all, but only create ~/.mpd where ~ means home of the user that actually owns the music files (which usally is NOT user "mpd", but your own user)

that whole privileged user thing in mpd is just complicating things and simply not needed.

Last edited by Rasi (2012-10-05 12:52:36)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#5 2012-10-05 16:11:14

ZekeSulastin
Member
Registered: 2010-09-20
Posts: 266

Re: [SOLVED] directory /run/mpd gets deleted at reboot

SBolz wrote:

Apparently it doesn't. How can i make sure it gets created and the user mpd has writing permissions for it?

man tmpfiles.d - if you look at the files provided by the mpd package, you'll see a file mpd.conf in /usr/lib/tmpfiles.d which should generate the directory on boot.

(also, the systemd service for a separate-user mpd doesn't need the pidfile at all)

Rasi wrote:

that whole privileged user thing in mpd is just complicating things and simply not needed.

That depends on what your actual use case is, does it not?  Nice plug for your script though wink

Last edited by ZekeSulastin (2012-10-05 16:27:15)

Offline

#6 2012-10-05 18:16:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 12,282

Re: [SOLVED] directory /run/mpd gets deleted at reboot

Just for the record. the 'pid' in that file name means "Process Identifier".  The PID of the process is stored in that file, the next time the daemon is run, that file will be created for the new PID.  If the daemon is not running, the file should not exist.  If it does, it means that the daemon crashed and did not exit cleanly.  It most definitely should not be allowed to survive across a reboot.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Like you, I have no idea what you are doing, but I am pretty sure it is wrong...Jasonwryan
----
How to Ask Questions the Smart Way

Offline

#7 2012-10-06 08:03:27

SBolz
Member
Registered: 2012-10-05
Posts: 4

Re: [SOLVED] directory /run/mpd gets deleted at reboot

Thank you all for your help.

The solution was to run "systemd-tmpfiles --create", which obviously creates the folders declared in /usr/lib/tmpfiles.d, as ZekeSulastin stated.

Next time I'll probably use the script made by Rasi (which I haven't noticed before), although I don't know if this is suitable for a headless server.

Thanks again!

Offline

Board footer

Powered by FluxBB