Mopidy Discourse

Mopidy.audio.gst GStreamer error: Could not open audio device for playback

Hello

Need help, cannot play anything.

I got these error on log

dez 21 19:09:34 cubietruck mopidy[10363]: WARNING [Audio-2] mopidy.audio.actor Setting GStreamer state to GST_STATE_PLAYING failed
dez 21 19:09:34 cubietruck mopidy[10363]: ERROR [MainThread] mopidy.audio.gst GStreamer error: Could not open audio device for playback.
dez 21 19:09:34 cubietruck mopidy[10363]: WARNING [Core-18] mopidy.core.tracklist Track is not playable: local:track:8%20Mile%20Soundtrack/03%20-%20Eminem%20-%208%20Mile%20-%208%20Mile.mp3

Thank you

Likely related to running the service as user mopidy which doesn’t have access to the sound device but there’s not enough info given. See https://docs.mopidy.com/en/latest/troubleshooting/

here is the output:

sudo mopidyctl config
Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config” as user mopidy
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
verbosity = 0
format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s
color = false
config_file =

[audio]
mixer = software
mixer_volume =
output = alsasink device=hw:1,0
buffer_time =

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

[file]
enabled = true
media_dirs =
$XDG_MUSIC_DIR|Music
~/|Home
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.pdf
.png
.txt
.zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[http]
enabled = true
hostname = 192.168.1.96
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true
default_app = mopidy

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

[softwaremixer]
enabled = true

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

[youtube]
enabled = true
youtube_api_key =
threads_max = 16
search_results = 15
playlist_max_videos = 20
api_enabled = false
autoplay_enabled = false
strict_autoplay = false
max_autoplay_length = 600
max_degrees_of_separation = 3

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

[mixcloud]
enabled = true
users = FactionMix

[alarmclock]
enabled = false ; Extension disabled by user config.

[tunein]
enabled = true
timeout = 5000
filter =

[spotify]
enabled = true
username = 1xna49ls11o07j7101hbtrus5
password = ********
client_id = efd0a200-04ac-4305-aca1-8bc84bde4f5f
client_secret = ********
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 =

[soundcloud]
enabled = true
explore_songs = 50
auth_token = ********

[podcast]
enabled = true
browse_root = Podcasts.opml
browse_order = desc
lookup_order = asc
cache_size = 64
cache_ttl = 86400
timeout = 10

[podcast-itunes]
enabled = true
base_url = http://itunes.apple.com/
country = US
explicit =
charts = audioPodcasts
charts_limit = 20
search_limit = 20
timeout = 10
retries = 3

[mpris]
enabled = true
bus_type = session

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

[local]
enabled = true
media_dir = /mnt/5tb/Music
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
included_file_extensions =
excluded_file_extensions =
.cue
.directory
.html
.jpeg
.jpg
.log
.nfo
.pdf
.png
.txt
.zip
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_artist_sortname = false
album_art_files =
*.jpg
*.jpeg
*.png

[dleyna]
enabled = true
upnp_browse_limit = 500
upnp_lookup_limit = 20
upnp_search_limit = 100
dbus_start_session = dbus-daemon --fork --session --print-address=1 --print-pid=1

[beets]
enabled = true
hostname = 127.0.0.1
port = 8337

[alsamixer]
enabled = true
card = 1
control = Master
min_volume = 0
max_volume = 100
volume_scale = cubic

deps output:

sudo mopidyctl deps
Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf deps” as user mopidy
Executable: /usr/bin/mopidy
Platform: Linux-5.8.16-sunxi-armv7l-with-debian-10.6
Python: CPython 3.7.3 from /usr/lib/python3.7
Mopidy: 3.0.2 from /usr/local/lib/python3.7/dist-packages
tornado: 6.0.4 from /usr/local/lib/python3.7/dist-packages
requests: 2.24.0 from /usr/local/lib/python3.7/dist-packages
urllib3: 1.25.10 from /usr/local/lib/python3.7/dist-packages
certifi: 2020.6.20 from /usr/local/lib/python3.7/dist-packages
idna: 2.10 from /usr/local/lib/python3.7/dist-packages
chardet: 3.0.4 from /usr/local/lib/python3.7/dist-packages
setuptools: 50.3.0 from /usr/local/lib/python3.7/dist-packages
Pykka: 2.0.2 from /usr/local/lib/python3.7/dist-packages
Mopidy-SoundCloud: 3.0.0 from /usr/lib/python3/dist-packages
Mopidy-Podcast-iTunes: 3.0.0 from /usr/lib/python3/dist-packages
Mopidy-MusicBox-Webclient: 3.1.0 from /usr/local/lib/python3.7/dist-packages
Mopidy: 3.0.2 from /usr/local/lib/python3.7/dist-packages
setuptools: 50.3.0 from /usr/local/lib/python3.7/dist-packages
Pykka: 2.0.2 from /usr/local/lib/python3.7/dist-packages
Mopidy-AlarmClock: 0.1.9 from /usr/local/lib/python3.7/dist-packages
setuptools: 50.3.0 from /usr/local/lib/python3.7/dist-packages
Mopidy: 3.0.2 from /usr/local/lib/python3.7/dist-packages
Pykka: 2.0.2 from /usr/local/lib/python3.7/dist-packages
monotonic: 1.5 from /usr/local/lib/python3.7/dist-packages
Mopidy-Spotify: 4.0.1 from /usr/lib/python3/dist-packages
Mopidy-Mixcloud: 3.1.4 from /usr/local/lib/python3.7/dist-packages
setuptools: 50.3.0 from /usr/local/lib/python3.7/dist-packages
Mopidy: 3.0.2 from /usr/local/lib/python3.7/dist-packages
Pykka: 2.0.2 from /usr/local/lib/python3.7/dist-packages
Mopidy-ALSAMixer: 2.0.0 from /usr/lib/python3/dist-packages
Mopidy-MPRIS: 3.0.1 from /usr/lib/python3/dist-packages
Mopidy-Local: 3.1.1 from /usr/lib/python3/dist-packages
Mopidy-YouTube: 3.1 from /usr/local/lib/python3.7/dist-packages
cachetools: 3.1.0 from /usr/lib/python3/dist-packages
setuptools: 50.3.0 from /usr/local/lib/python3.7/dist-packages
youtube-dl: 2020.9.20 from /usr/local/lib/python3.7/dist-packages
beautifulsoup4: 4.9.2 from /usr/local/lib/python3.7/dist-packages
soupsieve: 2.0.1 from /usr/local/lib/python3.7/dist-packages
requests: 2.24.0 from /usr/local/lib/python3.7/dist-packages
urllib3: 1.25.10 from /usr/local/lib/python3.7/dist-packages
certifi: 2020.6.20 from /usr/local/lib/python3.7/dist-packages
idna: 2.10 from /usr/local/lib/python3.7/dist-packages
chardet: 3.0.4 from /usr/local/lib/python3.7/dist-packages
Mopidy: 3.0.2 from /usr/local/lib/python3.7/dist-packages
Pykka: 2.0.2 from /usr/local/lib/python3.7/dist-packages
Mopidy-MPD: 3.0.0 from /usr/lib/python3/dist-packages
Mopidy-dLeyna: 2.0.0 from /usr/lib/python3/dist-packages
Mopidy-Beets: 4.0.0 from /usr/lib/python3/dist-packages
Mopidy-Podcast: 3.0.0 from /usr/lib/python3/dist-packages
Mopidy-TuneIn: 1.0.0 from /usr/lib/python3/dist-packages
GStreamer: 1.14.4.0 from /usr/lib/python3/dist-packages/gi
Detailed information:
Python wrapper: python-gi 3.30.4
Relevant elements:
Found:
uridecodebin
souphttpsrc
appsrc
alsasink
osssink
oss4sink
id3demux
id3v2mux
lamemp3enc
mpegaudioparse
mpg123audiodec
vorbisdec
vorbisenc
vorbisparse
oggdemux
oggmux
oggparse
flacdec
flacparse
shout2send
Not found:
pulsesink
flump3dec
mad

How can i check that ?

Thank You

Also got these “Failed to attach 2290”

dez 22 10:11:34 cubietruck systemd[1]: Started Mopidy music server.
dez 22 10:11:34 cubietruck systemd[2290]: Failed to attach 2290 to compat systemd cgroup /system.slice/mopidy.service: No such file or directory

Make sure the mopidy user belongs to the audio group ?

there is no mopidy user

reversedr@cubietruck:~$ users
reversedr reversedr

reversedr@cubietruck:~$ groups
reversedr tty disk dialout sudo audio video plugdev games users systemd-journal input netdev ssh bluetooth

groups mopidy
mopidy : audio video

The users command only gives you the users with a currently open session (or something like that).
Since you are running mopidy as a service, and the service seems up, I guess there indeed is a mopidy user.

To check which user the service is running as, you could run cat /lib/systemd/system/mopidy.service (if the file does not exist, you could get the service file using systemctl status mopidy).

Also, does the mopidy have access to the file you are trying to read ?

I don’t know. That’s specific to your hardware and your operating system.

Here is the output of “cat /lib/systemd/system/mopidy.service”

reversedr@cubietruck:~$ cat /lib/systemd/system/mopidy.service
[Unit]
Description=Mopidy music server
After=avahi-daemon.service
After=dbus.service
After=network.target
After=nss-lookup.target
After=pulseaudio.service
After=remote-fs.target
After=sound.target

[Service]
User=mopidy
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/cache/mopidy
ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy
ExecStart=/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf

[Install]
WantedBy=multi-user.target

Cubietruck with Armbian 20.08.17 Buster with Linux 5.8.16-sunxi

What file is that?

And Yes there is a user “mopidy” on the following groups:
reversedr@cubietruck:~$ sudo groups mopidy
mopidy : audio video

8%20Mile%20Soundtrack/03%20-%20Eminem%20-%208%20Mile%20-%208%20Mile.mp3

Since mopidy is ran with user mopidy, the music files have to be readable by that user.

But anyway this line:

suggests there’s indeed a problem with gstreamer opening the sound card. Have you tried playing something outside of mopidy ? Also is there any reason you have this line : output = alsasink device=hw:1,0 in the audio configuration ? Have you tried other values as described here: https://docs.mopidy.com/en/latest/config/#confval-audio-output

Are you using pulseaudio?

You are right! somehow the card 1: doesn´t exist anymore! ?

i changed output = alsasink device=hw:2,0 and now its working!

sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sun4icodec [sun4i-codec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: SPDIF [On-board SPDIF], device 0: spdif-dit-hifi dit-hifi-0 [spdif-dit-hifi dit-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

Thanks all of you for your help :smiley: