Jump to content

SMB not automounting on boot and subtitles not saving in media folder


Recommended Posts

invader

I’ve been having some issues automounting SMB shares for Emby on boot and now when I download subtitles they aren’t saving in the media folder.

Media location is on my NAS and using SMB. I mount on my Pi using FSTAB entries:
 

//NAS/Movies /home/pi/Movies cifs x-systemd.automount,uid=pi,gid=pi,credentials=/home/pi/cred,iocharset=utf8,vers=3.0,noperm 0 0
//NAS/Series /home/pi/Series cifs x-systemd.automount,uid=pi,gid=pi,credentials=/home/pi/cred,iocharset=utf8,vers=3.0,noperm 0 0

 

I ended up using x-systemd.automount because this originally fixed an issue where it wasn’t mounting on boot. This appeared to work for a while on boot however has stopped. Now when I reboot,

I have to run:

sudo mount -a

This then mounts the FSTAB entries correctly. 


I realise this isn’t an Emby issue but thought someone here might have the same setup and have a solution.

 

The second issue is that Emby appears it doesn’t have write access to these media folders.

When I try download a subtitle the error in the Emby server log is:

Subtitle saving write access denied, falling back to saving subtitles to /var/lib/emby/metadata/library/ee/eed...

If i look at the permissions for the media folders on the pi I get:

ls -l
drwxr-xr-x 2 pi pi        0 Apr 25 17:47 Movies
drwxr-xr-x 2 pi pi        0 Mar 12 11:17 Series

So this does look like the emby account doesn’t have write access. So I created a test folder just to make sure this was the issue.

FSTAB entry:

//NAS/Movies/'Pimpernel'\040Smith\040(1941) /mnt/Pimp cifs x-systemd.automount,uid=emby,gid=emby,credentials=/home/pi/cred,iocharset=utf8,vers=3.0,noperm 0 0

 

Permissions for /mnt/Pimp

drwxr-xr-x 2 emby emby 0 Apr 26 08:45 Pimp

 

Then when I try download subtitles I still get:

2021-04-26 08:45:53.987 Info SubtitleManager: Saving subtitles to /mnt/Pimp/'Pimpernel' Smith (1941) 1080p h264 AAC.en.srt
2021-04-26 08:45:53.996 Info SubtitleManager: Subtitle saving write access denied, falling back to saving subtitles to /var/lib/emby/metadata/library/ee/eedacd87dba35387954da7b24c6be0b6/'Pimpernel' Smith (1941) 1080p h264 AAC.5.en.srt

 

Thanks for your help in advance :)

Link to post
Share on other sites
Luke

Hi, regarding the permissions you might find some helpful tips here:

 

Link to post
Share on other sites
invader

Thanks Luke. I did come across this, the test folder has the emby user as the owner. So it looks right to me.

Link to post
Share on other sites
invader

Hi Luke. Thanks for checking. No I haven’t. It looks to me like an Emby issue. If the Emby account owns the folder, it doesn’t make sense that it doesn’t have write access. I even opened a shell as emby user and created a text file in the folder, so I’m perplexed as to why it fails downloading subtitles and falls back to the metadata folder.

Link to post
Share on other sites
Luke

I don't believe this is an Emby problem. The server is simply trying to save the file, getting an error from your file system, and then acting based on that.

Link to post
Share on other sites
mastrmind11
Posted (edited)

your smb fstab entry has to allow emby, the kernel falls back to the pid/gid in fstab and ignores local permissions on the folder you're trying to mount.  give emby access via the fstab command and you're fine.  if that means adding emby to the pi group then fine, but the right way to do this is to create a group called 'something" that has both pi and emby in it, and use that group in your fstab.  alternatively you can switch to NFS and not worry about this dinosaur of a protocol .

also, there are *tons* of users here using smb, so no, it's not an emby issue.

Edited by mastrmind11
  • Thanks 1
Link to post
Share on other sites
invader
3 hours ago, Luke said:

I don't believe this is an Emby problem. The server is simply trying to save the file, getting an error from your file system, and then acting based on that.

Thanks Luke. I assumed the same thing then I was at a loss when I swear it was working before and it looks like the permissions were fine. 

1 hour ago, mastrmind11 said:

 

your smb fstab entry has to allow emby, the kernel falls back to the pid/gid in fstab and ignores local permissions on the folder you're trying to mount.  give emby access via the fstab command and you're fine.

 

 

See in my additional test entry with one movie. I gave pid:emby gid:emby. 

On 26/04/2021 at 11:25, invader said:

FSTAB entry:

 

 




//NAS/Movies/'Pimpernel'\040Smith\040(1941) /mnt/Pimp cifs x-systemd.automount,uid=emby,gid=emby,credentials=/home/pi/cred,iocharset=utf8,vers=3.0,noperm 0 0


It also doesn’t make sense to me that when I run terminal as Emby I can create files in those mounts.

1 hour ago, mastrmind11 said:

alternatively you can switch to NFS and not worry about this dinosaur of a protocol .

I might do this in parallel. Not getting great read/write performance and from what I’ve read SMB is responsible for waking up my NAS frequently and when nothing really is requesting it. I’d still like to sort out SMB if I can, but I hear what you’re saying RE it being an old standard and relatively unliked in the Linux community.

Link to post
Share on other sites
mastrmind11
Posted (edited)
3 hours ago, invader said:

Thanks Luke. I assumed the same thing then I was at a loss when I swear it was working before and it looks like the permissions were fine. 

 

See in my additional test entry with one movie. I gave pid:emby gid:emby. 


It also doesn’t make sense to me that when I run terminal as Emby I can create files in those mounts.

I might do this in parallel. Not getting great read/write performance and from what I’ve read SMB is responsible for waking up my NAS frequently and when nothing really is requesting it. I’d still like to sort out SMB if I can, but I hear what you’re saying RE it being an old standard and relatively unliked in the Linux community.

just go NFS, you'll never look back.  when you do, just make sure your uid/gid match on client and server and you're set.  post back when you switch.

edit: also, what are the perms on the underlying folder that you mounted in your fstab emby examble.  they don't cascade automatically if they are pre-created.

Edited by mastrmind11
Link to post
Share on other sites
On 05/05/2021 at 11:09, mastrmind11 said:

just go NFS, you'll never look back.  when you do, just make sure your uid/gid match on client and server and you're set.  post back when you switch.

I will do, I've been scared off it a few times, mainly because I use a Windows PC and it's not natively able to do NFS. Or because change is hard! hehe.

Not too hard to install so I'm going to bite the bullet.

On 05/05/2021 at 11:09, mastrmind11 said:

edit: also, what are the perms on the underlying folder that you mounted in your fstab emby examble.  they don't cascade automatically if they are pre-created.

I decided to test /mnt/Pimp instead of a directory inside Pi's home directory. Assuming that /mnt/ would be more likely to be writable by most users. Here are the permissions of the Pimp folder (if that's what you were asking?). 

$ ls -l /mnt/
total 0
drwxr-xr-x 2 emby emby 0 Apr 26 11:15 Pimp


$ ls -l /mnt/Pimp/
total 1903428
-rwxr-xr-x 1 emby emby      46254 Mar 26  2020  clearlogo.png
-rwxr-xr-x 1 emby emby      37641 Mar 26  2020  fanart.jpg
-rwxr-xr-x 1 emby emby      46254 Mar 26  2020  logo.png
-rwxr-xr-x 1 emby emby      13782 Mar 26  2020  movie.nfo
drwxr-xr-x 2 emby emby          0 Apr 26 08:29  New
-rwxr-xr-x 1 emby emby 1948950066 Jun 24  2018 ''\''Pimpernel'\'' Smith (1941) 1080p h264 AAC.mp4'
drwxr-xr-x 2 emby emby          0 Apr 26 07:30  test
-rwxr-xr-x 1 emby emby          7 Apr 26 07:31  test1

So I have a few things I've been thinking about. Before fstab mounts to that directory, I wonder if the folder permissions on the Pimp folder are different. Secondly I made the emby account both the user and group owner. I'm wondering if there even is an emby group on my Pi, in which case maybe this is causing an issue. I checked and there is an emby group so this isn't the issue. Previously I tried to fix this original issue by adding emby user to the pi group, but this didn't seem to make a difference.

Finally, the bit that confuses me the most.

I run terminal as user emby navigate to the test folder and create a file with nano. So if that works, why can't emby create a subtitle file!

$ sudo -u emby bash

$ whoami
emby

$ cd /mnt/Pimp/
$ nano
$ls
 clearlogo.png     fanart.jpg   movie.nfo  ''\''Pimpernel'\'' Smith (1941) 1080p h264 AAC.mp4'   test1
 embycreatedtest   logo.png     New         test

 

Edited by invader
Link to post
Share on other sites
mastrmind11

I honestly believe this to be an issue w/ your SMB fstab entry.  Try changing the uid and gid to their actual values and remount.  type id emby and use those values.  If that doesn't work try adding forceuid,forcegid to your fstab and remount.

Edited by mastrmind11
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...