You are not logged in.

#1 2018-08-29 09:27:45

archserbian
Member
Registered: 2018-08-29
Posts: 4

[SOLVED] systemd and mpd problem

Here's my basic setup:

in /etc/mpd.conf I only set user to my normal user (nenad) and the rest of config is done in ~/.config/mpd/mpd.conf (I've done all this based on information at https://wiki.archlinux.org/index.php/Mu … th_systemd - section "User id startup workflow").

Then, my mpd.conf under HOME sets the rest of the configuration: state file, playlists folder, pid, log, database etc. All files are there and that part is OK.

But it won't start.

sudo systemctl start mpd

Job for mpd.service failed because the control process exited with error code.
See "systemctl status mpd.service" and "journalctl -xe" for details.

journalctl -xe

Aug 29 10:39:15 superzmaj-desktop sudo[5052]:    nenad : TTY=pts/2 ; PWD=/home/nenad/.config/mpd ; USER=root ; COMMAND=/usr/bin/systemctl stop mpd
Aug 29 10:39:15 superzmaj-desktop sudo[5052]: pam_unix(sudo:session): session opened for user root by nenad(uid=0)
Aug 29 10:39:15 superzmaj-desktop systemd[1]: Stopping Music Player Daemon...
-- Subject: Unit mpd.service has begun shutting down
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mpd.service has begun shutting down.
Aug 29 10:39:15 superzmaj-desktop systemd[1]: Stopped Music Player Daemon.
-- Subject: Unit mpd.service has finished shutting down
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mpd.service has finished shutting down.
Aug 29 10:39:15 superzmaj-desktop sudo[5052]: pam_unix(sudo:session): session closed for user root
Aug 29 10:39:27 superzmaj-desktop sudo[5057]:    nenad : TTY=pts/2 ; PWD=/home/nenad/.config/mpd ; USER=root ; COMMAND=/usr/bin/systemctl start mpd --user nenad
Aug 29 10:39:27 superzmaj-desktop sudo[5057]: pam_unix(sudo:session): session opened for user root by nenad(uid=0)
Aug 29 10:39:27 superzmaj-desktop sudo[5057]: pam_unix(sudo:session): session closed for user root
Aug 29 10:39:46 superzmaj-desktop sudo[5068]:    nenad : TTY=pts/2 ; PWD=/home/nenad/.config/mpd ; USER=root ; COMMAND=/usr/bin/nano /etc/mpd.conf
Aug 29 10:39:46 superzmaj-desktop sudo[5068]: pam_unix(sudo:session): session opened for user root by nenad(uid=0)
Aug 29 10:39:53 superzmaj-desktop sudo[5068]: pam_unix(sudo:session): session closed for user root
Aug 29 10:39:56 superzmaj-desktop sudo[5071]:    nenad : TTY=pts/2 ; PWD=/home/nenad/.config/mpd ; USER=root ; COMMAND=/usr/bin/systemctl start mpd
Aug 29 10:39:56 superzmaj-desktop sudo[5071]: pam_unix(sudo:session): session opened for user root by nenad(uid=0)
Aug 29 10:39:56 superzmaj-desktop systemd[1]: Starting Music Player Daemon...
-- Subject: Unit mpd.service has begun start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mpd.service has begun starting up.
Aug 29 10:39:56 superzmaj-desktop mpd[5074]: exception: bind to '0.0.0.0:6600' failed (continuing anyway, because binding to '[::]:6600' succeeded): Failed to bind soc>
Aug 29 10:39:56 superzmaj-desktop mpd[5074]: fatal_error: Failed to set group 1000: Operation not permitted
Aug 29 10:39:56 superzmaj-desktop systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
Aug 29 10:39:56 superzmaj-desktop systemd[1]: mpd.service: Failed with result 'exit-code'.
Aug 29 10:39:56 superzmaj-desktop systemd[1]: Failed to start Music Player Daemon.
-- Subject: Unit mpd.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mpd.service has failed.
-- 
-- The result is RESULT.
Aug 29 10:39:56 superzmaj-desktop sudo[5071]: pam_unix(sudo:session): session closed for user root

Group 1000 is my primary group, called the same as user. Section of mpd.conf stating group is commented. Should I use it?

When I try to start mpd with systemctl --user start mpd, I get the following error:

Failed to connect to bus: No such file or directory

Starting mpd as a normal program rather than a daemon leads to other problems, such as hogging the sound card so no other application can't use it - which is something I'll have to deal with later. But for now - I just want to be able to run mpd "the right way".

If you need me to post any additional info, I'd be happy to. Thanks in advance for all your help!

Last edited by archserbian (2018-08-29 12:56:48)

Offline

#2 2018-08-29 09:34:50

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] systemd and mpd problem

Don't use system wide if that is your end goal, use https://wiki.archlinux.org/index.php/Mu … th_systemd instead don't export the groups or users, just use the user service.

Offline

#3 2018-08-29 09:48:21

archserbian
Member
Registered: 2018-08-29
Posts: 4

Re: [SOLVED] systemd and mpd problem

Thanks!

I've done systemctl --user enable mpd and started it with systemctl --user start mpd

Created symlink /home/nenad/.config/systemd/user/default.target.wants/mpd.service → /usr/lib/systemd/user/mpd.service.

Now mpd starts nicely, but I've got that issue of music not playing because there is another media player using the sound card. I'm using ALSA output with default settings.

Offline

#4 2018-08-29 09:49:53

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] systemd and mpd problem

Post your MPD config as well as

sudo fuser -v /dev/snd/*

in general if you haven't changed anything in your ALSA config explicitly you must ensure that every client you expect to have audio from plays to the 'default' device and not directly to hw:0 or so, as that will invoke direct hardware access and block multiple applications from using it at the same time

Offline

#5 2018-08-29 09:53:02

archserbian
Member
Registered: 2018-08-29
Posts: 4

Re: [SOLVED] systemd and mpd problem

mpd.conf output section (It's the only enabled output)

audio_output {
        type            "alsa"
        name            "alsa1"
#       device          "hw:0,0"        # optional
#       mixer_type      "hardware"      # optional
#       mixer_device    "default"       # optional
#       mixer_control   "PCM"           # optional
#       mixer_index     "0"             # optional
}

sudo fuser -v /dev/snd/*

                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  nenad       668 F.... pulseaudio
                     nenad      6481 F.... mpd
/dev/snd/controlC1:  nenad       668 F.... pulseaudio
/dev/snd/pcmC0D0p:   nenad       668 F...m pulseaudio

Last edited by archserbian (2018-08-29 09:54:52)

Offline

#6 2018-08-29 10:31:27

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] systemd and mpd problem

As you are using pulseaudio just configure type "pulse" instead on your MPD conf.

Offline

#7 2018-08-29 12:55:33

archserbian
Member
Registered: 2018-08-29
Posts: 4

Re: [SOLVED] systemd and mpd problem

Switching to pulse output did the trick.

It never occurred to me that PulseAudio is what I need to use.

Thank you very much, V1del!

Offline

Board footer

Powered by FluxBB