Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: mpd Access denied (Read 299 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

mpd Access denied

Hi there,

I have a user service:

~/.config/sv/mpd/run:

Code: [Select]
#!/bin/sh
MPDCONF=${XDG_CONFIG_HOME:-$HOME/.config}/mpd/mpd.conf
exec mpd --no-daemon $MPDCONF

/etc/runit/myname_services:

Code: [Select]
#!/bin/sh

export USER="myname"
export HOME="/home/$USER"

groups="$USER"
svdir="$HOME/.service"

exec chpst -u "$USER:$groups" runsvdir "$svdir"

sv status ~/.service/mpd shows:

Code: [Select]
run: /home/myname/.service/mpd: (pid 1254) 11135s

mpc update shows:

Code: [Select]
Updating DB (#16) ...
volume:100%   repeat: off   random: off   single: off   consume: off

However whenever I try to play a song by adding it to the queue, e.g. mpc add /path/to/song.flac, I get:

Code: [Select]
error adding /path/to/song.flac: Access denied

This happens with any song. The song is in my home directory and my user has read access to it. mpd clients like ncmpcpp also don't work.

~/.config/mpd/mpd.conf:

Code: [Select]
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "~/music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory "~/.mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file "~/.mpd/database"

###############################################################################


# General music daemon options ################################################
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
save_absolute_paths_in_playlists "no"
# This setting enables automatic update of MPD's database when files in
# music_directory are changed.
#
auto_update "yes"

# Input #######################################################################
#
input {
        plugin "curl"
#       proxy "proxy.isp.com:8080"
#       proxy_user "user"
#       proxy_password "password"
}

#
###############################################################################

# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.

# pipewire conf
audio_output {
    type            "pipewire"
    name            "PipeWire Sound Server"
}

Re: mpd Access denied

Reply #1
I have started it with my Wayland compositor instead of as a runit service and it's working now. It seems like all my runit user services are having problems tbh, but I'm not sure why. I made a simple test service echoing some text into some files in my home directory and that service is working when I set it up as a runit user service, but e.g. the above mpd user service doesn't work for me. I also had similar issues with pipewire and wireplumber as runit services, which is why I run them from my compositor startup commands.

So marking as solved, though not sure why this solved it and why the above doesn't work.