You are not logged in.

#1 2019-09-07 16:20:08

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

[SOLVED] no MPD database after system reboot

I am using cantata as an MPD client. MPD is enabled to start automatically on boot (systemd).  I followed the wiki to install MPD. the problem is that when I reboot the system I get an error saying there is no database.

at the beginning I was able to fix this by deleting the db file, killing mpd process, and starting it again. But now, even doing that doesn't fix the problem (I do see as output that a db file is being created by running mpd --stderr --stdout), and I can confirm that a db file is indeed created.

What I tried so far:

  • Changing ~ by absolute home path in config file

  • manually create db file (touch) and giving it chmod 777 (for sake of testing)

  • restarting MPD service after killing all processes

Here is my config file located at ~/.config/mpd (db file was earlier on .config/mpd and I moves it to ~/ (I have the same problem in both locations).

# Recommended location for database
db_file            "/home/hmogni/mpd_database"

# Logs to systemd journal
log_file           "syslog"

# The music directory is by default the XDG directory, uncomment to amend and choose a different directory
music_directory    "/home/hmogni/Music"

# Uncomment to refresh the database whenever files in the music_directory are changed
auto_update "yes"

# Uncomment to enable the functionalities
#playlist_directory "~/.config/mpd/playlists"
pid_file           "/home/hmogni/mpd_pid"
#state_file         "~/.config/mpd/state"
#sticker_file       "~/.config/mpd/sticker.sql"
#
audio_output {
        type            "pulse"
        name            "pulse audio"
}

audio_output {
        type  "httpd"
        name  "My HTTP Stream"
        encoder  "vorbis"  # optional, vorbis or lame
        port  "8000"
        quality  "5.0"   # do not define if bitrate is defined
        # bitrate  "128"   # do not define if quality is defined
        format  "44100:16:1"
        max_clients "0"   # optional 0=no limit
}

Thanks.

Last edited by hmogni (2019-09-08 12:16:54)

Offline

#2 2019-09-07 17:55:01

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,687

Re: [SOLVED] no MPD database after system reboot

Are you using systemd --user or is this a system-wide configuration? Have you checked your mpd logs?

Offline

#3 2019-09-07 18:44:41

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

Thanks for your reply.

This is a user configuration (not system-wide), this is what I get when I run

systemctl status mpd

(after starting it, generating db file and opening cantata)

mpd.service - Music Player Daemon
   Loaded: loaded (/usr/lib/systemd/system/mpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2019-09-07 19:41:24 +01; 34s ago
     Docs: man:mpd(1)
           man:mpd.conf(5)
 Main PID: 27247 (mpd)
    Tasks: 3 (limit: 4671)
   Memory: 7.7M
   CGroup: /system.slice/mpd.service
           └─27247 /usr/bin/mpd --no-daemon

Sep 07 19:41:50 hmogni-arch mpd[27247]: client: [0] opened from [::1]:60634
Sep 07 19:41:50 hmogni-arch mpd[27247]: client: [1] opened from [::1]:60636
Sep 07 19:41:50 hmogni-arch mpd[27247]: exception: Unsupported URI scheme
Sep 07 19:41:51 hmogni-arch mpd[27247]: exception: No database
Sep 07 19:41:51 hmogni-arch mpd[27247]: exception: No database
Sep 07 19:41:51 hmogni-arch mpd[27247]: exception: No database
Sep 07 19:41:51 hmogni-arch mpd[27247]: exception: Failed to open '/var/lib/mpd/playlists/[Radio Streams].m3u': No such file or directory
Sep 07 19:41:51 hmogni-arch mpd[27247]: exception: No such playlist
Sep 07 19:41:58 hmogni-arch mpd[27247]: client: [1] closed
Sep 07 19:41:58 hmogni-arch mpd[27247]: client: [0] closed

Offline

#4 2019-09-07 19:03:00

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,397

Re: [SOLVED] no MPD database after system reboot

This is a user configuration (not system-wide), this is what I get when I run

systemctl status mpd

*cough*
https://wiki.archlinux.org/index.php/Systemd/User
*cough*

Offline

#5 2019-09-07 19:54:33

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

seth wrote:

This is a user configuration (not system-wide), this is what I get when I run

systemctl status mpd

*cough*
https://wiki.archlinux.org/index.php/Systemd/User
*cough*

sorry for my stupid mistake... I now copied the system-wide mpd.service to .config/systemd/user and run

systemctl --user start mpd

now the db never gets generated (though the file is created by mpd) and I get the following logs (mpd --stderr --stdout)

exception: Default TCP listener setup failed, but this is okay because we have a $XDG_RUNTIME_DIR listener: Failed to bind to '[::]:6600'
exception: Failed to bind socket: Address already in use
exception: Decoder plugin 'wildmidi' is unavailable: configuration file does not exist: /etc/timidity/timidity.cfg
exception: Input plugin 'tidal' is unavailable: No Tidal application token configured
exception: Input plugin 'qobuz' is unavailable: No Qobuz app_id configured
exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted

PS: I kill all mpd processes before restarting it

Last edited by hmogni (2019-09-07 19:55:45)

Offline

#6 2019-09-07 20:06:50

loqs
Member
Registered: 2014-03-06
Posts: 19,100

Re: [SOLVED] no MPD database after system reboot

hmogni wrote:

I now copied the system-wide mpd.service to .config/systemd/user

Why?

Offline

#7 2019-09-07 20:10:44

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

because when I got this error:

Failed to connect to bus: No such file or directory

I could start mpd with --user flag only after copying its unit file to that location.

Offline

#8 2019-09-07 20:15:18

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,397

Re: [SOLVED] no MPD database after system reboot

This rather means t here was no session bus what means your session start (xinit?) was/is broken.
What do you mean by "never gets generated"? The ouput you posted doesn't suggest anything like that.

Offline

#9 2019-09-07 20:29:28

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

I killed it and restarted everything again. I confirm the db file is generated. I thought it is not generated because when i used to run `mpd --stderr --stdout` I got output like 'Adding file ****' for every music file. now I get no output (which is strange).

when I run cantata now I still get the no database error even when I click on refresh database. I should probably say it again that mpd used to run properly after a lot of "killing and restarting".

the whole behavior of MPD seems to be weird!

as for the xinit problem, I will surely investigate it and try to solve (but I don't think that problem would affect MPD service since it is running now after copying mpd.service ??)

Offline

#10 2019-09-07 20:33:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,397

Re: [SOLVED] no MPD database after system reboot

No, you'll address the xinit issue first: https://wiki.archlinux.org/index.php/Xinit#xinitrc
Pay attention to the notes. Also this is only relevant if you use xinit or startx (and maybe xdm) - DMs like SDDM, GDM etcetc. should™ do it right regardless.

It's because PA will suffer from an improper session as well, not sure about cantata - we'll see.

Offline

#11 2019-09-07 20:36:15

loqs
Member
Registered: 2014-03-06
Posts: 19,100

Re: [SOLVED] no MPD database after system reboot

You copied the system service file that specifies the user mpd and use that as a user service.  Are you logged in as root?
As that is the only user that systemd would allow to run a user service as another user.
Edit:
Do you login as root then sudo or su xinit?

Last edited by loqs (2019-09-07 20:42:11)

Offline

#12 2019-09-07 20:56:17

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,687

Re: [SOLVED] no MPD database after system reboot

There was no need to copy the mpd.service file to your home directory. That is already built in systemd by mpd. You can just start the service. Are you starting sytemctl --user as sudo? Root will have a different bus from user I would think.

Offline

#13 2019-09-07 22:04:15

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

seth wrote:

No, you'll address the xinit issue first: https://wiki.archlinux.org/index.php/Xinit#xinitrc
Pay attention to the notes. Also this is only relevant if you use xinit or startx (and maybe xdm) - DMs like SDDM, GDM etcetc. should™ do it right regardless.

It's because PA will suffer from an improper session as well, not sure about cantata - we'll see.

Ok I will be working on that issue right now. I am using i3wm + Xorg + lightdm

Last edited by hmogni (2019-09-07 22:07:48)

Offline

#14 2019-09-07 22:07:03

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

d_fajardo wrote:

There was no need to copy the mpd.service file to your home directory. That is already built in systemd by mpd. You can just start the service. Are you starting sytemctl --user as sudo? Root will have a different bus from user I would think.

loqs wrote:

You copied the system service file that specifies the user mpd and use that as a user service.  Are you logged in as root?
As that is the only user that systemd would allow to run a user service as another user.
Edit:
Do you login as root then sudo or su xinit?

no I run `systemctl --user start mpd` without sudo or root privileges, and it did not work until I copied the unit file. I am now investigating the problem with Xinit.

Last edited by hmogni (2019-09-07 22:08:04)

Offline

#15 2019-09-07 22:13:08

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] no MPD database after system reboot

┌─[Shiv ~]
└─╼ pacman -Fl mpd | grep service                                                                                                                             
mpd usr/lib/systemd/system/mpd.service
mpd usr/lib/systemd/user/mpd.service

Those two files are not the same.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#16 2019-09-07 22:46:12

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

seth wrote:

No, you'll address the xinit issue first: https://wiki.archlinux.org/index.php/Xinit#xinitrc
Pay attention to the notes. Also this is only relevant if you use xinit or startx (and maybe xdm) - DMs like SDDM, GDM etcetc. should™ do it right regardless.

It's because PA will suffer from an improper session as well, not sure about cantata - we'll see.

Probelms with xinit seems to be solved (I am using lightdm, I understoof from the wiki that lightdm uses /etc/lightdm/Xsession instead of xinitrc. Please correct me if I am misunderstanding). I restarted lightdm.service and the problem seems to be gone.

I am now able to run systemctl --user with no trouble (I deleted the ~/.config/system/mpd.service). However, I am still experiencing the same no database error in cantata (db file is generated by mpd)

here is again the status of mpd.

  hmogni@hmogni-arch $ systemctl --user  status mpd
● mpd.service - Music Player Daemon
   Loaded: loaded (/usr/lib/systemd/user/mpd.service; disabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-09-07 23:40:55 +01; 4min 30s ago
     Docs: man:mpd(1)
           man:mpd.conf(5)
 Main PID: 5716 (mpd)
   CGroup: /user.slice/user-1000.slice/user@1000.service/mpd.service
           └─5716 /usr/bin/mpd --no-daemon

Sep 07 23:40:55 hmogni-arch systemd[1201]: Starting Music Player Daemon...
Sep 07 23:40:55 hmogni-arch mpd[5716]: exception: Default TCP listener setup failed, but this is okay because we have a $XDG_RUNTIME_DIR listener: Failed to bind to '[::>
Sep 07 23:40:55 hmogni-arch mpd[5716]: exception: Failed to bind socket: Address already in use
Sep 07 23:40:55 hmogni-arch mpd[5716]: exception: Decoder plugin 'wildmidi' is unavailable: configuration file does not exist: /etc/timidity/timidity.cfg
Sep 07 23:40:55 hmogni-arch mpd[5716]: exception: Input plugin 'tidal' is unavailable: No Tidal application token configured
Sep 07 23:40:55 hmogni-arch mpd[5716]: exception: Input plugin 'qobuz' is unavailable: No Qobuz app_id configured
Sep 07 23:40:55 hmogni-arch libsmbclient[5716]: exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not perm>
Sep 07 23:40:55 hmogni-arch systemd[1201]: Started Music Player Daemon.

Last edited by hmogni (2019-09-07 23:01:21)

Offline

#17 2019-09-08 05:52:46

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,397

Re: [SOLVED] no MPD database after system reboot

lightdm should™ not result in a bad session - at least it's not your responsibility.

loginctl session-status

About the "no database error in cantata", please provide the exact error message and also let's see

mpc stats

https://www.archlinux.org/packages/extra/x86_64/mpc/

Offline

#18 2019-09-08 12:14:58

hmogni
Member
From: .ma
Registered: 2019-08-28
Posts: 15

Re: [SOLVED] no MPD database after system reboot

MPD seems to be working good now (Weirdly enough, the solution worked after a system reboot.... maybe there was a conflict).

here is the output of mpc stats

Artists:     59
Albums:     149
Songs:     1956

Play Time:    0 days, 0:00:19
Uptime:       0 days, 0:15:01
DB Updated:   Sun Sep  8 12:58:39 2019
DB Play Time: 5 days, 21:31:33

Anyway, I will mark this thread as Solved. The solution was to run

 systemctl --user start mpd

instead of

sudo systemctl start mpd

Thank you all for your help.

Offline

Board footer

Powered by FluxBB