Mopidy Discourse

Mopidy scan USB not successful

I have setup for me a new Raspi 3 with Debian Buster following that article .
Everything works, but scanning music files on USB stick having problems.

Here is the result when running mopidy -v local scan

Found 0 files in file:///home/pi/Music

The path file:///home/pi/Music is wrong.

it should be /media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058

Where do I enter the path in the correct way?
I did enter it in the /etc/mopidy/mopidy.conf file adding [file] and [local].


Assuming you are running as a service (I have not read that article):

sudo mopidyctl local scan

thanks for the quick reply.
Yes I run it as a service.

What I have to know now is one thing.

I have a USB Stick with the following path /media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058
user:group is pi:pi
permissions 777

I have modified the entry in ~/.config/user-dirs.dirs XDG_MUSIC_DIR="/media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058"

My question:
what do I have to enter in the /etc/mopidy/mopidy.conf under

media_dir = ??? ← I would put in /media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058

enabled = true
media_dirs = ??? ← I would put in $XDG_MUSIC_DIR do I need |Music and ~/|Home

When I run sudo mopidyctl local scan I am getting an error Permissions denied 13 even that I changed the owner to mopidy.

sudo mopidyctl local scan
Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf local scan” as user mopidy
INFO [MainThread] mopidy.main Starting Mopidy 3.1.1
INFO [MainThread] mopidy.config Loading config from builtin defaults
INFO [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
INFO [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
INFO [MainThread] mopidy.config Loading config from command line options
INFO [MainThread] mopidy.main Enabled extensions: http, stream, iris, file, mpd, musicbox_webclient, local, somafm, softwaremixer, m3u
INFO [MainThread] mopidy.main Disabled extensions: none
INFO [MainThread] mopidy_local.commands Finding files in file:///media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058 …
INFO [MainThread] mopidy_local.commands Found 0 files in file:///media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058
WARNING [MainThread] mopidy_local.commands Encountered 1 errors while finding files in file:///media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058
WARNING [MainThread] mopidy_local.commands Error for file:///media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058: (‘Permission denied’, 13)
INFO [MainThread] mopidy_local.commands Checking 0 tracks from library
INFO [MainThread] mopidy_local.commands Removing 0 missing tracks
INFO [MainThread] mopidy_local.commands Found 0 tracks which need to be updated
INFO [MainThread] mopidy_local.commands Scanning…
INFO [MainThread] mopidy_local.commands Scanned 0 of 0 files in 0.000s.
INFO [MainThread] mopidy_local.commands Done scanning
INFO [MainThread] Cleaning up image directory

If I run “mopidy -v local scan”, it is scanning but when I work with Iris or musicbox_webclient it does not show me any music. is the command used for mopidy-local or when running mopidy not as a service?

Did you mount the drive with those permissions? Or did you randomly set those permissions on the mountpoint? Does the drive format support unix file permissions? Mopidy’ as a service run as the user mopidy and needs to be able to read the contents of the directory you have asked it to scan. I don’t want to debug how to correctly mount a drive in Linux, can you please make sure the mopidy user can access all the files, A really simple test of that would be:

sudo -su mopidy ls /media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058/

I have modified the entry in ~/.config/user-dirs.dirs XDG_MUSIC_DIR="/media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058"

OK, but this won’t help when running Mopidy as a service.

media_dir = /media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058

This looks fine.

media_dirs = ??? ← I would put in $XDG_MUSIC_DIR do I need |Music and ~/|Home

I wouldn’t. If I was already using the Local backend I wouldn’t also use the File backend for the same music. What benefit would that provide? If I did want to do that for some reason then I would set

media_dirs = /media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058

You did? Where? Why? That error suggests the mopidy user does not have permission to read the files on your mounted drive. You need to fix that as already mentioned above.

That command is for when you are not running Mopidy as a service. You could read about that here Running in a terminal — Mopidy 3.1.1 documentation

thanks for the long detailed reply. and basically it was the first simple test you send me, proofing that the permissions denied and with that the had to fail.

sudo -su mopidy ls /media/pi/cc92a1a1-8050-46a9-a53e-86407efe3058/

Running the test with pi instead of mopidy it was successful. changing the group memebership did not help. I did more research on mounting USB drives and manually mounted the usb drive, even that it was already mounted by the OS under media.
now the test for mopidy was successful, I changed certain settings back I do not need and run successful the command sudo mopidyctl local scan.

Thank you very much for your time and help. I learned a lot today, but there is far still more to come.

this is now my /etc/mopidy/mopidy.conf

hostname =

output = alsasink

media_dir = /mnt/Music

enabled = true
username = a username
password = **********

I had the same problem in September last year and found the solution myself. Should be added to the mopidy documentation, Please find my post from Sept below:
Iris and Mopidy Mobile are empty when music is on USB drive
Kind regards - Martin Klein

If someone would please come up with a pull request to chnage the documentation I would appreciate that.