Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#887834: mpd installation fails, cannot open /var/lib/mpd/tag_cache, /run/mpd/pid

722 views
Skip to first unread message

Guillaume

unread,
Jan 20, 2018, 8:00:03 AM1/20/18
to
Package: mpd
Version: 0.20.14-1

When attempting to install the mpd package from Debian testing, it fails
with the following errors:

> Setting up mpd (0.20.14-1) ...
> Job for mpd.service failed because the control process exited with error code.
> See "systemctl status mpd.service" and "journalctl -xe" for details.
> invoke-rc.d: initscript mpd, action "start" failed.
> ● mpd.service - Music Player Daemon
> Loaded: loaded (/lib/systemd/system/mpd.service; disabled; vendor preset: enabled)
> Active: failed (Result: exit-code) since Sat 2018-01-20 12:37:07 CET; 16ms ago
> Docs: man:mpd(1)
> man:mpd.conf(5)
> file:///usr/share/doc/mpd/user-manual.html
> Process: 5411 ExecStart=/usr/bin/mpd --no-daemon $MPDCONF (code=exited, status=1/FAILURE)
> Main PID: 5411 (code=exited, status=1/FAILURE)
>
> Jan 20 12:37:06 sark systemd[1]: Starting Music Player Daemon...
> Jan 20 12:37:07 sark mpd[5411]: Jan 20 12:37 : exception: Failed to open /var/lib/mpd/tag_cache: No such file or directory
> Jan 20 12:37:07 sark mpd[5411]: Jan 20 12:37 : fatal_error: Failed to create pid file "/run/mpd/pid": No such file or directory
> Jan 20 12:37:07 sark systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
> Jan 20 12:37:07 sark systemd[1]: mpd.service: Failed with result 'exit-code'.
> Jan 20 12:37:07 sark systemd[1]: Failed to start Music Player Daemon.
> dpkg: error processing package mpd (--configure):
> installed mpd package post-installation script subprocess returned error exit status 1

Guillaume Andrieu

unread,
Jan 20, 2018, 8:30:02 AM1/20/18
to
I have used the following workaround to complete mpd installation:

> # mkdir /run/mpd
> # touch /var/lib/mpd/tag_cache
> # chown mpd.audio /var/lib/mpd/tag_cache
> # touch /run/mpd/pid
> # chown mpd.audio /run/mpd/pid
> # aptitude install

Florian Schlichting

unread,
Feb 13, 2018, 3:30:03 PM2/13/18
to
Control: tags 887834 + moreinfo


Hi Guillaume,

> When attempting to install the mpd package from Debian testing, it fails
> with the following errors:
>
> > Setting up mpd (0.20.14-1) ...
> > Job for mpd.service failed because the control process exited with error code.
> > See "systemctl status mpd.service" and "journalctl -xe" for details.
> > invoke-rc.d: initscript mpd, action "start" failed.
> > ● mpd.service - Music Player Daemon
> > Loaded: loaded (/lib/systemd/system/mpd.service; disabled; vendor preset: enabled)

if this is a first install, why would mpd.service be disabled?

> > Active: failed (Result: exit-code) since Sat 2018-01-20 12:37:07 CET; 16ms ago
> > Docs: man:mpd(1)
> > man:mpd.conf(5)
> > file:///usr/share/doc/mpd/user-manual.html
> > Process: 5411 ExecStart=/usr/bin/mpd --no-daemon $MPDCONF (code=exited, status=1/FAILURE)
> > Main PID: 5411 (code=exited, status=1/FAILURE)
> >
> > Jan 20 12:37:06 sark systemd[1]: Starting Music Player Daemon...
> > Jan 20 12:37:07 sark mpd[5411]: Jan 20 12:37 : exception: Failed to open /var/lib/mpd/tag_cache: No such file or directory
> > Jan 20 12:37:07 sark mpd[5411]: Jan 20 12:37 : fatal_error: Failed to create pid file "/run/mpd/pid": No such file or directory

This is the fatal error: /run/mpd does not exist. It is created through
/usr/lib/tmpfiles.d/mpd.conf; any idea why this didn't happen in your
case?

Florian

Ryan Kavanagh

unread,
Nov 4, 2021, 2:30:03 PM11/4/21
to
Control: unarchive -1
Control: reopen -1 !
Control: found -1 0.23.3-1
Control: severity -1 grave
Justification: renders package unusable

Hi Florian,

I can reproduce this bug with 0.23.3-1. I purged mpd and reinstalled it,
and have the following minimal mpd.conf:

--------------------------------------------------
music_directory "/var/lib/mpd/music"
db_file "/var/lib/mpd/tag_cache"
pid_file "/run/mpd/pid"
state_file "/var/lib/mpd/state"
log_level "verbose"

user "mpd"
bind_to_address "127.0.0.1"

audio_output {
type "null"
name "null"
}
--------------------------------------------------

Attempting to start mpd results in:

--------------------------------------------------
rak@zeta:~$ sudo service mpd start
Job for mpd.service failed because a fatal signal was delivered to the control process.
See "systemctl status mpd.service" and "journalctl -xeu mpd.service" for details.
rak@zeta:~$ sudo systemctl status mpd.service
× mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Thu 2021-11-04 13:49:36 EDT; 2s ago
TriggeredBy: × mpd.socket
Docs: man:mpd(1)
man:mpd.conf(5)
file:///usr/share/doc/mpd/html/user.html
Process: 474546 ExecStart=/usr/bin/mpd --no-daemon $MPDCONF (code=killed, signal=ABRT)
Main PID: 474546 (code=killed, signal=ABRT)
CPU: 175ms

Nov 04 13:49:36 zeta mpd[474546]: sndfile: libsndfile-1.0.31
Nov 04 13:49:36 zeta mpd[474546]: hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
Nov 04 13:49:36 zeta mpd[474546]: adplug: adplug 2.3.3
Nov 04 13:49:36 zeta mpd[474546]: exception: Failed to open '/var/lib/mpd/tag_cache': No such file or directory
Nov 04 13:49:36 zeta mpd[474546]: curl: version 7.74.0
Nov 04 13:49:36 zeta mpd[474546]: curl: with GnuTLS/3.7.2
Nov 04 13:49:36 zeta mpd[474546]: mpd: ../src/event/Loop.cxx:60: EventLoop::~EventLoop(): Assertion `sockets.empty()' failed.
Nov 04 13:49:36 zeta systemd[1]: mpd.service: Main process exited, code=killed, status=6/ABRT
Nov 04 13:49:36 zeta systemd[1]: mpd.service: Failed with result 'signal'.
Nov 04 13:49:36 zeta systemd[1]: Failed to start Music Player Daemon.
rak@zeta:~$ ls -lash /var/lib/mpd
total 14K
0 drwxr-xr-x 1 mpd audio 50 2021-11-04 13:46 .
0 drwxr-xr-x 1 root root 1.2K 2021-11-02 21:41 ..
1.5K drwxr-xr-x 8 rak rak 14 2021-11-02 21:53 music
0 drwxr-xr-x 1 mpd audio 162 2020-02-01 13:12 playlists
12K -rw-r--r-- 1 mpd audio 12K 2021-11-04 13:31 sticker.sql
rak@zeta:~$ sudo journalctl -S "2021-11-04 13:49:30" -xu mpd.service
-- Journal begins at Sat 2021-10-30 20:02:14 EDT, ends at Thu 2021-11-04 13:49:46 EDT. --
Nov 04 13:49:35 zeta systemd[1]: Starting Music Player Daemon...
░░ Subject: A start job for unit mpd.service has begun execution
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit mpd.service has begun execution.
░░
░░ The job identifier is 21168.
Nov 04 13:49:36 zeta mpd[474546]: libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
Nov 04 13:49:36 zeta mpd[474546]: vorbis: Xiph.Org libVorbis 1.3.7
Nov 04 13:49:36 zeta mpd[474546]: opus: libopus 1.3.1
Nov 04 13:49:36 zeta mpd[474546]: sndfile: libsndfile-1.0.31
Nov 04 13:49:36 zeta mpd[474546]: hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
Nov 04 13:49:36 zeta mpd[474546]: adplug: adplug 2.3.3
Nov 04 13:49:36 zeta mpd[474546]: exception: Failed to open '/var/lib/mpd/tag_cache': No such file or directory
Nov 04 13:49:36 zeta mpd[474546]: curl: version 7.74.0
Nov 04 13:49:36 zeta mpd[474546]: curl: with GnuTLS/3.7.2
Nov 04 13:49:36 zeta mpd[474546]: mpd: ../src/event/Loop.cxx:60: EventLoop::~EventLoop(): Assertion `sockets.empty()' failed.
Nov 04 13:49:36 zeta systemd[1]: mpd.service: Main process exited, code=killed, status=6/ABRT
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStart= process belonging to unit mpd.service has exited.
░░
░░ The process' exit code is 'killed' and its exit status is 6.
Nov 04 13:49:36 zeta systemd[1]: mpd.service: Failed with result 'signal'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit mpd.service has entered the 'failed' state with result 'signal'.
Nov 04 13:49:36 zeta systemd[1]: Failed to start Music Player Daemon.
░░ Subject: A start job for unit mpd.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit mpd.service has finished with a failure.
░░
░░ The job identifier is 21168 and the job result is failed.
--------------------------------------------------

If I attempt to create an empty file '/var/lib/mpd/tag_cache', I get the
following behaviour:

--------------------------------------------------
rak@zeta:~$ doas -u mpd touch /var/lib/mpd/tag_cache
rak@zeta:~$ doas service mpd start
[sudo] password for rak:
Job for mpd.service failed because a fatal signal was delivered to the control process.
See "systemctl status mpd.service" and "journalctl -xeu mpd.service" for details.
rak@zeta:~$ doas systemctl status mpd.service
× mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Thu 2021-11-04 13:51:52 EDT; 1s ago
TriggeredBy: × mpd.socket
Docs: man:mpd(1)
man:mpd.conf(5)
file:///usr/share/doc/mpd/html/user.html
Process: 474899 ExecStart=/usr/bin/mpd --no-daemon $MPDCONF (code=killed, signal=ABRT)
Main PID: 474899 (code=killed, signal=ABRT)
CPU: 180ms

Nov 04 13:51:52 zeta mpd[474899]: hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
Nov 04 13:51:52 zeta mpd[474899]: adplug: adplug 2.3.3
Nov 04 13:51:52 zeta mpd[474899]: simple_db: reading DB
Nov 04 13:51:52 zeta mpd[474899]: exception: Database corrupted
Nov 04 13:51:52 zeta mpd[474899]: curl: version 7.74.0
Nov 04 13:51:52 zeta mpd[474899]: curl: with GnuTLS/3.7.2
Nov 04 13:51:52 zeta mpd[474899]: mpd: ../src/event/Loop.cxx:60: EventLoop::~EventLoop(): Assertion `sockets.empty()' failed.
Nov 04 13:51:52 zeta systemd[1]: mpd.service: Main process exited, code=killed, status=6/ABRT
Nov 04 13:51:52 zeta systemd[1]: mpd.service: Failed with result 'signal'.
Nov 04 13:51:52 zeta systemd[1]: Failed to start Music Player Daemon.
rak@zeta:~$ ls -lash /var/lib/mpd
total 14K
0 drwxr-xr-x 1 mpd audio 68 2021-11-04 13:51 .
0 drwxr-xr-x 1 root root 1.2K 2021-11-02 21:41 ..
1.5K drwxr-xr-x 8 rak rak 14 2021-11-02 21:53 music
0 drwxr-xr-x 1 mpd audio 162 2020-02-01 13:12 playlists
12K -rw-r--r-- 1 mpd audio 12K 2021-11-04 13:31 sticker.sql
0 -rw-r--r-- 1 mpd audio 0 2021-11-04 13:51 tag_cache
--------------------------------------------------

I've bumped the severity to grave because this bug renders the package
unusable. I'm happy to provide any debugging information you need.

Best,
Ryan

--
|)|/ Ryan Kavanagh | 4E46 9519 ED67 7734 268F
|\|\ https://rak.ac | BD95 8F7B F8FC 4A11 C97A
signature.asc

Florian Schlichting

unread,
Nov 5, 2021, 1:00:03 AM11/5/21
to
Hi Ryan (and Max please see below):

> and have the following minimal mpd.conf:
>
> --------------------------------------------------
> music_directory "/var/lib/mpd/music"
> db_file "/var/lib/mpd/tag_cache"
> pid_file "/run/mpd/pid"
> state_file "/var/lib/mpd/state"
> log_level "verbose"
>
> user "mpd"
> bind_to_address "127.0.0.1"
>
> audio_output {
> type "null"
> name "null"
> }
> --------------------------------------------------

please, for now, delete or comment out the pid_file line
The tag_cache exception is non-fatal. The problem here is the Assertion
failure, which is #998310 and fixed in mpd 0.23.3-2

However, Max: behind this hides another problem, which is why I asked
Ryan to delete the pid_file configuration: as part of 0.23.3 you added
the "RuntimeDirectory=mpd" directive to both mpd.service units. In the
absence of User and Group directives, this causes /run/mpd to change
ownership from mpd:audio (as created by our
/usr/lib/tmpfiles.d/mpd.conf) to root:root, which means that mpd would
have to be run as root in order to be able to create a socket or a
pidfile (yes, legacy) there. I think that's broken from an upstream
perspective as well, and only works when running mpd as user.

I suppose the best way forward is to specify User=mpd and Group=audio
in the system unit, however this immediately hits a snag when mpd tries
to open its log file /var/log/mpd/mpd.log, which up to now is created as
root. This we could probably work around in Debian, and defaulting to
log to syslog/journal also feels sensible, but I'm not sure if there may
be other things that mpd might want to be root for when starting up as a
system service?

Florian

Max Kellermann

unread,
Nov 5, 2021, 1:30:03 AM11/5/21
to
On 2021/11/05 05:55, Florian Schlichting <fs...@debian.org> wrote:
> However, Max: behind this hides another problem, which is why I asked
> Ryan to delete the pid_file configuration: as part of 0.23.3 you added
> the "RuntimeDirectory=mpd" directive to both mpd.service units. In the
> absence of User and Group directives, this causes /run/mpd to change
> ownership from mpd:audio (as created by our
> /usr/lib/tmpfiles.d/mpd.conf) to root:root, which means that mpd would
> have to be run as root in order to be able to create a socket or a
> pidfile (yes, legacy) there. I think that's broken from an upstream
> perspective as well, and only works when running mpd as user.

True, and the real fix would be to finally cease launching MPD as
root, which is an anachronism.

> I suppose the best way forward is to specify User=mpd and Group=audio
> in the system unit, however this immediately hits a snag when mpd tries
> to open its log file /var/log/mpd/mpd.log, which up to now is created as
> root. This we could probably work around in Debian, and defaulting to
> log to syslog/journal also feels sensible, but I'm not sure if there may
> be other things that mpd might want to be root for when starting up as a
> system service?

The right way to have a writable /var/log/mpd is "LogsDirectory=mpd",
but I don't want to do that. Per-daemon log files are an anachronism,
too. Just like starting daemons as root, PID files, per-daemon
daemonization code and so on ... all the good stuff that systemd can
do for us, stuff which in ancient times every daemon had unnecessary
duplicate code for.

Another thing that MPD could fail if we don't launch MPD as root is
binding to "privileged ports" (another anachronism). For example, a
httpd streaming output could be bound to a low port. People who do
that could add a drop-in with
"AmbientCapabilities=CAP_NET_BIND_SERVICE" to give MPD permission for
that.

Max Kellermann

unread,
Nov 5, 2021, 4:10:03 AM11/5/21
to
On 2021/11/05 08:09, Max Kellermann <m...@blarg.de> wrote:
> I gave this a second thought, and I fear that changes like this one
> break even more setups, which should be avoided in a stable branch.
>
> I'll rather revert the "RuntimeDirectory" addition for now in the
> 0.23.x stable branch.

And this is the result of my third thought:

https://github.com/MusicPlayerDaemon/MPD/commit/a4e42172045f62583cbf97a6a94c3d2b9de77a6c

This keeps RuntimeDirectory, but "fixes" the pid_file problem (by
ignoring the useless pid_file setting).

Florian Schlichting

unread,
Nov 7, 2021, 2:10:03 AM11/7/21
to
Hi Max,
ok, and I see that a socket, should it be configured and the mpd.socket
unit not used, is still created as root, so no problem there either. Are
you going to release 0.23.4 soonish, or should we upload a git snapshot
in the meantime?

Regarding changes in a stable branch, from a Debian perspective now is a
good time to implement and test far-reaching changes, while in a year or
so from now the next freeze deadline might already be looming and with
it a certain need to be conservative or get it right the first time...

BTW I notice that on my laptop, without any audio_output explicitly
configured, mpd detects a sndio audio device, but then fails to play to
it ("exception: Failed to open "default detected output" (sndio);
Requested audio params cannot be satisfied"). Why is that, given that
sndiod is not installed? Does libsndio7.0 perhaps mis-detect some
pluseaudio compatibility devices, do we need to configure a default
output (alsa?) in /etc/mpd.conf so that things work out of the box?

Florian

Florian Schlichting

unread,
Nov 11, 2021, 10:50:03 AM11/11/21
to
On Thu, Nov 11, 2021 at 12:49:32AM +0100, Diederik de Haas wrote:
> I'm responding to this bug as commenting out the pid_file line was the solution
> for me too, but my 'symptoms' are (a bit) different.

...

> nov 10 23:30:21 soundserver systemd[1]: Failed to start Music Player Daemon.
>
> I found https://github.com/MusicPlayerDaemon/MPD/issues/1299 which seem to
> indicate that the first exception is expected.
> I did a "mpc rescan" both as user (me) and as root, but got
> "MPD error: Connection refused", which indicates a premission issue. So I
> checked the /run/ directory and saw that there wasn't a 'mpd' subdir.

no, the connection is refused because the port is not open because MPD
isn't running as it failed to start. That's also the reason why there is
no /run/mpd directory, in 0.23.3 this gets removed by systemd when it
gives up on starting MPD.

> I'm _assuming_ that it's the same issue, but as my symptoms are somewhat
> different, I thought I'd mention mine.
> If this is actually a different issue which should be filed separately, let me
> know and I'll do that. If you want me to run (some) tests, I can do that too.

0.23.4. which I'm uploading to unstable just now should properly fix
this issue (even without the need to comment out pid_file).

Florian
0 new messages