LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-01-2015, 03:55 PM   #1
AdiLQ123
Member
 
Registered: Oct 2011
Posts: 52

Rep: Reputation: Disabled
Not able to mount NAS on startup using cifs


Hi,

I can mount my Synology NAS using the below command:

Code:
sudo mount -t cifs //192.168.0.7/NetBackup /mnt/SynologyNAS -o username=XXXXXX,password=XXXXXX
But when I add the below to fstab in order to mount the drive automatically on startup, the drive is not mounted:

Code:
//192.168.0.7/NetBackup /mnt/SynologyNAS cifs username=XXXXXX,password=XXXXXX 0 0
Any suggestions on how I can figure out what the problem is?
 
Old 10-01-2015, 05:12 PM   #2
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
How is your IP address handled? I ran into issues in the past if I didn't have it handled directly with rc.inet1 (instead of wicd, at the time), because the network would get started too late and the initial mount would fail.

Have you tried running a mount -a after you're booted and connected to the network to see if it fails there? It would help narrow down if it's something with the fstab or something with the boot process.
 
1 members found this post helpful.
Old 10-02-2015, 12:02 AM   #3
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,105

Rep: Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178
Quote:
Originally Posted by AdiLQ123 View Post
Hi,

I can mount my Synology NAS using the below command:

Code:
sudo mount -t cifs //192.168.0.7/NetBackup /mnt/SynologyNAS -o username=XXXXXX,password=XXXXXX
But when I add the below to fstab in order to mount the drive automatically on startup, the drive is not mounted:

Code:
//192.168.0.7/NetBackup /mnt/SynologyNAS cifs username=XXXXXX,password=XXXXXX 0 0
Any suggestions on how I can figure out what the problem is?
I think the correct syntax is
Code:
//192.168.0.7/NetBackup /mnt/SynologyNAS cifs user=your_username{}your_password 0 0
(in place of {} write a percent sign, seems like the forum software is cutting it off)

in the mount options could be useful also to specify to which local user/group map the ownership of the files: in case of the default user/group for the first user defined on a Slackware install, add just after the user=... part
Code:
,uid=1000,gid=100

Last edited by ponce; 10-02-2015 at 12:06 AM.
 
1 members found this post helpful.
Old 10-02-2015, 11:22 AM   #4
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by ponce View Post
(in place of {} write a percent sign, seems like the forum software is cutting it off)
Didier pointed out that you can't use percent signs (%) when using the quick reply/edit functions, but it should work fine if you use the "advanced editor".

But as far as the fstab, I know that the username=username,password=password used to work (I don't have a need for smb mounts in my fstab anymore, so I can't verify it still works). But I did eventually move my username/password to a separate file for security reasons. You can create a file like /etc/smbcredentials and then reference it in the fstab

Code:
//192.168.0.7/NetBackup /mnt/SynologyNAS cifs credentials=/etc/smbcredentials 0 0
It would allow you to keep your username/password out of the world-readable /etc/fstab, and you can put it in a file only readable by root.

Code:
# /etc/smbcredentials
username=samba_username
password=samba_password
 
1 members found this post helpful.
Old 10-03-2015, 03:55 PM   #5
AdiLQ123
Member
 
Registered: Oct 2011
Posts: 52

Original Poster
Rep: Reputation: Disabled
Still have not got it working. I've tried:

1. Replaced comma with percentage sign
2. Replaced username and password with /etc/smbcredentials file

Quote:
Originally Posted by bassmadrigal View Post
How is your IP address handled? I ran into issues in the past if I didn't have it handled directly with rc.inet1 (instead of wicd, at the time), because the network would get started too late and the initial mount would fail.
I have the below entry in my rc.inet1. Is this the best way to handle my IP address.

Code:
# Config information for ath0
IFNAME[1]="ath0"
IPADDR[1]="XXX.XXX.X.X"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]="yes"
DHCP_HOSTNAME[1]="XXXXXX"
GATEWAY="XXX.XXX.X.X"
Quote:
Originally Posted by bassmadrigal View Post
Have you tried running a mount -a after you're booted and connected to the network to see if it fails there? It would help narrow down if it's something with the fstab or something with the boot process.
You mean just type mount -a in the command line? I get:

Code:
mount: devpts already mounted or /dev/pts busy
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
 
Old 10-04-2015, 04:06 PM   #6
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Ok, so the portion in your /etc/fstab is leading to the permission denied. I wonder if your options being at the end of the command are the problem. Try the following and see if you get an error with it.

Code:
sudo mount -t cifs -o username=XXXXXX,password=XXXXXX //192.168.0.7/NetBackup /mnt/SynologyNAS
If you do, the mount command was probably disregarding your username/password and you were probably mounting your samba share as a guest. Then when you throw a username and password at it, it fails because that user isn't set up properly on the samba server.
 
Old 10-04-2015, 04:12 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Depending on your distribution, you might have to add _netdev to the mount options in fstab.

This is a systemd thing, as it seems to not be able to recognize a network device, and doesn't wait until the network is up (and functional) before trying to perform the mount without it.

Also, if your system is shared (or even if not), the /etc/fstab should not be readable by anyone but root as your password is now in plaintext for anyone to read.

Last edited by jpollard; 10-04-2015 at 04:15 PM.
 
1 members found this post helpful.
Old 10-05-2015, 04:08 PM   #8
AdiLQ123
Member
 
Registered: Oct 2011
Posts: 52

Original Poster
Rep: Reputation: Disabled
The below was also giving me the permission error:

Code:
sudo mount -t cifs -o username=XXXXXX,password=XXXXXX //192.168.0.7/NetBackup /mnt/SynologyNAS
So I added myself as a samba user and now longer getting the error with above command or mount -a.

I also added _netdev to the fstab as per the below:

Code:
//192.168.0.7/NetBackup /mnt/SynologyNAS cifs username=xxxxxx,password=xxxxxx,_netdev,0 0
Still not connected to the NAS.
 
Old 10-06-2015, 05:35 AM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Likely a typographic error... but the options have to be terminated with a space/tab before the 0 0 fields ( the option ",0" doesn't exist).
 
1 members found this post helpful.
Old 10-06-2015, 08:32 AM   #10
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Slackware doesn't have systemd, and I'm not sure if _netdev is used in non-systemd systems (couldn't seem to find info on it one way or the other, but I didn't try too hard).

Slackware's boot process does prevent mounting network drives before rc.inet1 and rc.inet2 are sourced. In rc.S, it explicitly states, "Mount non-root file systems in fstab, but not NFS or SMB because TCP/IP is not yet configured." Later on, in rc.M, it will perform a mount -a after it sources rc.inet1 and rc.inet2 (however, it is run before it attempts to start rc.wicd or rc.networkmanager, so if you use those to connect to your network, your network drives in /etc/fstab won't be mounted on boot without adding something later, like in rc.local).

jpollard is correct that the line you provided in your latest post is incorrect. As best as I can tell, you can remove the _netdev option, as it doesn't seem to apply to Slackware (and it doesn't seem to be mentioned in the man page for mount on Slackware). Keep the username/password as they are and then just make sure you have at least one space or tab between the options and the first zero (you can have as many spaces as you want, just make sure theres at least one... I tend to add a lot to mine to make everything line up for readability purposes, but it isn't necessary).
 
1 members found this post helpful.
Old 10-06-2015, 09:32 AM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Slackware mount recognizes the _netdev option but I think it ignores it. The boot script on Slackware specifically excludes mounting nfs, smbfs, and cifs. This is the traditional excluding method - the newer would be the option "no_netdev" which would exclude any fstab entry with "_netdev". I expect it will eventually be used as it simplifies the boot option, and makes it possible to put other network based filesystems available without having to update the boot script.

It is in my slackware 13 man pages under mount:
Code:
       -O, --test-opts opts
              Used in conjunction with -a, to limit the set of filesystems  to
              which  the -a is applied.  Like -t in this regard except that it
              is useless except in the context of -a.  For example,  the  com-
              mand:

                     mount -a -O no_netdev

              mounts  all filesystems except those which have the option _net-
              dev specified in the options field in the /etc/fstab file.

              It is different from -t in that each option is matched  exactly;
              a  leading no at the beginning of one option does not negate the
              rest.

              The -t and -O options are cumulative in  effect;  that  is,  the
              command

                     mount -a -t ext2 -O _netdev

              mounts  all  ext2  filesystems  with the _netdev option, not all
              filesystems that are either ext2  or  have  the  _netdev  option
              specified.
I didn't even think about NetworkManager being in the mix. If it is the one controlling the interfaces then you do need the mount put in rc.local
 
1 members found this post helpful.
Old 10-06-2015, 11:39 AM   #12
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Crap, I don't know how I missed netdev in the mount options. I think since I was just accessing it on my phone with an ssh app, I ended up mistaking another option for the typical end of the man page. I see it now. But considering netdev support has been there since at least Slackware 13, it doesn't seem like Pat is in any hurry to add it to the startup scripts. I could see him rearranging things so it attempts the mount -a after wicd/networkmanager are started up, but many times, I've heard users need to start up the GUI before it connects anyway. I don't use either, so I don't know how well they work.

But it certainly is ugly to have that stupid underscore in front of netdev. I wonder whose brilliant idea that was...
 
1 members found this post helpful.
Old 10-06-2015, 12:12 PM   #13
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by bassmadrigal View Post
Crap, I don't know how I missed netdev in the mount options. I think since I was just accessing it on my phone with an ssh app, I ended up mistaking another option for the typical end of the man page. I see it now. But considering netdev support has been there since at least Slackware 13, it doesn't seem like Pat is in any hurry to add it to the startup scripts. I could see him rearranging things so it attempts the mount -a after wicd/networkmanager are started up, but many times, I've heard users need to start up the GUI before it connects anyway. I don't use either, so I don't know how well they work.

But it certainly is ugly to have that stupid underscore in front of netdev. I wonder whose brilliant idea that was...
No biggie.

One of the things NetworkManager is supposed to do is reprocess the fstab file for network mounts. I have no idea if that is actually being done yet or if that is still something systemd is doing. It may be something that is supposed to be done by plugins... Personally, I think that is one of the problems with NetworkManager - there is no easy way to know what it is doing, or even if what it does makes sense.

Fixing issues about when things start is what systemd was supposed to do. Personally, it just made things more complex. Faster, yes - but when things get complicated it just made them a LOT more complicated.
 
1 members found this post helpful.
Old 10-06-2015, 01:59 PM   #14
AdiLQ123
Member
 
Registered: Oct 2011
Posts: 52

Original Poster
Rep: Reputation: Disabled
Code:
//192.168.0.7/NetBackup /mnt/SynologyNAS cifs username=XXXXXX,password=XXXXXX,_netdev 0 0
No dice.
 
Old 10-06-2015, 02:22 PM   #15
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
What is the error message recorded in the log file?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount Openfiler NAS CIFS shares on windows clients using script in a domain. How to? linuxlover.chaitanya General 1 08-02-2010 04:55 AM
[SOLVED] Can't write to Seagate Blackarmor NAS thru CIFS mount Ezplan Linux - Server 2 07-15-2010 02:12 PM
manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied CADIT Linux - Newbie 6 11-20-2009 02:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration