You are not logged in.

#1 2015-03-25 12:26:19

manuelschneid3r
Member
From: Germany
Registered: 2013-04-14
Posts: 152

[Solved] Running mpd as user mpd with systemd without using mpd.conf

Maybe this is tivial, but I searched about an hour without any results. I want to run mpd as user mpd. I cant use the mpd config file since mpd set the UID and GID explicitely resulting in mpd not having the necessary supplementary groups to access the locally shared music on my pc. Well I tried to run mpd with systemd by

# systemctl start mpd

and  the systemd contains the user mpd

$ cat /etc/systemd/system/default.target.wants/mpd.service
[Unit]
Description=Music Player Daemon
After=network.target sound.target

[Service]
User=mpd
ExecStart=/usr/bin/mpd --no-daemon

# allow MPD to use real-time priority 50
LimitRTPRIO=50
LimitRTTIME=-1

# move MPD to a top-level cgroup, as real-time budget assignment fails
# in cgroup /system/mpd.service, because /system has a zero real-time
# budget; see
# http://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime/
ControlGroup=cpu:/mpd

# assign a real-time budget
ControlGroupAttribute=cpu.rt_runtime_us 500000

[Install]
WantedBy=default.target

but it did not run as mpd.

Well how can I run mpd as mpd? Is there a way to do it like with dropbox: dropbox@<user>.service

Last edited by manuelschneid3r (2015-03-25 12:52:52)


Please feel free to correct my english.

Offline

#2 2015-03-25 12:50:38

manuelschneid3r
Member
From: Germany
Registered: 2013-04-14
Posts: 152

Re: [Solved] Running mpd as user mpd with systemd without using mpd.conf

Finally found the problem. Somehow there was an mpd.service.d/ folder in /etc/systemd/system, which is thought to configure the service without changing the service file. The folger contained a file containing "User=", hence the service user fell back on root. Removing this solved the problem.

# ps -eo user,group,supgrp,args | grep " mpd"
mpd      mpd      mpd,audio,users                          /usr/bin/mpd --no-daemon

Please feel free to correct my english.

Offline

#3 2015-03-25 12:58:12

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] Running mpd as user mpd with systemd without using mpd.conf

Glad you solved it. Was just typing a response and I'll still add two remarks:

The ps|grep output showed that you run grep as root, not mpd itself (which won't have a space in the command -- the second time it only worked because the mpd group is preceded by a space).

It sounds like it took you a while to find the drop-in configuration snippet in the mpd.service.d directory. These drop-in are shown in `systemctl status`, which is something you'd normally check in situations like these, and that might help to discover them more quickly.

Last edited by Raynman (2015-03-25 12:58:36)

Offline

Board footer

Powered by FluxBB