You are not logged in.

#1 2018-07-29 22:12:05

Shelbster
Member
Registered: 2017-11-16
Posts: 38

[SOLVED]MPD will not start as user on boot

I am trying to start MPD on boot as user. Unfortunately every time I reboot I need to chmod /run/mpd because I get this error as systemd starts mpd with the --user flag

fatal_error: Failed to create pid file "/run/mpd/mpd.pid": Permission denied arch linux site:bbs.archlinux.org

I am part of the mpd group.

The command I used to run as user was

systemctl --user enable mpd
systemctl --user start mpd

After I manually change the permissions to 770, I can run mpd this way, but until then I will continue to get this error. It would be nice if I didn't have to manually intervene every time I reboot.

Last edited by Shelbster (2018-07-30 13:09:57)

Offline

#2 2018-07-29 22:48:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]MPD will not start as user on boot

If you are running mpd as --user, create all of your directories under $HOME.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2018-07-30 02:35:40

Shelbster
Member
Registered: 2017-11-16
Posts: 38

Re: [SOLVED]MPD will not start as user on boot

Does that include the mpd folder in /run? I already have my mpd.conf in ~/.config/mpd. I can play mpd on ncmpcpp  and my music plays fine, but before I can get mpd up, I have to manually chmod the mpd folder in /run. I don't understand why it doesn't automatically work. Obviously I can make a script to automatically run the commands to chmod and then start mpd with the - - user flag, but I want to avoid work that I thought would be unnecessary as I thought systemd would take care of it with the - - user flag.

Offline

#4 2018-07-30 02:38:55

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]MPD will not start as user on boot

Just put the pid file in your home directory:

pid_file			"/home/shelbster/.config/mpd/pid"

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2018-07-30 07:50:31

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

Re: [SOLVED]MPD will not start as user on boot

Or simply remove the pid file setting and let systemd handle this.


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

#6 2018-07-30 13:09:42

Shelbster
Member
Registered: 2017-11-16
Posts: 38

Re: [SOLVED]MPD will not start as user on boot

Rasi wrote:

Or simply remove the pid file setting and let systemd handle this.

I actually incorrectly assumed that this was already going on, but I guess I was wrong. Commenting out the pid_file setting fixed my problem

jasonwryan wrote:

Just put the pid file in your home directory:

pid_file			"/home/shelbster/.config/mpd/pid"

I now understand what you mean. I was too dumb to realize that the pid_file setting was what was sending it to /run/mpd, is there a reason why this would be a better solution than just removing the pid_file setting?

Offline

#7 2018-07-30 17:52:11

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]MPD will not start as user on boot

No, you just seemed keen on declaring it in your config.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB