You are not logged in.
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
/run is a tmpfs directory so all its content is stored in RAM and is lost when the computer is shutdown.
Offline
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
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
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)
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
Last edited by ZekeSulastin (2012-10-05 16:27:15)
Offline
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
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
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