Updated OSMC from 2018 to latest, lost my shared drive

#1

I have used OSMC for several years and the last time I updated the system was about a year ago.
So now I thought I should let it run an update again.

After the update was finished I have lost my media drive!
It is a USB connected 1TB NTFS formatted hard drive containing all of the media I use.
Previously it was visible on the network (samba shared) and I could copy in the videos I want to view, but now the drive is not visible from my Windows 7 PC or my Linux server anymore.

And within KODI I used to be able to browse to Files and select the media drive and then navigate to the files to view.
This is all gone now, no media drive visible and the NAS drive I had attached to KODI as another media drive is not visible in the KODI interface either…

So all in all I am stuck with a broken system it looks like.
What can I do to:

  1. Get back my shared media drive on line with network access
  2. Make the media drive visible from within KODI when navigating Videos/Files
#2

I think the problem is solved.
I had to go in using PuTTY to a command prompt and issue “sudo reboot”.
After the restart my media drive was recognized again and shared as before on the network.
So the bottom line is that following an update one has to run a hard restart.

#3

I’m not sure that’s the case. A reboot isn’t a cold boot by any measure.

You may have exposed a race condition however, but it’s hard to speculate without logs.

Sam

#4

And I talked too early…
I need the publication of the video drive to my Smart TV, and it did not list anytrhing even when the USB drive was available inside KODI itself.
Since rpi2-osmc (the name of the OSMC box) was not listed on the TV I looked at the services and found that Upnp was not enabled. So I enabled the service and set it to share the libraries. I also rebooted the RPi.
Now what happened is:

  • On the TV rpi2-osmc appeared and could be selected and inside the video library section I found the NAS drive OSMC is connected to via the network (samba share). And it worked to play from that. But the internal USB drive was not shown in the list.
  • On KODI itself the USB media drive has also disappeared!
  • Finally when I check the network from my Win7 and Linux boxes it appears that the shared drive on the OSMC box has disappeared!

I have now tried to revert the changes I did (disabling UPnP again) and rebooted the box (I even pulled the power line on it).
But no luck! It seems like now the USB drive is permanently missing!
So now it is no longer possible to view the videos on the media drive even from KODI…
What can I do now?

I have checked that the USB drive itself is not broken. It works fine when moved to my Win7 laptop.

#5

To get a better understanding of the problem you are experiencing we need more information from you. The best way to get this information is for you to upload logs that demonstrate your problem. You can learn more about how to submit a useful support request here.

Depending on the used skin you have to set the settings-level to standard or higher, in summary:

  • enable debug logging at settings->system->logging

  • reboot the OSMC device

  • reproduce the issue

  • upload the log set either using the Log Uploader method within the My OSMC menu in the GUI or the ssh method invoking command grab-logs -A

  • publish the provided URL from the log set upload, here

Thanks for your understanding. We hope that we can help you get up and running again shortly.

OSMC skin screenshot:

#6

I have tried to get things working on the OSMC box all day and I could manually mount the USB drive and then things styarted work but when I reboot I get back to the situation where the USB drive is not working.
Here is the URL to the logs after a restart: https://paste.osmc.tv/jujihofidi

I guess that I need something like this in /etc/fstab:

UUID=EE78237678233D29 /mnt/mediadrive ntfs defaults,auto,umask=000,uid=1000,gid=1000,rw,nofail 0 0

but reading posts on the net made me hesitant to put it there since if an error is made apparently the RPi would be bricked…

#7

Generally it would not be absolutely necessary to use fstab entry as OSMC normally does an automount.
But looking at your logs seems that something is not working there. can you post output:
fdisk -l /dev/sda | paste-log
blkid /dev/sda1 | paste-log
ntfslabel /dev/sda1 | paste-log

#8

osmc@rpi2-osmc:~$ fdisk -l /dev/sda | paste-log https://paste.osmc.tv/sokusawuta osmc@rpi2-osmc:~$ blkid /dev/sda1 | paste-log https://paste.osmc.tv/ucupihokex osmc@rpi2-osmc:~$ ntfslabel /dev/sda1 | paste-log Access is denied because the NTFS volume is already exclusively opened. The volume may be already mounted, or another software may use it which could be identified for example by the help of the 'fuser' command. You can use force option to avoid this check, but this is not recommended and may lead to data corruption. https://paste.osmc.tv/ubekenefiq

Note that I have manually entered a mount command in order to check out the UPnP functionality, and it does work on the LG TV.

sudo mount /dev/sda1 /mnt/mediadrive

However I cannot get the samba share working…
Nor does it mount on reboot (but I have not entered any active line into fstab yet, my proposal is in the log)

#9

Could this be the same root cause as this: Only some fstab shares being mounted on boot?

Funny, because there have been no relevant kernel tweaks AFAIK between December and now but there will have been a few in the last year.

#10

This could indicate either that it somehow at that moment was mounted or that there is an issue with the filesystem.

You would need to restart samba after manually mounting it.
But if you want to go down that path suggest to do it via fstab.
But still questionable why the partition is not automounted.

#11

I am a bit further now!
I enabled this line in /etc/fstab:

UUID=EE78237678233D29 /mnt/mediadrive ntfs defaults,auto,umask=000,uid=1000,gid=1000,rw,nofail 0 0

Then rebooted and now the media drive is functional and visible via UPnP on my TV. :slight_smile:

However, while waiting for the boot I noticed that there were error messages concerning smb, so I have made another log and uploaded to https://paste.osmc.tv/sovometona

Here is the smb.conf file, except WORKGROUP is another name:
[global]
config file = /etc/samba/smb-local.conf

    workgroup = WORKGROUP
    security=user
    follow symlinks = yes
    wide links = no
    unix extensions = no
    lock directory = /var/cache/samba
    load printers = no
    printing = bsd
    printcap name = /dev/null
    disable spoolss = yes
    log level = 1
    map to guest = bad user
    read raw = Yes
    write raw = Yes
    strict locking = no
    min receivefile size = 16384
    use sendfile = true
    aio read size = 2048
    aio write size = 2048
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

[osmc]
    browsable = yes
    read only = no
    valid users = osmc
    path = /home/osmc
    comment = OSMC Home Directory
	
[mediadrive]
    browseable = yes
    read only = no
    valid users = osmc
    path = /mnt/mediadrive
    comment = Media root Directory

[automount template]
    browseable = yes
    -valid = no
    valid users = osmc
    path = %P
    hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/

include = /etc/samba/smb-shares.conf

Both smb-shares.conf and smb-local.conf are non-existent

If I manually issue:
systemctl restart smbd nmbd
then samba starts…

#12

UPDATE:
I made the change that I renamed the smb-shares.conf and smb-local.conf in /etc/samba/ by adding .disabled at the end of their names. Contrary to what I believed the files contained commands.
Now samba starts as it should on reboot!
But I need to make a backup copy of smb.conf and fstab since OSMC updates seem to replace these files with stock versions.
Seems like it is working now.

#13

Follow the instructions in smb.conf: copy it to smb-local.conf which won’t be overwritten and make your changes there. Works for me.

AFAIK, fstab is not overwritten.

#14

Does this mean commenting out all content in smb.conf except the references to the two sub-files?
If not then there will be conflicting settings, which I think were the cause of the startup errors until I renamed the files.

Stream video from OSMC on RPi to Smart TV (LG)
#15

I believe smb-local.conf replaces everything in smb.conf after the config file = line.

#16

So if I make smb.conf look like this (erasing everything else in the process):

[global]
    config file = /etc/samba/smb-local.conf
include = /etc/samba/smb-shares.conf

And then I have everything except the share definitions in smb-local.conf and the shares in smb-shares.conf it will work as before with the exception that any system update will NOT touch samba config?

Effectively doing this:

cd /etc/samba
sudo mv smb.conf smb-local.conf
sudo echo "[global]" > smb.conf
sudo echo "config file = /etc/samba/smb-local.conf" >> smb.conf
sudo echo "include = /etc/samba/smb-shares.conf" >> smb.conf

Then put the share definitions inside smb-shares.conf

Or do I have to put the include into the smb-local.conf rather than in smb.conf?

I cannot test now because I am away, will get back tomorrow.

#17

Well based on the instructions in smb.conf you should just have:
sudo cp smb.conf smb-local.conf
sudo nano smb-local.conf
And remove config file = /etc/samba/smb-local.conf from that file and do the other changes you want to do.

From the manual
There is a chicken and egg problem here as this option is set in the config file! For this reason, if the name of the config file has changed when the parameters are loaded then it will reload them from the new config file.

https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html

#18

Thanks for the explanation, now it all makes sense.
I have enabled smb-local.conf and put all I need into that file.
No use of smb-shares.conf anymore.

After a restart of samba:

systemctl restart smbd nmbd

the shares work as expected.
Now I will proceed to duplicating my OSMC media center on a RPi3B+ (the current is on RPi2B)