Difficulty connecting to Mopidy Web Interface

Hello!

I’ve been following a bunch of tutorials on using Mopidy and I’ve had extensive difficulties connecting to the web interface using my Raspberry Pi’s IP address. When I type “mopidy” into the command line I keep getting this response.

INFO Starting Mopidy 2.1.0
INFO Loading config from builtin defaults
INFO Loading config from /home/pi/.config/mopidy/mopidy.conf
INFO Loading config from command line options
INFO Enabled extensions: iris, mpd, alsamixer, http, ttsgpio, stream, m3u, musicbox_webclient, softwaremixer, file, local-images, local, local-sqlite
INFO Disabled extensions: spotify
WARNING Found spotify configuration errors, the extension has been automatically disabled:
WARNING spotify/username must be set.
WARNING spotify/client_secret must be set.
WARNING spotify/password must be set.
WARNING spotify/client_id must be set.
WARNING Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO Starting Mopidy mixer: SoftwareMixer
INFO Starting Mopidy audio
INFO Starting Mopidy backends: StreamBackend, M3UBackend, FileBackend, LocalBackend
INFO Audio output set to “autoaudiosink”
INFO Loaded 0 local tracks using json
INFO Starting Mopidy core
INFO Starting Mopidy frontends: TtsGpio, IrisFrontend, MpdFrontend, HttpFrontend
INFO Starting Iris 3.37.1
ERROR Frontend (MpdFrontend) initialization error: MPD server startup failed: [Errno 98] Address already in use
ERROR Frontend (HttpFrontend) initialization error: HTTP server startup failed: [Errno 98] Address already in use
INFO Starting GLib mainloop

I would grately appreciate any contributions that might steer me in the right direction.

Have you read the Mopidy documentation, specifically https://docs.mopidy.com/en/latest/service/#service ?

Do you already have an instance of the Mopidy service running? You can see by running sudo systemctl status mopidy. If you find you do, then it’s probably that service that is already using the address. You probably don’t want to be running Mopidy as your user, running it as service is likely what you want.

I have read it. I’m not very adept at Raspberry Pi & am having difficulty identifying if the Mopidy is running as a service or system. This is the output for the command.

● mopidy.service - Mopidy music server
Loaded: loaded (/lib/systemd/system/mopidy.service; enabled; vendor preset: e
Active: active (running) since Thu 2019-05-30 02:06:05 AEST; 5h 46min ago
Process: 361 ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy (code=exit
Process: 352 ExecStartPre=/bin/mkdir -p /var/cache/mopidy (code=exited, status
Main PID: 370 (mopidy)
CGroup: /system.slice/mopidy.service
└─370 /usr/bin/python /usr/bin/mopidy --config /usr/share/mopidy/conf

May 30 02:06:13 raspberrypi mopidy[370]: INFO Starting Mopidy audio
May 30 02:06:13 raspberrypi mopidy[370]: INFO Starting Mopidy backends: Stre
May 30 02:06:13 raspberrypi mopidy[370]: INFO Starting Mopidy core
May 30 02:06:13 raspberrypi mopidy[370]: INFO Audio output set to "autoaudio
May 30 02:06:13 raspberrypi mopidy[370]: INFO Starting Mopidy frontends: Tts
May 30 02:06:13 raspberrypi mopidy[370]: ERROR TTSGPIO: Not enough permission
May 30 02:06:13 raspberrypi mopidy[370]: INFO Starting Iris 3.37.1
May 30 02:06:13 raspberrypi mopidy[370]: INFO MPD server running at [::ffff:
May 30 02:06:13 raspberrypi mopidy[370]: INFO HTTP server running at [::ffff
May 30 02:06:13 raspberrypi mopidy[370]: INFO Starting GLib mainloop

That shows Mopidy is running as a system service.

If you don’t want to run it as a service for some particular reason, you need to stop the service (and also disable the service if you want to prevent it starting automatically next time you reboot). Then you will be able to run Mopidy as your user, like you tried to do in your original post.

It would probably help if you explain what you are trying to do and what isn’t working with Mopidy already as a system service, as you currently have.

Yep! So I’m a student and I’m using the Raspberry Pi for an assignment. I’ve just been following some tutorials on how to set up Mopidy. They usually start with downloading Mopidy, configuring some settings, adding Spotify login details and then accesing the Raspberry Pi’s IPaddress:6680 on through the web. And all of the tutorials I’ve followed these tutorials successfully to this point and I cannot connect to the IP address successfully.

One of the tutorials said to type “Mopidy” and then connect to the IP address but it was outputting error messages and I didn’t know how to fix it.

Ultimately, I’m just trying to perform a basic “setup” tutorial for Mopidy on my raspberry pi. A lot of things like running as user and service are above my understanding. But I’m happy to try anything that will help.

I’ve used “sudo service mopidy stop” to counter “sudo service mopidy start” which I had previously used. I am no longer getting the error message when I type “mopidy”. I’m getting this message instead:

INFO Starting Mopidy mixer: SoftwareMixer
INFO Starting Mopidy audio
INFO Starting Mopidy backends: StreamBackend, M3UBackend, FileBackend, LocalBackend
INFO Audio output set to “autoaudiosink”
INFO Loaded 3 local tracks using json
INFO Starting Mopidy core
INFO Starting Mopidy frontends: TtsGpio, IrisFrontend, MpdFrontend, HttpFrontend
INFO Starting Iris 3.37.1
INFO MPD server running at [::ffff:127.0.0.1]:6600
INFO Starting GLib mainloop
INFO HTTP server running at [::ffff:127.0.0.1]:6680
INFO Creating dir /home/pi/.local/share/mopidy/local-images

I’ve tried connecting to 127.0.0.1:6680 on my laptop but it wasn’t worked.

EDIT: the error messages have returned while Mopidy is not running as server

http://127.0.0.1:6680/ is known as the loopback address. It is only accessibly from the same machine the server is running on i.e. you cannot connect to it from another computer (see https://superuser.com/questions/255835/whats-a-loopback-address-i-e-127-0-0-1).

Make sure you configure Mopidy correctly to allow connections from other computers (hostname = ::) as per https://docs.mopidy.com/en/latest/ext/http/#confval-http/hostname

Then find the ip address of your raspberry pi and use that in your laptop’s Web browser e.g. http://192.168.1.10:6680

I didn’t know that, thank you.

So I’ve change hostname to :: both under the [http] and [proxy] hostname settings (I have uncommented the hostname [proxy] setting).

However, when I type “mopidy config” into the command line, the hostname for both of these fields still shows as 127.0.0.1. Is this an issue?

I’ve used the ip address from ifconfig and I still get " This site can’t be reached IPaddress** refused to connect".

This is my config file (mopidy config). I’ve changed 127.0.0.1 to :: multiple times but it keeps showing 127.0.0.1.

[core]
cache_dir = $XDG_CACHE_DIR/mopidy
config_dir = $XDG_CONFIG_DIR/mopidy
data_dir = $XDG_DATA_DIR/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s
debug_file = mopidy.log
config_file =

[audio]
mixer = software
mixer_volume =
output = autoaudiosink
buffer_time =

[proxy]
scheme =
hostname = ::
port =
username =
password =

[ttsgpio]
enabled = true
debug_gpio_simulate = false
pin_button_main = 17
pin_button_next = 22
pin_button_previous = 23
pin_button_vol_up = 24
pin_button_vol_down = 25
pin_play_led = 18
tts_default_volume = 2

[local-images]
enabled = true
library = json
base_uri = /images/
image_dir =
album_art_files =
*.jpg
*.jpeg
*.png

[iris]
enabled = true
country = NZ
locale = en_NZ
spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
snapcast_enabled = false
snapcast_host = localhost
snapcast_port = 1705

[musicbox_webclient]
enabled = true
musicbox = false
websocket_host =
websocket_port =
on_track_click = PLAY_ALL

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
listall
listallinfo
default_playlist_scheme = m3u

[http]
enabled = true
hostname = 127.0.0.1
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname

[stream]
enabled = true
protocols =
http
https
mms
rtmp
rtmps
rtsp
metadata_blacklist =
timeout = 5000

[m3u]
enabled = true
base_dir = $XDG_MUSIC_DIR
default_encoding = latin-1
default_extension = .m3u8
playlists_dir =

[softwaremixer]
enabled = true

[file]
enabled = true
media_dirs =
$XDG_MUSIC_DIR|Music
~/|Home
excluded_file_extensions =
.jpg
.jpeg
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[local]
enabled = true
library = json
media_dir = $XDG_MUSIC_DIR
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.png
.txt

[spotify]
enabled = false ; Extension disabled due to config errors.
username = ; Must be set.
password = ; Must be set.
client_id = ; Must be set.
client_secret = ; Must be set.
bitrate = 160
volume_normalization = true
private_session = false
timeout = 10
allow_cache = true
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries =

[local-sqlite]
enabled = true
directories =
Albums local:directory?type=album
Artists local:directory?type=artist
Composers local:directory?type=artist&role=composer
Genres local:directory?type=genre
Performers local:directory?type=artist&role=performer
Release Years local:directory?type=date&format=%25Y
Tracks local:directory?type=track
Last Week’s Updates local:directory?max-age=604800
Last Month’s Updates local:directory?max-age=2592000
timeout = 10
use_album_mbid_uri = true
use_artist_mbid_uri = false
use_artist_sortname = false

[alsamixer]
enabled = true
card = 0
control = Master

Why would you change the proxy config? Does the documentation page about the proxy setting say you need to do that? Are you editing the correct file?

In a command prompt on the Pi, enter ‘ifconfig’ and enter.

pi@Kappa:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.134 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::6eff:d9d0:fd29:9bdc prefixlen 64 scopeid 0x20
ether b8:27:eb:e5:a1:79 txqueuelen 1000 (Ethernet)
RX packets 929471 bytes 67841591 (64.6 MiB)
RX errors 0 dropped 49 overruns 0 frame 0
TX packets 240780 bytes 114106449 (108.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 249703 bytes 18408313 (17.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 249703 bytes 18408313 (17.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

pi@Kappa:~ $
<<

This Pi (Kappa) has an IP address if 192.168.1.134, as seen in the eth0 section. If you are running wirelessly, it will be in the wlan0 (from memory, probably right) section.

To access Mopidy on it, I put http://192.168.1.134:6680 into the address bar of a browser. Since you and I both seem to have Iris and MusicBox as front ends, Mopidy will ask us what we want to use.

In the link that Nick posted about running Mopidy as a service (https://docs.mopidy.com/en/latest/service/#service), it mentions that the location of the config files change when running under the user account (undesirable because after every reboot you need to log in as your user and run Mopidy then not log out vs. “it just goes”). Not seeing new users editing the correct config file is a common source of confusion that I see.

Welcome to Mopidy! I’ve been very happy with it and the help that I’ve gotten from the community. I hope this helps.

KO