Mopidy will not run in background

Hello, I’ve been a long time MPD user, but since I started using Spotify more, I wanted to try Mopidy. I’m having a few issues with the installation though. The main one is it is not working in the background.

First I’ve removed MPD and then installed mopidy so there wouldn’t be any conflicts. I also activated the init script using sudo dpkg-reconfigure mopidy. But after rebooting, my mpd clients (mpad and mpod) don’t seem to find it. top doesn’t seem to find it either. When I deactivate the init script, reboot, and try just using the mopidy command, The mpd clients will work, but if i close the terminal window I started mopidy in, it stops working again. I’ve also tried mopidy & in the rc.local script, but that doesn’t work for me either.

Any help would be appreciated!!

Did you check /etc/mopidy and /etc/default/mopidy? It uses a different config file if it’s a background service, maybe that’s the problem

As @woutervanwijk says, when running Mopidy as a service it will use a different config file. There is plenty of information on this at http://docs.mopidy.com/en/latest/debian/#differences-when-running-as-a-system-service

You can view the config for the service by running sudo service mopidy run config.

Thank you for that! Editing /etc/mopidy/mopidy.conf with the bare minimum configuration allowed mopidy to now pop up in both my mpd clients and top. The /etc/default/mopidy folder doesn’t exist though.

So to confirm, when mopidy runs as a background service, ~/.config/mopidy/mopidy.conf is completely ignored? This leads to two other questions. How do I check the actual configuration that the background service of mopidy is using? When I run mopidy config, it shows the configuration of ~/.config/mopidy/mopidy.conf instead of /etc/mopidy/mopidy.conf. And finally, how did everyone else figure this out? I couldn’t find this in the documentation.

Thank you!

@kingosticks Ooh, there it is. How embarassing! You answered all of my questions before I even published my follow up questions. Thank you!

As an aside, I tried searching for /etc/mopidy/mopidy.conf in the doc search engine before I saw your post, but the page you linked didn’t show up. I thought that was strange.

Weird, it doesn’t appear, maybe it hates slashes.
But something like site:docs.mopidy.com /etc/mopidy/mopidy.conf in google (or whatever) is always worth a try.

I think it does hate slashes.

Another question sort of related to the original topic of the background service.

When I ran mopidy in the foreground (?), my spotify playlists would populate in my mpd clients saved playlist section, but now after I have it running in the background, the playlists don’t show. I’m not sure what could be causing this. I originally thought it was a permissions issue, (like i was having with my local files), but the folder is owned by “mopidy” user.

Spotify playlists won’t have any sort of permission issue like that, the playlists should populate the section in your client. Does the config contain your spotify credentials? Are you able to search and play spotify songs otherwise?

On the client I use (gmpc) I have to wait for Mopidy to load the playlists before connecting else they don’t show up. It just requires you to disconnect and reconnect in the client, could it be that?

Yes, the credentials have been entered. I’m able to search for and play spotify music ok. It’s just not populating the spotify playlists.

Ok, I lied about it working when running mopidy in the foreground. It doesn’t work that way either now. What I do notice that is different from yesterday, is previously it used to say something like “Loaded 12 playlists from Spotify” after the “connected to spotify” line. It does not say that anymore.

Out of the blue, it started working. So strange.

It has to load the playlist metadata from Spotif. Initially this will take a bit of time but then it’s cached in the cache_dir and subsequently much quicker. Perhaps this was the case here.

On another thread, in a google group, a person tried deleting all of his playlists and started all over which seemed to work for him. I tried this also, deleted the cache, then created a playlist with one song. Waited a while, and nothing. I gave up for a bit, added some more playlists. While I was playing around with Moped web client, the playlists popped up. Then they disappeared! Then they came back. Playlists I added, would take a while before they would update in mopidy. This morning though, they seem to update instantly.