MPD paused forever

Trying to get an “alarm clock” going with mympd and well… mpd.
At first, it complained a lot but it seems to make do with this one:

Warning: Stopping mpd.service, but it can still be activated by:
  mpd.socket
c2@DietPi:~$ sudo mpd -v --no-daemon --stdout
config_file: loading file /etc/mpd.conf
server_socket: bind to '192.168.42.8:6600' failed: Address already in use (conti                    nuing anyway, because binding to '/run/mpd/socket' succeeded)
path: SetFSCharset: fs charset is: UTF-8
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.5
opus: libopus 1.2~alpha2
sndfile: libsndfile-1.0.27
wildmidi: configuration file does not exist: /etc/timidity/timidity.cfg
adplug: adplug 2.2.1
db: reading DB
curl: version 7.52.1
curl: with GnuTLS/3.5.8
avahi: Initializing interface
avahi: Client changed to state 2
avahi: Client is RUNNING
avahi: Registering service _mpd._tcp/DietPi MPD
avahi: Service group changed to state 0
avahi: Service group is UNCOMMITED
state_file: Loading state file /mnt/dietpi_userdata/.mpd_cache/state
playlist: play 0:"https://http-live.sr.se/p1-aac-192"
inotify: initializing inotify
inotify: watching music directory
avahi: Service group changed to state 1
avahi: Service group is REGISTERING
curl: icy-metaint=16000
decoder_thread: probing plugin faad
decoder: audio_format=48000:16:2, seekable=false
avahi: Service group changed to state 2
avahi: Service 'DietPi MPD' successfully established.

/etc/mpd.conf

music_directory "/mnt/dietpi_userdata/Music"
playlist_directory "/mnt/dietpi_userdata/Music"
db_file "/mnt/dietpi_userdata/.mpd_cache/db_file"
log_file "/var/log/mpd/mpd.log"
pid_file "/run/mpd/pid"
state_file "/mnt/dietpi_userdata/.mpd_cache/state"
sticker_file "/mnt/dietpi_userdata/.mpd_cache/sticker.sql"

#user "mpd" # Set via systemd unit to preserve supplementary group permissions i.e. "dietpi" group

bind_to_address "/run/mpd/socket"
bind_to_address "192.168.42.8:6600"

log_level "default"
#gapless_mp3_playback "yes"
#save_absolute_paths_in_playlists "no"
metadata_to_use "artist,album,title,track,name,genre,date"
auto_update "yes"
#auto_update_depth "3"

#follow_outside_symlinks "yes"
#follow_inside_symlinks "yes"

zeroconf_enabled "yes"
zeroconf_name "DietPi MPD"

#password "password@read,add,control,admin"
#default_permissions "read,add,control,admin"

input {

plugin "curl"
#proxy "proxy.isp.com:8080"
#proxy_user "user"
#proxy_password "password"

}

connection_timeout "30"
max_connections "4"
#max_playlist_length "16384"
#max_command_list_size "2048"
#max_output_buffer_size "8192"

filesystem_charset "UTF-8"

# Audio Output / Processing

# Disabled to allow native DSD output
#replaygain "track"
#replaygain_preamp "8"
#volume_normalization "yes"

audio_buffer_size "2048"
#buffer_before_play "10%"

audio_output {
       type     "pulse"
       name     "Bluetoothspeaker"
       server   "127.0.0.1"
format         "44100:16:2" 
}

#format "44100:16:2"
mixer_type "software"
#mixer_control "PCM"
#mixer_index "0"

# Realtime audio conversion & upscaling
#audio_output_format "48000:16:2"
#samplerate_converter "soxr very high"

/lib/systemd/system/mpd.service

[Unit]
Description=Music Player Daemon
Documentation=man:mpd(1) man:mpd.conf(5)
Documentation=file:///usr/share/doc/mpd/user-manual.html
After=network.target sound.target

[Service]
EnvironmentFile=/etc/default/mpd
ExecStart=/usr/bin/mpd --no-daemon $MPDCONF

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

# disallow writing to /usr, /bin, /sbin, ...
ProtectSystem=yes

# more paranoid security settings
NoNewPrivileges=yes

ProtectKernelTunables=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
RestrictNamespaces=yes

[Install]
WantedBy=multi-user.target
Also=mpd.socket
User=mpd

I added User=mpd since I thought, maybe it was this that was amiss.

Thankful for any direction.

Did you reinstall the mpd package? It looks like the default service file is in place now instead of our overwrite and there has not been a package update recently. Also I recognised that the systemd unit (service file) is indeed overwritten on package upgrades/reinstalls and not preserved as config file like e.g. the included SysV service. So we need to place out file at the override location.

However please fix it with:

cat << _EOF_ > /lib/systemd/system/mpd.service
[Unit]
Description=Music Player Daemon (DietPi)
Documentation=man:mpd(1) man:mpd.conf(5)
Wants=network-online.target
After=network-online.target sound.target

[Service]
Type=notify
User=mpd
PermissionsStartOnly=true
ExecStartPre=$(command -v mkdir) -p /run/mpd
ExecStartPre=$(command -v chown) -R mpd: /run/mpd
ExecStart=$(command -v mpd) --no-daemon /etc/mpd.conf

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

# disallow writing to /usr, /bin, /sbin, ...
ProtectSystem=yes

# more paranoid security settings
NoNewPrivileges=yes
ProtectKernelTunables=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
RestrictNamespaces=yes

[Install]
WantedBy=multi-user.target
Also=mpd.socket
_EOF_
systemctl daemon-reload
systemctl restart mpd

Quick checkin. Will do.

I first installed the dietpi version and when that one would not recognise ‘pulse’ as an output at all.

Hence, I took the drastic measurement to A) Apply the fix in op.
But when that did not pan out, I B) installed the debian standard.

Also… on another note, is there really not something for pulseaudio in dietpi/debian-verse like these?

Of course you can install and configure PulseAudio on Debian, you’ll find everything in the Debian APT repo you need. Only our software installs by default will be configured to use ALSA directly.

Okay, if you really need PA, then the Debian mpd is the way to go and our service file will just work the same. It is just required to have mpd in the “dietpi” group to grant it R/W access to media files in /mnt/dietpi_userdata/.