Bug 232030

Summary: audio/musicpd 0.20.21 : does not start if database does not exists
Product: Ports & Packages Reporter: korsani
Component: Individual Port(s)Assignee: Thomas Zander <riggs>
Status: Closed FIXED    
Severity: Affects Some People Flags: riggs: maintainer-feedback+
riggs: merge-quarterly+
Priority: ---    
Version: Latest   
Hardware: i386   
OS: Any   
Description Flags
Fix for SIGABRT in IsFileNotFound none

Description korsani 2018-10-07 12:16:53 UTC
I just (re)installed musicpd (see #225381).

I created /var/mpd/.mpd/playlists and /var/mpd/music, owned by 'mpd' user. I took the musicpd.conf.sample, removed oss output and enabled null output, and renamed it to /var/mpd/musicpd.conf
Then :
$ musicpd /var/mpd/musicpd.conf
Oct 06 18:07 : exception: Failed to open /var/mpd/.mpd/database: No such file or directory

And does not start.

Touching /var/mpd/.mpd/database cause :
$ musicpd /var/mpd/musicpd.conf
Oct 06 18:11 : exception: Database corrupted

How to make musicpd create an initial database ?
Comment 1 korsani 2018-10-07 21:35:32 UTC
Musicpd 0.20.16 does not have this bug.
Comment 2 Thomas Zander freebsd_committer 2018-10-08 10:19:05 UTC
(In reply to korsani from comment #0)

I just went through the procedure you described. It worked here. mpd does print the exception 'Failed to open /var/mpd/.mpd/database: No such file or directory' but then creates the database.

Did you forget to chown -R mpd:mpd /var/mpd/ ? From your description it seems like mpd can't create the database file in /var/mpd/.mpd/
Comment 3 korsani 2018-10-08 23:41:23 UTC

I tried several manipulations, and it has worked... once. And I'm now unable to make it work again...

$ ls -al /var/mpd/
total 27K
 512 drwxr-xr-x  4 mpd  mpd     6 oct.   9 01:24 ./
8,5K drwxr-xr-x 29 root wheel  33 oct.   9 01:23 ../
 512 drwxr-xr-x  2 mpd  mpd     5 oct.   9 01:25 .mpd/
 512 drwxr-xr-x  2 mpd  mpd     2 oct.   9 01:24 music/
8,5K -rw-r--r--  1 mpd  mpd   13K oct.   9 01:24 musicpd.conf

$ cat /var/mpd/musicpd.conf | sed -e '/^#/d' -e '/^$/d'
music_directory         "/var/mpd/music"
playlist_directory              "/var/mpd/playlists"
db_file                 "/var/mpd/.mpd/database"
log_file                        "/var/mpd/.mpd/log"
pid_file                        "/var/mpd/.mpd/pid"
state_file                      "/var/mpd/.mpd/state"
sticker_file                    "/var/mpd/.mpd/sticker.sql"
user                            "mpd"
bind_to_address         "/var/mpd/.mpd/socket"
input {
        plugin "curl"
audio_output {
        type            "null"
        name            "My Null Output"

$ musicpd /var/mpd/musicpd.conf -v --no-daemon --stderr
config_file: loading file musicpd.conf
vorbis: Xiph.Org libVorbis 1.3.6
opus: libopus 1.2.1
sndfile: libsndfile-1.0.28
exception: Failed to open /var/mpd/.mpd/database: No such file or directory
curl: version 7.61.1
curl: with LibreSSL/2.7.4
update: spawned thread for update job id 1
state_file: Loading state file /var/mpd/.mpd/state
update: starting
Abort trap

$ pkg info musicpd

Name           : musicpd                                                                                                                                                    
Version        : 0.20.21_1                                                                                                                                                  
Installed on   : Tue Oct  9 00:59:54 2018 CEST                                                                                                                              
Origin         : audio/musicpd                                                                                                                                              
Architecture   : FreeBSD:11:i386                                                                                                                                            
Prefix         : /usr/local                                                                                                                                                 
Categories     : audio ipv6                                                                                                                                                 
Licenses       : GPLv2+                                                                                                                                                     
Maintainer     : riggs@FreeBSD.org                                                                                                                                          
WWW            : https://www.musicpd.org/                                                                                                                                   
Comment        : Remote-controllable music daemon                                                                                                                           
Options        :                                                                                                                                                            
        AAC            : on                                                                                                                                                 
        ADPLUG         : off                                                                                                                                                
        AO             : off                                                                                                                                                
        ARCHIVE        : off                                                                                                                                                
        AVAHI          : off                                                                                                                                                
        CDPARANOIA     : off                                                                                                                                                
        CURL           : on                                                                                                                                                 
        DOCS           : off                                                                                                                                                
        FFMPEG         : on                                                                                                                                                 
        FLAC           : on                                                                                                                                                 
        FLUIDSYNTH     : off                                                                                                                                                
        GME            : off                                                                                                                                                
        HTTPD          : on                                                                                                                                                 
        ID3TAG         : on                                                                                                                                                 
        IPV6           : off                                                                                                                                                
        JACK           : off                                                                                                                                                
        LAME           : off                                                                                                                                                
        MAD            : off                                                                                                                                                
        MDNSRESPONDER  : off                                                                                                                                                
        MIKMOD         : off                                                                                                                                                
        MMS            : off
        MODPLUG        : off
        MPG123         : off
        MUSEPACK       : off
        OPENAL         : off
        OPUS           : on
        OSS            : off
        PIPE           : off
        PULSEAUDIO     : off
        SAMPLERATE     : off
        SHOUTCAST      : off
        SIDPLAY2       : off
        SMB            : off
        SNDFILE        : on
        SNDIO          : off
        SOXR           : off
        SQLITE3        : off
        TREMOR         : off
        TWOLAME        : on
        VORBIS         : on
        VORBISENC      : on
        WAV            : off
        WAVPACK        : off
        WILDMIDI       : off
        YAJL           : off
Shared Libs required:
Annotations    :
        FreeBSD_version: 1102000
Flat size      : 680KiB
Description    :
Music Player Daemon (MPD) allows remote access for playing music (MP3, MP4,
Ogg, Flac, and more) and managing playlists.  The design focus is on
integrating a computer into a stereo system that provides control for music
playback over a local network.

WWW: https://www.musicpd.org/

What else should I try ?
Comment 4 Thomas Zander freebsd_committer 2018-10-14 13:16:38 UTC
Try running it on amd64 :-)

Seriously, I just noticed from your last pkg info output that ARCH seems to be the main difference between your environment and mine.
I can reproduce the abort trap in an i386 jail but not in an amd64 jail.

Do you happen to know the last version that did not exhibit this problem on i386? Should help a bit when bisecting to find the issue ...
Comment 5 korsani 2018-10-15 12:17:42 UTC

Surprisingly, 0.20.20 works, as well as 0.20.19.
I ran this command line :
$ cd /var/mpd
$ rm -f .mpd/database ; musicpd musicpd.conf --stderr --no-daemon

0.20.21 abort trap

All other just seek for files and build database...
Comment 6 Thomas Zander freebsd_committer 2018-10-15 16:40:44 UTC
Created attachment 198184 [details]
Fix for SIGABRT in IsFileNotFound

cd ${PORTSDIR}/audio/musicpd && svn patch /path/to/mpd.diff.txt
Comment 7 Thomas Zander freebsd_committer 2018-10-15 16:41:34 UTC
(In reply to korsani from comment #5)

Could you test whether attachment 198184 [details] solves the problem on your machine?
Comment 8 korsani 2018-10-16 11:17:44 UTC
It seems to solve it \o/
Comment 9 commit-hook freebsd_committer 2018-10-16 18:48:36 UTC
A commit references this bug:

Author: riggs
Date: Tue Oct 16 18:48:00 UTC 2018
New revision: 482238
URL: https://svnweb.freebsd.org/changeset/ports/482238

  Fix SIGABRT in IsFileNotFound (e.g. when creating an empty database)

  While on it:
  - Add USES=gnome due to complaint in check-sanity

  PR:		232030
  Reported by:	korsani@free.fr
  MFH:		2018Q4

Comment 10 commit-hook freebsd_committer 2018-10-16 19:00:47 UTC
A commit references this bug:

Author: riggs
Date: Tue Oct 16 19:00:23 UTC 2018
New revision: 482239
URL: https://svnweb.freebsd.org/changeset/ports/482239

  MFH: r482042 r482238

  Enable VORBISENC by default for httpd streaming with the default package

  - Pet portlint

  Reported by:	bapt

  Fix SIGABRT in IsFileNotFound (e.g. when creating an empty database)

  While on it:
  - Add USES=gnome due to complaint in check-sanity

  PR:		232030
  Reported by:	korsani@free.fr

  Approved by:	ports-secteam (riggs)

_U  branches/2018Q4/
Comment 11 Thomas Zander freebsd_committer 2018-10-16 19:10:38 UTC
Committed, thanks for your help!