Stuck with shared libraries RPi2 - MySQL

I’ve used OSMC on an RPi2 for quite a long time now and it has worked well. I have ripped my DVD collection and music collection to an external HDD. This is on 24/7 but only serves one TV.

I have a second identical RPi2 which I wanted to be able to access the same media over the network.

I read up on using MySQL. I installed the server on the existing pi and configured it to use that instead. I setup the library within MySQL instead. That all seems to be working.

I have put a blank matching version of OSMC (16.1) on to a new microsd card on the second pi. I have copied the advancedsettings.xml to it and it shows all the files in the shared library.

My problem comes from the fact that I can’t actually play any of the files. It just says it is no longer there and asks if I want to delete it.

I believe that on the server pi I actually need to setup a network location to itself so that it uses the same one for the client as well?

I seem to be having problems doing this though. I can’t add the external drive to either the server or the client pi through the network locations bit.

I use Samba, and have that setup on the server pi. I can access the external drive from my windows laptop to add and remove files.

I can’t access the SMB location from either pi though.

Any ideas what I’m doing wrong?

Am I correct in saying that I need to add the external drive as a network location (on the server) rather than adding the media directly so that it has the network path in the library for the other devices to use?

I forgot to say, when I try to add the share I get the message:

Error
Software caused connection abort

OK

That is when just using the server pi and trying to add the SMB network share which relates to itself.

This is the end of the Samba log after a reboot and an attempt to connect to the samba share from the same pi:

[2016/12/19 23:04:49, 0] …/source3/smbd/server.c:1241(main)
smbd version 4.2.14-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2014
[2016/12/19 23:04:49.868928, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2016/12/19 23:05:57.438029, 0] …/lib/util/fault.c:78(fault_report)

[2016/12/19 23:05:57.438498, 0] …/lib/util/fault.c:79(fault_report)
INTERNAL ERROR: Signal 11 in pid 1152 (4.2.14-Debian)
Please read the Trouble-Shooting section of the Samba HOWTO
[2016/12/19 23:05:57.438809, 0] …/lib/util/fault.c:81(fault_report)

[2016/12/19 23:05:57.439023, 0] …/source3/lib/util.c:788(smb_panic_s3)
PANIC (pid 1152): internal error
[2016/12/19 23:05:57.439958, 0] …/source3/lib/util.c:899(log_stack_trace)
BACKTRACE: 0 stack frames:
[2016/12/19 23:05:57.440348, 0] …/source3/lib/dumpcore.c:318(dump_core)
dumping core in /var/log/samba/cores/smbd
[2016/12/19 23:05:57.516315, 1] …/source3/smbd/server.c:462(remove_child_pid)
Scheduled cleanup of brl and lock database after unclean shutdown
[2016/12/19 23:06:17.526603, 1] …/source3/smbd/server.c:407(cleanup_timeout_fn)
Cleaning up brl and lock database after unclean shutdown

Not necessarily, that is what path substitution is for
http://kodi.wiki/view/Path_substitution

Also did you follow the MYSQL guide respectively?
http://kodi.wiki/view/MySQL

The Path Substitution looks useful but I still need to access the files over the network.

I followed that MySQL guide as best as I could!

I installed MySQL fine and set it up ok.

The guide states:
Even if the media is on the same computer as one of the Kodi instances, you MUST use a network share path. You cannot use a local file path with MySQL.

So I was trying to ensure that I did that.

However that is where I got stuck. I cannot add the external drive as a network share on either of the RPi2s (not even the one it is attached to). I can see it and access it from Windows, however the log file shows the same error as above when connecting from windows (but windows continues to work).

It appears to be able to add the home directories but the external drive just fails every time.

To share the external drive via Samba I had to make a smb-share.conf file with the following contents:

http://paste.osmc.io/axaqanapen

If I try to connect with smbclient I get the following error:

Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]
tree connect failed: NT_STATUS_CONNECTION_DISCONNECTED

Any ideas where I’m going wrong?

I’m confident that the MySQL side of things is set up correctly but it is my Samba setup that is causing me the issues. It seems strange that windows 10 can connect OK but Linux can’t.

Have you installed samba server from the app store? Than no additional config needed.

If you have not used app store version I suggest to remove all the samba installation and config you did and start with the app store version

Yes, I used the app store version. However as stock it wouldn’t show my USB drive, on my windows computer I would just see the OSMC home drive. Adding the above config was in a guide to allow direct access to the external drive.

Just as an extra point to note, I have just tried installing Kodi on my Android phone. When trying to access the external drive connected to the pi server it gives the error “Broken pipe”.

Windows still connects fine to the external drive and can copy/move files around.

Ok when you installed the app store version than please remove any config that you manually added and reboot your device. After that provide output of:

grab-logs -A
paste-log /etc/samba/smb.conf
smbclient -L localhost

MySql does NOT require network paths but DOES require all paths to be the same. For example if you mount your network shares via fstab as long as they are mounted to the same file path on all machines then it will work. This is where path substitution comes in handy as you can make a network path look like a local one for Windows or whatever

I have removed any added config and have rebooted.

A modified version of the grab logs file can be found here: (Modified to remove passwords)

http://paste.osmc.io/siwupocosu.vhdl

The paste-log of smb.conf is:
http://paste.osmc.io/homifefuma

The output of the smbclient command is:

Enter osmc’s password:
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]

    Sharename       Type      Comment
    ---------       ----      -------
    osmc            Disk      OSMC Home Directory
    IPC$            IPC       IPC Service (Samba 4.2.14-Debian)
    BLACKDRIVE      Disk      Auto-mount Volume

Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]

    Server               Comment
    ---------            -------
    OSMC                 Samba 4.2.14-Debian
    TOSHIBA-PC

    Workgroup            Master
    ---------            -------
    WORKGROUP            OSMC

Interestingly the blackdrive (external drive) is still showing up in the smbclient list even after removing the config for it (it wasn’t there until I put the smb-share.conf file in) - so I’m not sure if it just remembers it or if it is cached somewhere but it isn’t the same as before I added the smb-share.conf file (which is now removed).

The App Store version has an automount entry therefore normally you don’t need to do anything for your automounted devices to show up. This now looks all right.
So now if you access from Kodi via samba you don’t see “Blackdrive”?

Was this file uploaded after you removed your own config and rebooted?

Yes - I made that file after removing the config and rebooting.

I still can’t access the blackdrive from samba on either pi. I can still see it from windows though. I can access the osmc share via samba absolutely fine but not the blackdrive.

I’m going to try swapping the pi with the other one as that has a fresh clean install of OSMC with no modifications. I will add Samba from the app store and manually install MySQL. Then it will be as clean as possible. Then I can always wipe the original one and start again with that one too.

Can you actually access the drive locally? What is the output of
ls -lah /media/BLACKDRIVE

Yes, I can access it locally, it works locally perfectly. The result of the above command is a directory listing of the external drive.

So what does
smbclient '\\localhost\BLACKDRIVE' gives you?
Do you get an SMB prompt? Can you ls in that one?

Nope can’t get an SMB prompt, just get:

Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]
tree connect failed: NT_STATUS_CONNECTION_DISCONNECTED

Are you sure you removed all of the configs you manually had added?
Suggest you remove all samba packages and configs and then reinstall clean version from app store.
list all installed packages dpkg -l samba* | grep ii and then remove them with sudo apt-get remove <package name>
Then remove all config files sudo rm -R /etc/samba

after that reboot and install version from app store and try again

I’m trying it on the second pi.

I’ve wiped it again to make sure.

I’ve installed a brand new fresh version of OSMC (Kodi 16.1)
I’m just waiting for Samba to install from the App store.
I will then plug in the USB drive and try to access the files through Samba.

Seems to be exactly the same on the clean install. Will post logs in a second.

All I have done so far is install a fresh copy of OSMC, and add Samba from the App store.

grab-logs -A:
http://paste.osmc.io/eciwapudop

smb.conf
http://paste.osmc.io/boqidozeru

I can’t do the smbclient output yet as I haven’t installed the smbclient yet on this clean install

Update - have now used apt-get to install smbclient and got the following output:

Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]

    Sharename       Type      Comment
    ---------       ----      -------
    osmc            Disk      OSMC Home Directory
    IPC$            IPC       IPC Service (Samba 4.2.14-Debian)
    BLACKDRIVE      Disk      Auto-mount Volume
    boot            Disk      Auto-mount Volume

Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]

    Server               Comment
    ---------            -------
    OSMC                 Samba 4.2.14-Debian
    OSMC2                Samba 4.2.14-Debian

    Workgroup            Master
    ---------            -------
    WORKGROUP            OSMC

smbclient ‘\localhost\BLACKDRIVE’

Still gives:

Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]
tree connect failed: NT_STATUS_CONNECTION_DISCONNECTED