Jump to content

Linux noob help with setting up NAS access


Recommended Posts

mark-in-dallas
Posted (edited)

I'm not completely new to Linux and have been running Centos servers with WHM for web servers for years and am fairly comfortable working in SSH, but I am a brand spanking noob when it come to Linux for desktops.

 

I've looked through all of the threads in the Emby Linux forum, as well as the linuxmint forums and a couple of others, but I am still at a loss.

 

I've just installed Linux Mint 19.3 and have spent days trying  to figure out how to record to a NAS drive.  I am able to access all media stored on the NAS (WD DL2100) in Emby, but have tried everything I could find to get Emby to record to the NAS, without success.

 

The recording folder is located at:  192.168.1.9/mnt/HD/HD_2/tv  I do have that directory set with anonymous read/write access (777).

 

If I use smb://192.168.1.9/tv as the recording path, Emby does see all media in the folder, but will not record to it.

 

I have also tried using nfs://192.168.1.9/nfs/tv, which did not work and all my recording disappeared from the recording tab.

 

I tried //192.168.1.9/tv and got the same results as with nfs

 

I have Samba and Gigolo installed, and have edited my fstab to include:  //192.168.1.9/mnt/HD/HD_a2/tv cifs username=username,password=password,iocharset=utf8,uid=emby,gid=emby,file_mode=0770,dir_mode=0770,vers=3.0,_netdev,nofail    with a username and password that does have access to the NAS, although the shares are set for anonymous access anyway.

 

If I open Nemo and click on Networks it does see the NAS, but when clicking on it I get an error message indicating:  Unable to mount location .  Could not connect to NAS.local connection refused

 

But, I can access the NAS by using the connect to server function in Nemo and creating a new connection..  

 

 

I have attached a server log showing errors for recordings attempted using both nfs and smb protocols,  I believe that the error messages start at line 1079 for the nfs attempt and line 1585 for the smb attempt.

 

If anyone can help me get this working I would greatly appreciate it

 

embyserver.txt

Edited by mark-in-dallas
mark-in-dallas
Posted (edited)

I did,  but it doesn't really apply because I am trying to write files to an external NAS, and the directories used for Emby all have read/write access to all.  I am able to write to them from Emby on a Windows Emby install, just not on the Linux install.

Edited by mark-in-dallas
mastrmind11
Posted

for SMB, uid and gid need to be ids, not names.  Type "id emby" on the command line and use those values in the mount.

 

For NFS shares, the uid and gids need to be the same on both machines for whichever user will be accessing the shares.  So create an emby user on thje server hosting the nfs share and set the uid and gid to match the uid and gid for emby on the client.

mark-in-dallas
Posted

for SMB, uid and gid need to be ids, not names.  Type "id emby" on the command line and use those values in the mount.

 

Thank you!  That helped somewhat and I can now access, write to and delete on the NAS from Nemo, but Emby is still not able to record to it or delete any existing media.  The Directories used for Emby on the NAS all have full read/write access and I am able to write to them from a Windows Emby Server, and I can delete media from a windows machine logged into the Linux Emby Server in a browser, so I'm thinking that it must be a permissions issue, but I don't know how to resolve it.

mastrmind11
Posted

ok, before we get into this, , if you ssh to your linux server are you able to touch files on your nas as emby?  as in "sudo -u emby" and go try to create a file on your share?  if not, then it's a permission issue.  are you running the emby server as user emby?  so many moving parts so lets try to isolate stuff one step at a time.

 

your NAS is linux, and your server is linux, correct?  do you have any need for SMB in the first place?  It would be nice to remove SMB from the equation if it's not something you need, since it sucks and NFS is much better.  

mark-in-dallas
Posted (edited)

Okay, initially I was not able to login to SSH.  Call me stupid but I just assumed the Linux Mint  distro would include OpenSSH, but apparently not.  After installing OpenSSH I was able to SSH in to the Linux server with my username (mark), and I attempted to change to the emby user account, but I don't think it took.  After entering sudo -u emby, this was the response:

 

mark@Media-PC:~$ sudo -u emby
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
            [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
            prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
            prompt] [-T timeout] [-u user] file ...
mark@Media-PC:~$
 
I am logging in to the Linux Server as "mark"  I looked for emby under users but it is not listed, which is odd because entering id emby in the shell produces this result:    uid=999(emby) gid=999(emby) groups=999(emby),44(video)  and adding that uid and gid to the fstab allowed me to access the NAS from Nemo.  I am able to add and delete files on the NAS in Nemo, but that is while logged in as "mark"
 
I am happy to use nfs instead of smb, but I could not get any media to display in the recordings tab when I tried the nfs protocol.
 
I am the only person who will be accessing this machine, so I also added the 2 lines below to the sudoers file thinking that should clear up any permission issues, but it did not.
 
username ALL=(ALL) ALL
%wheel ALL=(ALL) ALL
Edited by mark-in-dallas
mastrmind11
Posted (edited)

sorry i left out the shell.  "sudo -u emby bash" then try to touch something on the share.  who you ssh as has no effect on what you're doing once you are on the server, so ignore that bit of info.  better yet, "ls -l /share" so at least we can see wtf is happening with your permissions.  

 

i also have no clue wtf Nemo is, nor does emby, so lets not conflate troubleshooting with that going forward.

Edited by mastrmind11
mark-in-dallas
Posted (edited)

The ls -l/share did not work for me, but I navigated to the directory containing the shares and here is the output:

 

login as: mark
mark@192.168.1.4's password:
Last login: Wed Mar 11 16:56:18 2020 from 192.168.1.2
mark@Media-PC:~$ sudo -u emby bash
emby@Media-PC:~$ ssh sshd@192.168.1.9
sshd@192.168.1.9's password:
 
 
BusyBox v1.20.2 (2019-07-04 10:39:50 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
 
root@@nas root # cd ..
root@@nas /home # cd ..
root@@nas / # cd /mnt/HD/HD_a2
root@@nas HD_a2 # ls
Documents   Movies      Nas_Prog    emby        mark        tv
Mashups     Music       Public      lost+found  plex_conf
root@@nas HD_a2 # ls -l
drwxrwxrwx    5 root     root          4096 Mar  6 11:34 Documents
drwxrwxrwx    3 root     root          4096 Mar  6 11:34 Mashups
drwxrwxrwx    4 root     root          8192 Mar  6 11:34 Movies
drwxrwxrwx    2 root     root        446464 Mar  6 11:34 Music
drwxrwxrwx   10 root     root          4096 Mar  2 07:11 Nas_Prog
drwxrwxrwx    5 root     root          4096 Mar  6 11:34 Public
drwxr-xr-x   16 root     root          4096 Jan 26 08:21 emby
drwx------    2 root     root         16384 May  4  2018 lost+found
drwxrwxrwx    2 root     root          4096 Oct 31 15:04 mark
lrwxrwxrwx    1 root     root            32 May  4  2018 plex_conf -> /mnt/HD/HD_a2/Nas_Prog/plex_conf
drwxrwxrwx   11 root     root          4096 Mar 11 14:21 tv
root@@nas HD_a2 #
 
I then created a directory and a file within it:
 
root@@nas tv # mkdir touch_test
root@@nas tv # ls
18374ce9-dfb4-40d3-9788-c734bf01767e  Scare Tactics
7b722bc6-d7ea-498f-a7e4-8707ee8dd7d4  Scare Tactics (2003)
7c26e447-5932-4b0d-8887-b8394eb5b75d  Siren
Ancient Aliens  Declassified (2017)   The Bold Type (2017)
Ancient Aliens (2009)                 b65ff4fe-5d02-4da8-9088-f45db9603854
Better Things (2016)                  f8f2c80d-2af4-4372-8122-fcfed773ba7d
Dare Me (2019)                        touch_test
Pawn Stars (2009)
root@@nas tv # cd touch_test
root@@nas touch_test # touch touch_file
root@@nas touch_test # ls
touch_file
root@@nas touch_test #
 
I believe that the emby directory is from an old Emby Server install on the NAS DL2100. which I've stopped using because I was having issues with it.
 
I also tried the sudo -u emby bash once in the NAS, but that gave me a bash-4.2$ prompt and I was not able to do anything more until I exited out.
Edited by mark-in-dallas
mastrmind11
Posted

the /share part was meant to represent the name of your shared folder(s).  anyway, your permissions are a mess. 

 

This appears to be your NAS, we need to examine what this stuff looks like on your emby server that has your nas drives mounted.  Do the steps above on your emby server.

mark-in-dallas
Posted

mastermind11, I'm really appreciate your help, and I'm sorry but I'm stuck.   I've been trying to get to the share permissions but cannot seem to get there.  I've tried editing the fstab and mounting the share, and can mount and see it in the GUI, but cannot seem to mount it to a point that I can access it in SSH.  I've tried mapping the location in fstab a number of ways, but none seem to work quite right and when I try to mount it I either get a directory not found in fstab error or require a root password to commit.

 

I somehow managed to create a visible Emby share in the home directory and under Network in the front end file explorer but in the home directory it is empty and under Netowork when clicking on it I get a message saying: 

 

Unable to mount Emby

mount:/ home/mark/Emby Operation permitted for root only

 

This is what I've tried in my fstab, and I'm hoping maybe you can tell me what I'm doing wrong or missing?

 

#//192.168.1.9/mnt/HD/HD_a2/tv /home/mark/Emby  nfs  uid=999,gid=999,iocharset=utf8,file_mode=0770,dir_mode=0770,vers=3.0,_netdev$
//192.168.1.9/mnt/HD/HD_a2/tv  /home/mark/Emby  cifs  rsize=8192,wsize=8192,timeo=14,intr
#//192.168.1.9/mnt/HD/HD_a2/tv  /home/mark/Emby  nfs  uid=999,gid=999,iocharset=utf8,file_mode=0770,dir_mode=0770,vers=3.0,_netde$
 
If I try to mount the share as nfs, I get this error:  mount.nfs: remote share not in 'host:dir' format
mastrmind11
Posted (edited)

 

mastermind11, I'm really appreciate your help, and I'm sorry but I'm stuck.   I've been trying to get to the share permissions but cannot seem to get there.  I've tried editing the fstab and mounting the share, and can mount and see it in the GUI, but cannot seem to mount it to a point that I can access it in SSH.  I've tried mapping the location in fstab a number of ways, but none seem to work quite right and when I try to mount it I either get a directory not found in fstab error or require a root password to commit.

 

I somehow managed to create a visible Emby share in the home directory and under Network in the front end file explorer but in the home directory it is empty and under Netowork when clicking on it I get a message saying: 

 

Unable to mount Emby

mount:/ home/mark/Emby Operation permitted for root only

 

This is what I've tried in my fstab, and I'm hoping maybe you can tell me what I'm doing wrong or missing?

 

#//192.168.1.9/mnt/HD/HD_a2/tv /home/mark/Emby  nfs  uid=999,gid=999,iocharset=utf8,file_mode=0770,dir_mode=0770,vers=3.0,_netdev$
//192.168.1.9/mnt/HD/HD_a2/tv  /home/mark/Emby  cifs  rsize=8192,wsize=8192,timeo=14,intr
#//192.168.1.9/mnt/HD/HD_a2/tv  /home/mark/Emby  nfs  uid=999,gid=999,iocharset=utf8,file_mode=0770,dir_mode=0770,vers=3.0,_netde$
 
If I try to mount the share as nfs, I get this error:  mount.nfs: remote share not in 'host:dir' format

 

Visible mount how?  Like, how did you do it?  If its visible to Emby, how did you create it and what are its permissions?  Your issue is your entire filesystem is root. From which box are you doing this stuff?  Basically, from what I glean from your pasted output, all your stuff is root:root.  That's a problem because even if you chmod to 777, root is special (for good reason).  You need to figure out how to get your mount points to not be root:root, which would generally be a sudo chown something:something (not literally, pick an owner and group that makes sense).  As a simple test, instead of mucking around with fstab, just use the "mount" command, then test reading/writing from the mount.  If you can't do it via the mount command, fstab certainly won't be able to.  

 

For NFS, whoever owns the drives on your share has to be the one accessing it from the client.  So if mark owns the share on your nas, that same user has to be available and have the proper r/w permissions on the client.  They also have to have the same uid/gid.  If that's not the case (and it isn't based on the fact that root:root owns everything everywhere), it's not going to work.  You can set the uid/gid in the fstab command like you tried, but those values need to match between both the client and the server, ie, 999:999 has to exist on both machines, and have the same access.

 

Bottom line, I have no idea how you got yourself into this mess w/ permissions, but until you can mount stuff as *not* root, you're going to fail.

 

Try sharing a basic folder you create on your nas *as a non-root user*, then heading to the client and mounting that folder *as a non-root user*.  See if you can see it and play with it.

Edited by mastrmind11
mark-in-dallas
Posted

Thank you for all of your time and help, I truly appreciate it!  I think what I'm going to do is start from scratch with a fresh Linux install, but this time on a new system and using a local hard drive rather than the external NAS,  I've been thinking its time to upgrade that box anyway, as the hardware is probably more than 10 years old, with the exception of an SSD that I pulled from another box that I updated.

mastrmind11
Posted

Thank you for all of your time and help, I truly appreciate it!  I think what I'm going to do is start from scratch with a fresh Linux install, but this time on a new system and using a local hard drive rather than the external NAS,  I've been thinking its time to upgrade that box anyway, as the hardware is probably more than 10 years old, with the exception of an SSD that I pulled from another box that I updated.

Sure, that will probably make it easier to support, but you're still gonna need to set up sharing for the NAS.  That's not going to go away assuming you plan to grow your library (or have a pre-existing one).  Anyway, find a nice guide online and follow it.  General rule of thumb, if everything is root, you messed up somewhere.

 

Also, since you're planning to start fresh, give everything their own user on your server (emby, whatever, whatever) so you can later distinguish what is actually fucking up.

 

Once you're set up, come back and we can start again.  GL!

mark-in-dallas
Posted

Hopefully the second time around I can get it right from the start.  I don't know how everything got root ownership, but I did give myself root privileges, or so I thought anyway. 

 

If I go with local hard drives I really have no need for the NAS.  I had been using it for files backups and media storage, but I don't rally have a huge library and don't intended to get there, and I have other backup measures in place, so I'll really not have a need for the NAS anymore

mastrmind11
Posted (edited)

Hopefully the second time around I can get it right from the start.  I don't know how everything got root ownership, but I did give myself root privileges, or so I thought anyway. 

 

If I go with local hard drives I really have no need for the NAS.  I had been using it for files backups and media storage, but I don't rally have a huge library and don't intended to get there, and I have other backup measures in place, so I'll really not have a need for the NAS anymore

cool.  when you first set up the OS it'll ask you to create a user and a password.  you never have to explicitly do anything as the formal root user because you can always sudo a command, which will prompt you for the password you created at first install (the os assumes the person installing it is the defacto admin, so the password for sudo will serve as root without actually being "root").  don't get fancy, especially if you have no idea what you're doing.  tweaking stuff post install is easy, trying to fix a massive fuckup after the fact is pretty hard (as you've experienced).  GL

Edited by mastrmind11
mark-in-dallas
Posted

I did know that but I thought that if I gave myself root privileges I would stop getting password prompts every time I tried to install or update anything, I was wrong.  Then I found the sudoers file and disabling password prompts there helped a lot, but not entirely.

 

So, I've got a new HDD on the way, and picked up a used but newer motherboard and CPU combo, so I'll probably give it another shot starting fresh next week.

mark-in-dallas
Posted (edited)

Okay, so I got my newer system setup but wasn't at all happy with it, so that got boxed up to be returned and I got new equipment, then spent yesterday afternoon putting it together and getting everything configured, mounted and permissions set, and all seems to be working perfect!

 

I did find myself in emergency mode at one point, but that was because I'd accidentally used a partition id instead of the uuid when mounting the storage drive in fstab, and was a quick and easy fix.  The drive was initially showing as root/root and wouldn't let me do anything with it, but it was easy enough to chown to root/mark

 

I'm kinda loving Linux and it having drivers baked into the kernel, and not getting complaints about new hardware or having license keys invalidated.

 

Thanks again for all your help mastermind11, if you had not been around I'd have probably given up on it and stuck with Windows.

Edited by mark-in-dallas
  • Like 1
mastrmind11
Posted

Okay, so I got my newer system setup but wasn't at all happy with it, so that got boxed up to be returned and I got new equipment, then spent yesterday afternoon putting it together and getting everything configured, mounted and permissions set, and all seems to be working perfect!

 

I did find myself in emergency mode at one point, but that was because I'd accidentally used a partition id instead of the uuid when mounting the storage drive in fstab, and was a quick and easy fix.  The drive was initially showing as root/root and wouldn't let me do anything with it, but it was easy enough to chown to root/mark

 

I'm kinda loving Linux and it having drivers baked into the kernel, and not getting complaints about new hardware or having license keys invalidated.

 

Thanks again for all you help mastermind11, if you had not been around I'd have probably given up on it and stuck with Windows.

awesome, glad you got it sorted out.  enjoy.

  • Like 1

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...