# Local scans seems to work but files appears nowhere

**URL:** <https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888>\
**Category:** Misc\
**Created:** [April 6, 2020, 3:02pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888 "2020-04-06T15:02:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaineo](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@captaineo](https://discourse.mopidy.com/u/captaineo)\
**Post date:** [April 6, 2020, 3:02pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/1 "2020-04-06T15:02:16Z")

</div>

Hi,

I’m trying to add my personal files on my Mopidy Iris library.  
Using mopidy as a service, I’ve added in my /etc/mopidy/mopidy.conf files the following lines :

```
[local]
enabled = true
library = json
media_dir = /media/NAS/music/Music/2018/
scan_timeout = 100000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions =
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt

```

And the scan seems to work because Mopidy returns theses lines :

```
"service mopidy run" is deprecated. Use "mopidyctl" instead.
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf local scan" as user root
INFO [MainThread] mopidy. __main__ Starting Mopidy 3.0.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: local, spotify, local-images, file, musicbox_webclient, iris, softwaremixer, m3u, http, stream, soundcloud
INFO [MainThread] mopidy. __main__ Disabled extensions: none
ERROR [MainThread] mopidy. __main__ Extension local-images failed during setup. This might have left the registry in a bad state.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/ __main__.py", line 129, in main
extension.setup(registry)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_local_images/ __init__.py", line 31, in setup
from .library import ImageLibrary
  File "/usr/local/lib/python3.7/dist-packages/mopidy_local_images/library.py", line 12, in <module>
from mopidy import local
ImportError: cannot import name 'local' from 'mopidy' (/usr/lib/python3/dist-packages/mopidy/ __init__.py)
INFO [MainThread] mopidy_local.commands Finding files in file:///media/NAS/music/Music/2018 ...
INFO [MainThread] mopidy_local.commands Found 5 files in file:///media/NAS/music/Music/2018
INFO [MainThread] mopidy_local.commands Checking 5 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] mopidy_local.storage Cleaning up image directory

```

But, whether on Iris or MusicBox webclient, my library does not display any music from my library …

Do you have a solution for me? Thank you in advance 🙂

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [April 6, 2020, 3:29pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/2 "2020-04-06T15:29:49Z")

</div>

Your installation is broken. From 3.x release changelog

> In other news, the [Mopidy-MPD](https://mopidy.com/ext/mpd/) and [Mopidy-Local](https://mopidy.com/ext/local/) extensions have grown up and moved out to flourish as independent extension projects. After the move, Mopidy-Local merged with Mopidy-Local-SQLite and Mopidy-Local-Images, which are now both a part of the Mopidy-Local extension.

So:

- Remove Mopidy-Local-images, it no longer exists
- Use `sudo mopidyctl deps` to ensure you have installed the latest version of of Mopidy-Local, other versions will not work properly. Install it with `sudo apt install mopidy-local`.
- Fix your config to remove the local settings which no longer exist (see [docs](https://github.com/mopidy/mopidy-local#configuration))

For bonus points:

- If possible, stop running the Mopidy service as your `root` user.

---

<div class="post-metadata">

**Author:** ![captaineo](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@captaineo](https://discourse.mopidy.com/u/captaineo)\
**Post date:** [April 6, 2020, 4:16pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/3 "2020-04-06T16:16:02Z")

</div>

Thanks for your fast reply.  
I’ve done what you said but It’s still not working, however theses changes had some effects because the local library is completely removed from the Iris interface (It’s not possible to search in the local files too, which was possible before theses changes despite the fact Mopidy doesn’t show my files). Before, I was able to search in my files on this page :

 ![Capture d’écran 2020-04-06 à 18.16.52](https://canada1.discourse-cdn.com/flex036/uploads/mopidy/original/2X/d/d2418514bec8f29053d951f5e989584495c19995.jpeg)  
sudo mopidyctl deps output :

```
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf deps" as user mopidy
Executable: /usr/bin/mopidy
Platform: Linux-4.19.97-v7+-armv7l-with-debian-10.2
Python: CPython 3.7.3 from /usr/lib/python3.7
Mopidy: 3.0.1 from /usr/lib/python3/dist-packages
Mopidy-SoundCloud: 3.0.0 from /usr/local/lib/python3.7/dist-packages
  Mopidy: 3.0.1 from /usr/lib/python3/dist-packages
  requests: 2.21.0 from /usr/lib/python3/dist-packages
  setuptools: 40.8.0 from /usr/lib/python3/dist-packages
  Pykka: 2.0.2 from /usr/lib/python3/dist-packages
Mopidy-Iris: 3.44.0 from /usr/local/lib/python3.7/dist-packages
  setuptools: 40.8.0 from /usr/lib/python3/dist-packages
  Pykka: 2.0.2 from /usr/lib/python3/dist-packages
  Mopidy: 3.0.1 from /usr/lib/python3/dist-packages
Mopidy-MusicBox-Webclient: 3.0.1 from /usr/local/lib/python3.7/dist-packages
  Mopidy: 3.0.1 from /usr/lib/python3/dist-packages
  setuptools: 40.8.0 from /usr/lib/python3/dist-packages
  Pykka: 2.0.2 from /usr/lib/python3/dist-packages
Mopidy-Local: 3.1.1 from /usr/local/lib/python3.7/dist-packages
  Mopidy: 3.0.1 from /usr/lib/python3/dist-packages
  uritools: 3.0.0 from /usr/local/lib/python3.7/dist-packages
  setuptools: 40.8.0 from /usr/lib/python3/dist-packages
  Pykka: 2.0.2 from /usr/lib/python3/dist-packages
Mopidy-Spotify: 4.0.1 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
        pulsesink
        id3demux
        id3v2mux
        lamemp3enc
        mpegaudioparse
        mpg123audiodec
        vorbisdec
        vorbisenc
        vorbisparse
        oggdemux
        oggmux
        oggparse
        flacdec
        flacparse
        shout2send
      Not found:
        flump3dec
        mad

"service mopidy run" is deprecated. Use "mopidyctl" instead.
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.0.1
INFO [MainThread] mopidy.config Loading config from builtin defaults
INFO [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy-local.conf
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: spotify, iris, soundcloud, m3u, softwaremixer, musicbox_webclient, stream, local, http
INFO [MainThread] mopidy. __main__ Disabled extensions: file
INFO [MainThread] mopidy_local.commands Finding files in file:///media/NAS/music/Music/2018 ...
INFO [MainThread] mopidy_local.commands Found 0 files in file:///media/NAS/music/Music/2018
WARNING [MainThread] mopidy_local.commands Encountered 1 errors while finding files in file:///media/NAS/music/Music/2018
WARNING [MainThread] mopidy_local.commands Error for file:///media/NAS/music/Music/2018: ('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] mopidy_local.storage Cleaning up image directory

```

In addition to that, I’ve removed 1 line in the mopidy.conf files which was a config value that no longer exist.

I’m aware using root user is not a good way to do but when I use the mopidy user, It cause some permission issues (‘permission denied’, 13).

Thanks you 🙂

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [April 6, 2020, 4:30pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/4 "2020-04-06T16:30:32Z")

</div>

The log says you need to fix the permissions for user moidy. Sounds like you are on the right track.

---

<div class="post-metadata">

**Author:** ![captaineo](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@captaineo](https://discourse.mopidy.com/u/captaineo)\
**Post date:** [April 6, 2020, 6:02pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/5 "2020-04-06T18:02:37Z")

</div>

Do you have an idea on how I can fix it ? Seems that using chown mopidy on the specified directory and its files does nothing.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [April 6, 2020, 6:20pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/6 "2020-04-06T18:20:24Z")

</div>

I don’t know anything about your filesystem so I’m not very well placed to help. If I assume it’s a network mount then that’s not going to work. With a cifs mount you’d normally have to set the `uid` argument else the default is that root is given ownership. Have a read of [https://linux.die.net/man/8/mount.cifs](https://linux.die.net/man/8/mount.cifs)

---

<div class="post-metadata">

**Author:** ![captaineo](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@captaineo](https://discourse.mopidy.com/u/captaineo)\
**Post date:** [April 7, 2020, 9:02am UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/7 "2020-04-07T09:02:24Z")

</div>

I don’t think it’s the problem anyway because running the sudo `mopidyctl local scan` command as root user giving me the same behaviour (without the error message related to permissions). No trace of the local library whether on Iris or Musicbox Webclient. In addition to that, the `Run local scan` button on Iris does nothing and local disappeared of the source priority options.

![Capture d’écran 2020-04-07 à 10.59.56](https://canada1.discourse-cdn.com/flex036/uploads/mopidy/original/2X/3/30b1fed286520bf042271a6d4cd38d67569efb5f.png)

```
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf local scan" as user root
INFO [MainThread] mopidy. __main__ Starting Mopidy 3.0.1
INFO [MainThread] mopidy.config Loading config from builtin defaults
INFO [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy-local.conf
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, spotify, soundcloud, m3u, stream, local, musicbox_webclient, softwaremixer, iris
INFO [MainThread] mopidy. __main__ Disabled extensions: file
INFO [MainThread] mopidy_local.commands Finding files in file:///media/NAS/music/Music/2018 ...
INFO [MainThread] mopidy_local.commands Found 5 files in file:///media/NAS/music/Music/2018
INFO [MainThread] mopidy_local.commands Checking 5 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] mopidy_local.storage Cleaning up image directory

```

I’m a little bit lost 😅  
Anyway, thanks for your help !

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [April 7, 2020, 9:24am UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/8 "2020-04-07T09:24:57Z")

</div>

So when you run as:

- `mopidy`: you can’t read the files and so you can’t scan, result is no files shown (no surprise).
- `root`: you can read the (5?) files and presumably write a database owned by the `root` user that only `root` can read. Then you run the Mopidy service normally as `root` again? or as `mopidy`? If it’s the latter than you cannot read the database file, so same end result of no files.

---

<div class="post-metadata">

**Author:** ![captaineo](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@captaineo](https://discourse.mopidy.com/u/captaineo)\
**Post date:** [April 7, 2020, 10:01am UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/9 "2020-04-07T10:01:58Z")

</div>

That’s right.  
How can I know which user is using the Mopidy service ?  
In my terminal I’m logged as root when I launch the `service mopidy start` command.

All I know is I change the mopidy user in my /usr/sbin/mopidyctl file (Seems to be a way to fix a similar permission issue in this thread : [Local scan fails](https://discourse.mopidy.com/t/local-scan-fails/1804/3))

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [April 7, 2020, 10:51am UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/10 "2020-04-07T10:51:28Z")

</div>

It’s normally the `mopidy` user but when people start hacking around with files it’s hard to be sure any more. In this case, if that is the only file you have edited, I would think you’re still running the service as the `mopidy` user, which probably can’t read a database file owned by `root`. You can check the service with `sudo systemctl status` and see the Main PID or by running `ps aux | grep mopidy`:

```auto
$ sudo systemctl status mopidy
● mopidy.service - Mopidy music server
   Loaded: loaded (/lib/systemd/system/mopidy.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-04-07 11:33:01 BST; 1s ago
  Process: 7488 ExecStartPre=/bin/mkdir -p /var/cache/mopidy (code=exited, status=0/SUCCESS)
  Process: 7494 ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy (code=exited, status=0/SUCCESS)
 Main PID: 7503 (mopidy)

```

You would probably see a message in the log during service startup if there was a permission problem reading the database. Did you check the Mopidy logs for anything like that (`journalctl -u mopidy`) ? In fact, it would be pretty much exactly what is happening in the thread you have linked to…

For the record, that user in the linked thread was using dietpi (a bastardised distribution where someone thought running all the random software on a system as `root` was a good idea - it is a bad idea. PiMusicbox has always done it and it’s a horrible idea there too). To be clear, scanning as root is not a fix, it’s a hacky workaround for some other problem. In your case the network mount is perhaps not configured correctly.

---

<div class="post-metadata">

**Author:** ![captaineo](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@captaineo](https://discourse.mopidy.com/u/captaineo)\
**Post date:** [April 7, 2020, 12:22pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/11 "2020-04-07T12:22:52Z")

</div>

Understood !  
Indeed, I run the local scan as mopidy user on a `/home/pi/` directory (without using a mounted folder) and It’s works like a charm (Iris is able to play all the songs founded).

I thought it was the mopidy-local module that was not working completely and I hadn’t really figured out that using the process as root was not a solution in itself.  
As you recommended, I will look at how my storage is mounted. I’ve used this line on my /etc/fstab file to mount my Music folder stored on the NAS : `192.168.0.23:/volume2/music/ /media/NAS/music nfs defaults,user,auto,noatime,intr 0 0`, going to read the mount.cifs manual to fix this problem 🙂

Thanks you !

---

<div class="post-metadata">

**Author:** ![captaineo](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@captaineo](https://discourse.mopidy.com/u/captaineo)\
**Post date:** [April 7, 2020, 1:53pm UTC](https://discourse.mopidy.com/t/local-scans-seems-to-work-but-files-appears-nowhere/3888/12 "2020-04-07T13:53:33Z")

</div>

Simply adding the UID=1000 argument and a recursive 755 chmod seems to be a solution !  
Thanks you !
