Jump to content

File permissions again


bric

Recommended Posts

Failure setting up Emby (my first time)

 

I have a hard drive in my 'server' that contains all my media.

It is formatted as NTFS.

I have it mounted from the fstab.

 

listing of files/directories show as ...

-rwxr-xr-x 1 bric bric  110914782 Jun 16 21:11 Finding Dory-trailer.mov
drwxr-xr-x 1 bric bric       4096 Jul 30 15:09 Home Video

I added emby to the group owning the files on that drive. So the groups command returns:

emby: emby bric

 

When I try to add the media library (in the web interface) either with

/path/to/mounted/drive/Movies

or

//192.168.0.10/Movies

or

//MyServer/Movies

 

I get this error:

 

 

There was an error adding the media path. Please ensure the path is valid and the Emby Server process has access to that location.

 

More info needed? Suggestions about what to try next?

Link to comment
Share on other sites

puithove

The permissions on the file and directory you listed are not group writeable.  Add the emby user to the bric group does not help you.  The emby user does not have permission to write.

 

Linux permissions are like:

Owner (User) / group / world (everyone else)

         rwx        /   r-x    /   r-x

 

This means your bric user has read,write,execute - your bric group has read,execute - everyone else has read,execute.

Edited by puithove
Link to comment
Share on other sites

puithove

As for what to do, personally, I'd move the data to a linux filesystem and set the permissions properly.

 

If you have a good reason to leave it as NTFS, you have options to set the permissions on the mount.  You didn't mention how you're mounting it, but if you're using NTFS-3g, here's a doc on it which includes setting the permissions via the mount:  https://wiki.archlinux.org/index.php/NTFS-3G

Link to comment
Share on other sites

On the web admin page (http://localhost:8096/web/library.html) where you add the 'media library' it has a note at the top which says,

For Linux on Arch Linux, CentOS, Debian, Fedora, OpenSuse, or Ubuntu, you must grant the Emby system user at least read access to your storage locations.

 

So I wasn't expecting my permissions to be a problem until I got that error. I have a generally okay understanding of permissions in Linux. But I tried your suggestion and set permissions to 777 in the fstab.

 

Side note: Since the entire drive is media only, the 'problem' of the filesystem being NTFS is a lesser one yes? Although, I confess, even setting it as I originally had it felt a bit 'open'.  However, I agree... I sort of wish I had gone with ext4 or ZFS.  At the time, I wasn't able to predict the number of linux based devices joining the household.

 

After reboot and permissions now showing as drwxrwxrwx (or -rwxrwxrwx) everywhere on that drive I went to add the media library again.

 

And the error message is the same.

 

 

There was an error adding the media path. Please ensure the path is valid and the Emby Server process has access to that location.

 

And then I realized that I'm a big liar! Although, that has been media only for years, I recently moved my home directory to that drive (thinking that then I could reformat/reinstall other o/s flavours at will).  So I uninstalled/reinstalled emby-server (thinking that perhaps config had failed to be written properly). 

 

But no, that makes no difference. (sigh)

 

For completeness I tried:

/path/to/Movies

/path/to/Movies/

//192.168.0.10/Movies

//192.168.0.10/Movies/

smb://192.168.0.10/Movies

smb://192.168.0.10/Movies/

smb://MyServer/movies

smb://MyServer/movies/

 

(incidentally... which one is appropriate?)

 

I have tried this in firefox and chrome (not chromium) with equivalent results.

 

So I'm still at a loss.  And even more of a loss.  The location definitely exists.  The permissions are now wide open.

Edited by bric
Link to comment
Share on other sites

Can you try mounting the shares locally first, then add the mounts to emby?

 

What do you mean by 'mounting the shares locally'?

 

Currently, the files *are* local.  The server on which emby is running also has the drive with the media. The drive is mounted in /etc/fstab to a mount point of /media/drive04/ and on that drive .../Video/Movies/ (for example).  I've tried /media/drive04/Video/Movies/ as the source in emby.

 

I have also mounted specific locally mounted directories (e.g., Movies) as shares in Samba and tried adding those to emby. Was that what you meant?

 

or did the reference to NTFS confuse you? It is an NTFS drive because at one time this was a dual boot system and I was considering permanently moving it to windows...except that I found I didn't like Windows as much when the time came and so now it's only Linux.

 

General info: I've just got plain Ubuntu (16.04) running at the moment though I've considered a variety of other configurations.

Edited by bric
Link to comment
Share on other sites

Currently, the fstab is setting full permissions (777) for everyone on everything.

All files show -rwxrwxrwx.  All directories show drwxrwxrwx.

 

groups emby returns:

emby: emby bric

(where bric is the owner and group associated with the files/dirs via the fstab)

 

So that should allow the emby service user to see them right?

Link to comment
Share on other sites

For interest, I put 'emby' as the owner and group (in fstab) so now I see (for example)...

drwxrwxrwx 1 emby emby   4096 Sep 21 15:25 .wine
-rwxrwxrwx 1 emby emby     99 Oct 29 12:11 .Xauthority

however, I still get the error:

There was an error adding the media path. Please ensure the path is valid and the Emby Server process has access to that location.
Link to comment
Share on other sites

Hi @bric,

 

Are you having issue with the path substitute? If so use back splashes and it should work.

 

Give that a go.

 

I can see you your first post you are using forward slashes.

 

Regards

Edited by Servman
Link to comment
Share on other sites

Though I was momentarily hopeful, it was not to be. The slashes are standard for Linux as compared to the backslash in Windows. Thanks for the suggestion.

If only it were that simple... :(

 

I'm going to stare at the logs a bit later and see if that sheds any light.

Link to comment
Share on other sites

Hi @@bric,

 

I run a ubuntu server 16.04 and when i have added my folders i have given emby full read,write and execution rights

 

And see below

 

/RAID/Media/Movies

And for path substitute

\\192.168.1.100\Media\Movies

Edited by Servman
Link to comment
Share on other sites

puithove

I see you said it's mounted at /media/drive04/  The emby user would need at least read & execute access to all of the parent dirs from the root all the way to where it's mounted.  If it doesn't have access to any of the parents, it won't have access to the child.

 

Maybe restart emby, generate the error, stop emby, and post the server log.

 

Then show us 'ls -l' at each of the parent dirs down to where it's mounted.  So like

ls -l /

ls -l /media

ls -l /media/drive04

Edited by puithove
Link to comment
Share on other sites

I see you said it's mounted at /media/drive04/  The emby user would need at least read & execute access to all of the parent dirs from the root all the way to where it's mounted.  If it doesn't have access to any of the parents, it won't have access to the child.

 

Ha! If that's the problem then I can tell you right now that /media belongs to root. It was created by ubuntu and I believe has been automounting things there and I just stuck my drive into there without much thought.

 

I may have to rethink the mounting point and give it another try. Perhaps you've given me the clue...

... however, coming back to edit: are you sure? That seems wrong to me. I'll go do some reading.

 

And, if it were a samba share then emby would only have access to the shared drive.  And as long as it had the right permissions on the share it would work, right?

Edited by bric
Link to comment
Share on other sites

Then show us 'ls -l' at each of the parent dirs down to where it's mounted.  So like

ls -l /

ls -l /media

ls -l /media/drive04

 

Edited for brevity the results are...

 

ls -l /:

drwxr-xr-x  23 root root     4096 Oct 27 10:46 lib
drwxr-xr-x   2 root root     4096 Oct 27 10:46 lib64
drwx------   2 root root    16384 May 17 10:29 lost+found
drwxr-xr-x   4 root root     4096 May 17 11:18 media

ls -l /media:

drwxrwxrwx  1 emby emby 4096 Oct 26 15:02 drive04

ls -l /media/drive04:

drwxrwxrwx 1 emby emby 282624 Oct 26 15:02 Calibre Library
drwxrwxrwx 1 emby emby      0 Sep 29 09:54 home
drwxrwxrwx 1 emby emby  20480 Jun 28 21:56 Music
drwxrwxrwx 1 emby emby  12288 Oct  7 11:16 Pictures
drwxrwxrwx 1 emby emby 110592 Oct 29 12:19 Video

edit: previously, as described in previous posts, instead of 'emby' the user and group for drive04 and subdirectories was 'bric' (of which I made emby a member). In the latest testing, I changed permissions in fstab to reflect 'emby' as owner and group.

Edited by bric
Link to comment
Share on other sites

puithove

No, that all looks fine.  Now that you've got all that done, I'm not so sure it's permissions.  Maybe post a server log - it might have some clues.

 

Also, as a test, create a dir and place at least one media file in a location accessible by the emby user in the linux filesystem (get away from the whole FUSE / NTFS stuff) and then add that as a library in Emby.  If that works, I'd encourage you again to get your stuff migrated over.

Link to comment
Share on other sites

Good suggestion for a test. Emby does work with a source on my ext4 formatted drive, but still don't know why it won't work with the NTFS drive:

 

I created a new directory in /home:

 

sudo mkdir embytest

 

adjusted the ownership:

 

sudo chown emby:emby embytest

 

had copy a file with sudo since I'm not logged in as emby:

sudo /media/drive04/Video/big_buck_bunny_720p_stereo.avi .

then
chown emby:emby big_buck_bunny_720p_stereo.avi

 

Then went to the web admin and added '/home/embytest' as a 'media library'.

 

No problem! It works!

 

from /home/embytest

ls -al

total 277808
drwxr-xr-x 2 emby emby      4096 Oct 30 07:13 .
drwxr-xr-x 3 root root      4096 Oct 30 06:57 ..
-rwxr-xr-x 1 emby emby 284437944 Oct 30 07:10 big_buck_bunny_720p_stereo.avi
-rw-rw-r-- 1 emby emby      1145 Oct 30 07:13 big_buck_bunny_720p_stereo.nfo
-rw-rw-r-- 1 emby emby     23229 Oct 30 07:13 poster.jpg

Emby is downloading metadata as specified. I would cheer except because my drive sizes don't allow for easy reformatting unless I pick up a new drive.  Something in the NTFS drive is not playing nice with the way Emby is asking permission

 

Certainly it doesn't seem to be any sort of problem with my emby install itself, so that's good anyway. I might have to seek elsewhere for an expert on NTFS permissions or bite the bullet on a new HD purchase.

Edited by bric
Link to comment
Share on other sites

puithove

Yea, in theory, it should work, but it's definitely not ideal.  Post a server log with the steps I mentioned above and see what kind of error it's throwing.

 

You can also convert that drive with the data on it.  It'd be a process of shrinking NTFS, create EXT4 filesystem (or other) in the empty space, move files, shrink ntfs, expand EXT4, move files, rinse & repeat.  There's even tools out there that take care of the heavy lifting for you.

Link to comment
Share on other sites

Ha, actually it might be ideal if I was forced to buy another HD: forced backup.

However, since I'm not made of money, I'll consider the resize and shuffle, or dig through my old hard drive collection and see what they add up to.

 

In the meantime: the logs.

 

# After clicking the 'add media button' this is written to the log (nothing of interest yet but for completeness)

http://pastebin.com/raw/Md1380AJ

 

# Then, type the directory path and press enter (the errors begin)

http://pastebin.com/raw/kjeVku8f

to quote a bit:

2016-10-29 22:07:19.3606 Error ServiceStackHost: ServiceBase<TRequest>::Service Exception
	*** Error Report ***
	Version: 3.0.8300.0
	Command line: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh
	Operating system: Unix 4.4.0.45
	Processor count: 2
	64-Bit OS: True
	64-Bit Process: True
	Program data path: /var/lib/emby-server
	Mono: 4.4.2 (Stable 4.4.2.11/f72fe45 Tue Aug 30 16:43:57 UTC 2016)
	Application Path: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
	Access to the path "/media/drive04/Video/Movies" is denied.
	System.UnauthorizedAccessException
	  at ...

No access even with a directory listing showing  (as previously established) something like:

-rwxrwxrwx   emby emby   filename.mkv

 

# Then, after clicking the add button

http://pastebin.com/raw/RXgLiJAa

excerpt:

2016-10-29 22:10:39.1396 Error ServiceStackHost: ServiceBase<TRequest>::Service Exception
	*** Error Report ***
	Version: 3.0.8300.0
	Command line: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh
	Operating system: Unix 4.4.0.45
	Processor count: 2
	64-Bit OS: True
	64-Bit Process: True
	Program data path: /var/lib/emby-server
	Mono: 4.4.2 (Stable 4.4.2.11/f72fe45 Tue Aug 30 16:43:57 UTC 2016)
	Application Path: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
	The specified path does not exist: /media/drive04/Video/Movies/.
	System.ArgumentException
	  at MediaBrowser.Server.Implementations.Library.LibraryManager.AddVirtualFolder (System.String name, System.String collectionType, MediaBrowser.Model.Configuration.LibraryOptions options, Boolean refreshLibrary) <0x41081b80 + 0x00543> in <filename unknown>:0
	  at...

And obviously the specified path does exist, even though it can't see it. I can copy it directly out of the log and 'cd' to it or drop it into nautilus.

 

Strange.

Link to comment
Share on other sites

puithove

Definitely something strange going on.  I'd say related to FUSE probably, but I've never really played with it much.

 

Anyway, the only other thing I have to add, is:

  • Better if you post the full server log instead of snippets.  Restart the server so it creates a fresh log, generate the issue, stop server and post full log.
  • Instead of typing in the path, browse to it from the root and then it'll tell you exactly where it starts to have an issue (my theory is going to be as soon as you enter the mount).

If you're going to stick with Emby on linux long term, better to move to a linux filesystem sooner rather than later - the longer you go, the more "stuff" you'll accumulate and the transition will get more difficult.

Link to comment
Share on other sites

Thank you (and everyone) for the help. I'm going to buy another drive, as a backup would be a good idea anyway and will save us all further time.

 

That was the full server log (I had deleted the logs prior to testing, so that I could easily find what was going on, so that's all there was).  The pastebin links have the full log broken into three segments.

 

I was unable to browse to the path once I hit the NTFS drive (??!) but as we determined, it seems like it should have worked.

 

I've had this computer running on ubuntu since 2009.  This hard drive was added somewhere between then and now, around the time that I bought a copy of Win 8, thinking that I might try out plex or something.  I had been using mythtv and plex didn't appeal so win8 languished and the drive had already been formatted ntfs.  Files accumulated. Time passed.

I tried out kodi and liked it.  My video capture card died and I didn't bother replacing it ... had gone ota hdtv and didn't watch much from that source anyway. Set up vpn on router and thought about sharing out video to laptop over vpn.  Been considering smart home and multiple video sources throughout the house.  A media server has begun to make more sense.  Tried Kodi and set up SQL.  Slooowwww loading up my collection.  I didn't even bother finishing before looking for options and came across emby.  And here I am.

 

I'm going to get myself another drive.  I have an old one of half the size that's I've connected and set up as a zfs pool and I'm testing with it now.  Once I have another drive in the pool and enough space, I'll move stuff over and reformat.  I'm a bit leery about resizing active partitions.

 

Thanks again for all the help.

  • Like 1
Link to comment
Share on other sites

  • 8 months later...
fbm224

Hi there, 

 

I was having the same issue, this may help you: 

With the Disks utility, on the partition properties, mounting options, switch the automatic mounting options, and select mount on startup. Then after reboot try adding again the ntfs folder, but keep in mind that it is mounted now on /mnt/ instead of /media/user/ 

 

Hope this helps you or someone else   :)

Edited by fbm224
  • Like 1
Link to comment
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...