Unable to Run Mopidy as a service on Raspberry Pi (Solved)

I recently installed Pi MusicBox on my Raspberry Pi (using the image) and after figuring out all the problems that I had with it at first I’ve run into one that I haven’t been able to find an answer for.

When I start it, it will run for a couple seconds and then shutdown.

There aren’t any errors reported in the local scan (included below) and I can’t seem to figure out why it doesn’t run.

Any help would be appreciated.

Thanks!

Local Scan
> root@MusicBox:~# service mopidy run local scan INFO Starting Mopidy 0.19.5
> INFO Loading config from: builtin defaults, /etc/mopidy/extensions.d/spotify.conf, /etc/mopidy/mopidy.conf, command line options
> INFO Enabled extensions: mopify, spotify, mpd, alsamixer, http, stream, spotify_tunigo, mobile, podcast-gpodder, local-sqlite, youtube, podcast-itunes, http-kuechenradio, softwaremixer, local-whoosh, simple-webclient, moped, musicbox_webclient, websettings, podcast, local
> INFO Disabled extensions: gmusic, scrobbler, subsonic, somafm, internetarchive, audioaddict, dirble, tunein, soundcloud
> INFO Found 0 files in media_dir.
> INFO Checking 0 tracks from library.
> INFO Removing 0 missing tracks.
> INFO Found 0 tracks which need to be updated.
> INFO Scanning…
> INFO Scanned 0 of 0 files in 0s.
> INFO Done scanning.

/etc/mopidy/mopidy.conf
> GNU nano 2.2.6 File: /etc/mopidy/mopidy.conf

> #################################
> # Pi MusicBox / Mopidy Settings #
> #################################
> #
> # Edit the settings of your MusicBox and the Mopidy music server here
> # This is a file read by both the MusicBox startup-scripts and Mopidy.
> # For more info on the settings of Mopidy: http://docs.mopidy.com/en/latest/confi$
> # or the particular extenion's GitHub page
> #
> # Every line starting with a # is a comment, it does not do anything until you re$

> # --------------------
> # | Network Settings |
> # --------------------
> [network]
> # Settings for your WiFi network, if you use a (supported) wifi-dongle
> # Only supports WPA security, no WEP or access points without security (dive into$
> wifi_network = WiFi
> wifi_password = 1234

> # Set the name of the MusicBox.
> # In this way you can identify and access different devices on the same network e$
> # A MusicBox device named kitchen would be accessible from a web browser at http:$
> # client at kitchen.local and advertised as kitchen on AirTunes.
> # The name is restricted to a maximum of 9 alphanumeric characters (no spaces, do$
> # You can even have different devices with different Spotify accounts when needed.
> name = MusicBox

> # Mount Windows Network Drive on boot (via samba/cifs)
> # The address is exactly how Samba mount works: //servername/mountpoint/directory
> # e.g. //192.168.1.5/musicmount or //server.local/shared/music
> # if the mount needs a username/password, also set it (leave empty for guest-acce$
> # Don't forget to let Mopidy/MusicBox scan the contents at first boot (see below)
> mount_address =
> mount_user =
> mount_password =
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf


> # Here you can change the default workgroup of the Windows network.
> # This will set the workgroup to the name you want
> workgroup = WORKGROUP

> # Enable this to allow remote login via SSH on MusicBox
> enable_ssh = true

> # By default, MusicBox waits for the network to come up, since there is not much $
> # If you want to skip this, e.g. for testing purposes, uncomment this line
> wait_for_network = true

> # -----------
> # | Spotify |
> # -----------
> # https://github.com/mopidy/mopidy-spotify
> [spotify]
> # Supply your PREMIUM account credentials to enable Spotify
> enabled = true
> username = Spotify
> password = 1234
> # The bitrate, the quality of the music played by Spotify, can be set to 96, 160 $
> bitrate = 320
> cache_dir = ""

> # -----------
> # | Last.fm |
> # -----------
> # https://github.com/mopidy/mopidy-scrobbler
> # Supply your credentials to scrobble tracks to Last.fm
> [scrobbler]
> enabled = false
> username =
> password =

> # --------------
> # | SoundCloud |
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf

> # | SoundCloud |
> # --------------
> # https://github.com/mopidy/mopidy-soundcloud
> # Supply your auth_token obtained from http://www.mopidy.com/authenticate
> [soundcloud]
> enabled = false
> auth_token =

> # ----------------
> # | Google Music |
> # ----------------
> # https://github.com/hechtus/mopidy-gmusic
> # Supply your credentials to enable Google Music
> # NOTE: If enabled this may slow down the start of MusicBox. Please be patient
> [gmusic]
> enabled = false
> all_access = true
> username  =
> password =
> deviceid =

> # -----------
> # | YouTube |
> # -----------
> # https://github.com/dz0ny/mopidy-youtube
> # Play music from Youtube
> [youtube]
> enabled = true

> # ----------
> # | Dirble |
> # ----------
> # https://github.com/mopidy/mopidy-dirble
> # Play radio stations from Dirble
> [dirble]
> enabled = false
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf

> api_key = 473279e3fa0e7010cbbbb40ecc31890d46e57a2e
> countries = US, NL, DE, NO, SE

> # ------------
> # | Subsonic |
> # ------------
> # https://github.com/rattboi/mopidy-subsonic
> # Stream music from your Subsonic Music Streamer
> [subsonic]
> enabled = false
> hostname =
> port =
> username =
> password =
> ssl =

> # ----------------
> # | TuneIn Radio |
> # ----------------
> # https://github.com/kingosticks/mopidy-tunein
> # Play radio stations from TuneIn
> [tunein]
> enabled = false

> # ------------------------
> # | The Internet Archive |
> # ------------------------
> # http://mopidy-internetarchive.readthedocs.org/en/latest/config.html
> # Listen to sounds and music from the Internet Archive
> [internetarchive]
> enabled = false

> # -----------
> # | Soma FM |
> # -----------
> # https://github.com/AlexandrePTJ/mopidy-somafm
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf

> # Play radio stations from Soma FM
> [somafm]
> enabled = false
> encoding = mp3
> quality = fast

> # -----------
> # | Podcast |
> # -----------
> # https://github.com/tkem/mopidy-podcast
> # Play podcasts from different sources
> [podcast]
> # Note: You cannot add settings for [podcast-itunes] or [podcast-gpodder]
> # because it breaks the startup script (won't read dashes in section names
> enabled = true
> feeds =

> # ---------------
> # | AudioAddict |
> # ---------------
> # https://github.com/nilicule/mopidy-audioaddict
> # Play music from all the AudioAddict network of sites (login optional)
> [audioaddict]
> enabled = false


> # ---------------------
> # | MusicBox Settings |
> # ---------------------
> [musicbox]
> # To secure your device, change the default password to something else.
> # For security, the value in this file will be automatically cleaned out when the$
> root_password =

> # Automatically resize the filesystem and use all available space on your SD card$
> # Use at your own risk, you could lose data on your card.
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf

> # (If so, you can put the original MusicBox image on it again and start over)
> resize_once = false

> # Scan on startup for new music files on the SD card or the network shares (could$
> # Local files work ok for moderate size collections. Large music database sizes c$
> # IMPORTANT: if you enable scan_always this will scan on every boot.
> # If your music doesn't change or you only stream music set scan_once instead.
> scan_once = false
> #scan_always = true

> # MusicBox can automatically start playing a stream/song after startup.
> # It will wait a number of seconds before trying to do so for the system to first$
> # The wait required varies per device, network and configuration so if it doesn't$
> # e.g. autoplay = http://nprdmp.ic.llnwd.net/stream/nprdmp_live01_mp3 or local:tr$
> autoplay =
> autoplaywait = 60

> # -------------
> # | Streaming |
> # -------------
> # Set these options to enable streaming to Pi MusicBox
> # AirTunes (using Shairport-sync):
> enable_shairport = false

> # DLNA/uPnP/OpenHome (using upmpdcli):
> enable_upnp = false

> # ------------------
> # | Audio Settings |
> # ------------------
> # Because of limitations with some USB-DACs, MusicBox downsamples USB sound to 44$
> downsample_usb = false

> # Set default audio output. This overrides the automatic detection (which sets to$
> # is found, else to hdmi (if hdmi is connected at boot), and otherwise just to th$
> # i2s cards (e.g. HifiBerry etc) are not detected automatically and must be expli$
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf

> # Options: analog, hdmi, usb, hifiberry_dac, hifiberry_digi, hifiberry_dacplus, h$
> output = usb

> [audio]
> # Set the startup volume of MusicBox
> # Values: from 0 to 100
> mixer_volume = 100

> # --------------------------------------------------------------------------
> # | OTHER Settings                                                         |
> # | You probably don't want to edit the settings below this line. Really.  |
> # | Unless you know what you're doing, or you want to change the webclient |
> # --------------------------------------------------------------------------
> # This sets the gstreamer buffer. It's a bit tricky...
> # If you have problems with stuttering sound, try other values here, like:
> # or
> #output = alsasink buffer-time=300000 latency-time=20000
> #output = alsasink buffer-time=200000 latency-time=10000
> output = alsasink

> mixer = none

> # Optionally, you can use alsamixer. This enables you to use hardware mixers of u$
> # Set the previous setting to:
> #mixer = alsamixer
> # And set the card and contol below. E.g.
> #card = 1
> #control = Master
> # Run the command 'amixer scontrols' from the commandline to list available contr$
> # See https://github.com/mopidy/mopidy-alsamixer
> [alsamixer]
> card = 1
> control = Master

> [stream]
> enabled = true
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf


> [http]
> enabled = true
> hostname = ::
> port = 6680
> #Disable zeroconf
> zeroconf = Mopidy HTTP server on $hostname

> # -------------
> # | Webclient |
> # -------------
> # Here you can change the default webclient
> # options: /opt/webclient /opt/moped
> static_dir = /opt/webclient

> [musicbox_webclient]
> enabled = true

> [websettings]
> enabled = true
> musicbox = true
> config_file = /boot/config/settings.ini

> [mpd]
> hostname = 0.0.0.0

> [logging]
> config_file = /etc/mopidy/logging.conf
> debug_file = /var/log/mopidy/mopidy-debug.log

> [local]
> enabled = true
> media_dir = /music
> playlists_dir = /var/lib/mopidy/playlists
> data_dir = /var/lib/mopidy/localdata
> #This sets the method of indexing local files
>   GNU nano 2.2.6          File: /etc/mopidy/mopidy.conf

> #You can set it to json or whoosh. Whoosh might be better with large collections,$
> # TODO: You cannot add settings for [local-sqlite]
> # because it breaks the startup script (won't read dashes in section names
> library = sqlite

> scan_timeout = 1000
> scan_flush_threshold = 1000
> excluded_file_extensions = .html, .jpeg, .jpg, .log, .nfo, .png, .txt, .mkv, .avi$

Look in the logs. So, do:
cat /var/log/mopidy/mopidy.log
and look for error messages

1 Like

Perfect, thank you.

Apparently I was using the wrong command to try and read the log.

Just a little error in the mixer line.