Music Box not finding network files

Your log has config errors in it. While there is nothing about mopidy-local or sqlite, I’d still correct those first just in case. I noticed once that incorrect audio card settings caused the weblclient to not load, even though prima facie there appears to be no link between those two.

EDIT: notice also:

2015-11-25 12:14:26,167 - ERROR Refreshing Mopidy-Podcast-iTunes failed: (‘Connection aborted.’, error(101, ‘Network is unreachable’))

If you ssh in, can you ping google?

It is and has been set to always true, but unfortunately it hasn’t worked.[quote=“tot_rispekt, post:22, topic:862”]
If you ssh in, can you ping google?
[/quote]
I can ping google, and all the features besides the Network mount work like I would expect them too.
Edit:

Where would I find this config file, because besides changing the settings.ini file in the beginning, changing it to a static IP, and elevating permissions of the mount as suggested this is a clean reimaging. The webclient error is odd because the audiocard that I have attached is he same I have configured in the settings, and the webclient is accessible anyway.

you probably have some errors in settings.ini and maybe in the config of the share (samba)

The log file looks OK to me (I don’t think those errors really matter). Musicbox will mount your network drive as read-only (ro) so trying to retrospectively change the permissions of that folder will not work. Can you double check that /music is owned by user mopidy? Do you have samba unix extensions enabled on your file server? I think we require those to be disabled. Otherwise you can try adding uid and gid mount options in /opt/musicbox/startup.sh.

Sorry for the late reply, I’ve been busy.
Anyway, /music is owned by 1000 who I hope is mopidy, but I don’t know my way around Linux enough to verify this. Within /music every folder but the /MusicBox is owned by root, is that supposed to be that way?
I am unable to check or change samba unix extensions on the file server as it is a primitive one built into the router.
Can you elaborate what you mean by the uid and gid mount options? How and where in the file do I add them?

Quite often on linux, user 1000 is the first user created that is not root, and root is 0.

On Debian at least (and most likely on Raspbian also) you can see the user with the following:

cat /etc/passwd|grep 1000

On pimusicbox the music player (mopidy) is run under user “mopidy”, and therefore that user needs to be able to access the files. In unix files have owners, but those owners can also give other non-owners permissions. In this case, however, if I understand correctly, because of the network mount, mopidy needs to own them (and not so that root owns them but gives permissions to mopidy user).

Unfortunately your command returns nothing, but just opening the file reveals that mopidy is user 1001 (1002?) mopidy:x:1001:1002:,,,:/home/mopidy:/bin/bash considering that the owner of /music and likely subdirectories is the wrong one, how do I change the owners?

The reason it returns nothing is because there is no “1000” in the file.

Owner can be changed with: chown

http://www.linfo.org/chown.html

on my pimusicbox all the files have
drwxrwxrwx and root

what do you get when you comamnd ls -la?

Here comes another wall of text, this is before changing anything:
total 96
drwxr-xr-x 22 root root 4096 Apr 14 2015 .
drwxr-xr-x 22 root root 4096 Apr 14 2015 ..
drwxr-xr-x 2 root root 4096 Mar 27 2015 bin
drwxrwxrwx 5 root root 16384 Jan 1 1970 boot
drwxr-xr-x 12 root root 3000 Nov 29 01:17 dev
drwxr-xr-x 98 root root 4096 Jul 10 2016 etc
drwxr-xr-x 3 root root 4096 May 6 2014 home
drwxr-xr-x 12 root root 4096 Mar 27 2015 lib
drwx------ 2 root root 16384 Feb 9 2013 lost+found
drwxr-xr-x 2 root root 4096 Dec 26 2012 mnt
drwxrwxrwx 11 1000 1000 4096 May 6 2014 music
drwxr-xr-x 5 root root 4096 Jan 13 2015 opt
dr-xr-xr-x 83 root root 0 Jan 1 1970 proc
drwxr-xr-x 5 root root 4096 Nov 26 14:57 root
drwxr-xr-x 13 root root 640 Nov 29 01:17 run
drwxr-xr-x 2 root root 4096 Mar 27 2015 sbin
drwxr-xr-x 2 root root 4096 Apr 25 2013 selinux
drwxr-xr-x 2 root root 4096 Feb 9 2013 srv
dr-xr-xr-x 12 root root 0 Jan 1 1970 sys
drwxrwxrwt 4 root root 4096 Nov 29 22:17 tmp
drwxr-xr-x 10 root root 4096 Feb 9 2013 usr
drwxr-xr-x 12 root root 4096 Sep 1 2014 var

root@MusicBox:/music# ls -la
total 40
drwxrwxrwx 11 1000 1000 4096 May 6 2014 .
drwxr-xr-x 22 root root 4096 Apr 14 2015 ..
drwxrwxrwx 2 1000 1000 4096 Sep 18 2014 MusicBox
drwxrwx--- 1 root root 0 Nov 8 19:42 Network
drwxr-xr-x 2 root root 4096 May 2 2014 USB
drwxr-xr-x 2 root root 4096 May 2 2014 USB2
drwxr-xr-x 2 root root 4096 May 2 2014 USB3
drwxr-xr-x 2 root root 4096 May 2 2014 USB4
drwxr-xr-x 2 root root 4096 May 2 2014 USB5
drwxr-xr-x 2 root root 4096 May 2 2014 USB6
drwxr-xr-x 2 root root 4096 May 2 2014 USB7

After running chown 1001:1002 /music the appropriate line now reads drwxrwxrwx 11 mopidy mopidy 4096 May 6 2014 music, but still it doesn’t work.
/music/Network doesn’t appear to let it’s permissions be changed, or at least there appear none after running ls -la again.

well, at least music is now owned by mopidy. IIRC this is a flash drive on a usb port youe router. Are you absolutely sure that there are no settings in the router page for this. Because usually routers have at least a page where you can set users and a password. For your purposes you should probably set such authetification off.

If mopidy user cannot acces the files, can you when logged on as root access them? Can you play them (from the command line) for example (not only see the names of the files I mean)?.

Is this drive the only drive shared by that router?

While I don’t know what the command to play an mp3 directly is, a text file placed on the share can be read just fine, same with the .m3u playlist I have placed on the drive.
Unfortunately the options in this router are abysmal, but I am forced to use the DSL modem/router from my ISP. It is good enough for most things, so I haven’t done too much research into replacing it, but I digress. The network storage setup option let’s you create users, for which you can enable FTP and SFTP access. It also lets you specify a mount beside the user folder, which I have done with the media folder, which can be accessed by all. It also allows for “Guest Access”, but that just creates a generic user that can log in with any password. I have tried that, but it doesn’t work either, so I went back to trying with a regular user. Other than that you can browse the files and create new folders which can be used as mount points.

Edit: Yes the drive is the only one that is shared by the router.

The alsa-utils package that pimusicbox comes with by default allows you to play a .wav file with aplay sample.wav.

You can even log on as root and switch to user mopidy with su - mopidy then as user mopidy do aplay sample.wav.

AFAIK this only works with .wav.

In the above, your /network folder is drwxrwx— which indicates that only root has access to the folder. If you cannot chnage the permissions, then maybe one thing you can try is to run mopidy as root.

As root playing a file worked flawlessly, but as mopidy it failed. I tried again to use chown to change the permission of the Network folder, yet again it said that it did with no change. chown: changing ownership of '/music/Network/': Read-only file system but no change occurs.

How would I get user mopidy to run with root privileges? Or do you mean to try to start mopidy under root?

Edit: Trying to run mopidy under root stopped itself after ERROR Frontend (MpdFrontend) initialization error: MPD server startup failed: [Errno 98] Address already in use

you can first stop the service
service mopidy stop
then start it again with root. this will then, however, not persist when you reboot. for that I think you’d need to edit the file /etc/init.d/mopidy and change DAEMON_USER=mopidy. I say “I think”, because I am not very familiar with sysvinit (the newer versions of Debian and Raspbian now use systemd). use the command
top
to see all services and programs that are currently running (and who is running them also)

After stopping mopidy and trying to start it up again it seems to freeze after INFO new MPD connection from [::ffff:127.0.0.1]:59719
After rebooting the number at the end is different, but the result seems the same. I’ll keep it running for longer this time and update if anything changes.

I’ll look into the automation after seeing what prevents it from starting mopidy as root, or would it be sensible to try to change who starts it in case this doesn’t work after giving it a fair while? (>1.5h)

Edit: Since I have given it more than enough time to do anything I’ll give up on starting mopidy as root, and as it doesn’t want to start when started under root. For that reason I don’t believe it to be wise to edit the startup file to have it start as root, as I fear that that will cause it to fail entirely. Is there anything else to try or should I risk it?

Wait, if you start it normally by writing mopidy (not as a service, that is by writing service mopidy start) on the command line, it will freeze under normal circumstances in the sense that that terminal window will not be released to you untill you terminate mopidy. Is it really frozen in that you cannot get to the web page? When you run it as root it will be using the /etc/mopidy/mopidy.conf file and not the one of the mopidy user, but my understanding is that in pimusicbox these are linked, so that should not make a difference.

I was just thinking that in your case the easiest solution might be to unplug the usb device from the router and put it in the RPi. If you are reluctant to do this because other machines on your network use it, remember that pimusicbox can also share the content over the network

Kind of. When I type mopidy, it outputs what it is doing to the terminal, with all the information usually found in the log file. I guess I shouldn’t call it a freeze as the terminal itself is responsive, Ctrl + C shuts down mopidy again, but yes the web interface stays unreachable until I reboot the Pi. I guess I can try starting it as a service and seeing if that makes a difference. Edit: Looks to just launch it under user mopidy again.

I guess I can see how the performance of the Network compares if the Pi shares the HDD. Is this functionality built in or should I start googeling on how to set the Pi up as a NAS? One of the biggest reasons why I wouldn’t want to have it near the Pi is that I am strapped for outlets near my media center as it is, so having the HDD leech of off an empty outlet near the router is preferable.

the scripts that start the service need to be edited I fear in order to pull that off then. Maybe some one else can help you there.

What you describe as “a freeze” sounds like what should normally happen when you issue “mopidy” like that.

Many router’s that share over USB are really poor at it, and you might even see improvements in performance on the Pi. Is the HDD of the form that it cannot be run of USB power alone (like a 3.5 inch one? Because if it can be run, then a pi has four USB ports. I have a 2.5 inch laptop hdd that I put in a SATA-to-USB case and the pi can run it off of one USB port. (If it couldn’t I could use two).

And yes, the pimucivbox standard install shares the /music folder over samba WORKGROUP

So I finally got it to work using the suggestion from kingofsticks, this time properly with what I have learned over the past couple of days here to correctly apply it.
What worked was adding the uid and gid of mopidy (1001,1002) to line 188 of /opt/musicbox/startup.sh
mount -t cifs -o sec=ntlm,ro,user=$INI_network_mount_user,password:$INI_network_mount_password,uid=1001,gid=1002 $INI_network_mount_address /music/Network
Thank all of you for your help, the mount finally works and I have a (slightly) deeper understanding of Linux.

Interesting. What is the difference between mounting the drive that way vs using fstab?

Glad it’s working :slight_smile: