Deepin not mounting cifs fstab entries at startup
Tofloor
poster avatar
es02
deepin
2016-10-26 16:50
Author
es02@greyhat:/tmp$ cat /etc/fstab
# /dev/sda2
UUID=34df54b2-3873-440b-88ef-0adf08741555        /                 ext4              rw,relatime,data=ordered        0 1

# /dev/sda1 LABEL=ESP
UUID=FD50-3840              /boot/efi         vfat              rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro        0 2

//192.168.1.1/foo /media/foo  cifs file_mode=0664,dir_mode=0775,uid=1000,credentials=/home/es02/.smbcredentials 0 1
//192.168.1.2/bar /media/bar  cifs file_mode=0664,dir_mode=0775,uid=1000,credentials=/home/es02/.smbcreds 0 1
//192.168.1.2/baz  /media/baz  cifs file_mode=0664,dir_mode=0775,uid=1000,credentials=/home/es02/.smbcreds 0 1
Every time I boot I have to manually run sudo mount -a in order for my network shares to mount.
The exact same fstab entries automounted happily under Ubuntu and Fedora.

Any suggestions?
Reply Favorite View the author
All Replies
es02
deepin
2016-11-11 15:36
#1
For those wondering heres the perms on my smbcredential files - again this worked crorrectly under both Ubuntu and Fedora:

  1. -rw-r--r--  1 root root          51 Aug 17 15:17 .smbcredentials
  2. -rw-r--r--  1 root root          44 Aug 17 15:21 .smbcreds
Copy the Code

Reply View the author
es02
deepin
2016-11-11 15:40
#2
https://bbs.deepin.org/post/131676
Add x-gvfs-show and users to the options, so that they will show up in file manager. This will still ...

I see the same thing:

  1. es02@greyhat:~$ dmesg | grep CIFS
  2. [    8.187994] CIFS VFS: Error connecting to socket. Aborting operation.
  3. [    8.188082] CIFS VFS: Error connecting to socket. Aborting operation.
  4. [    8.188238] CIFS VFS: Error connecting to socket. Aborting operation.
  5. [    8.195781] CIFS VFS: cifs_mount failed w/return code = -101
  6. [    8.195794] CIFS VFS: cifs_mount failed w/return code = -101
  7. [    8.199783] CIFS VFS: cifs_mount failed w/return code = -101
Copy the Code
Reply View the author
th3blad3runn3r
deepin
2016-11-12 09:41
#3
Edited by th3blad3runn3r at 2016-11-11 18:44

Could you please give a try with thoses credentials:
  1. -rw-rw-rw- 1 poweruser poweruser 56 sept. 29 23:06 .smbcredentials
Copy the Code

I had some isssues with
  1. -rw-r--r--  1 root root          51 Aug 17 15:17 .smbcredentials
Copy the Code

preventing cifs to mount correctly.

I know it sounds crazy, as .smbcredentials should be only read while fstab is processed....
Reply View the author
es02
deepin
2016-11-29 16:26
#4
https://bbs.deepin.org/post/131676
Could you please give a try with thoses credentials:

I had some isssues with

the problem with that is that 'poweruser' or at least the user account that I connect under does not exist on this machine.
Reply View the author
th3blad3runn3r
deepin
2016-11-30 09:46
#5
And in my case, 'poweruser' exists both on my machine and the remote one (my NAS)...
I can't figure out why this doesn't work anyway, as long as the correct remote user is declared into the .smbcredentials.
Local rights shouldn't interfere.
My understanding so far :

Let's name LUSER the local user on the machine you're trying to mount your cifs partition into
Lets name RUSER the remote account for your NAS or your distant machine

.smbcredentials should contain
  1.     username=RUSER
  2.     password=MyVeryStrongPasswordForThe RemoteMachine
  3.     domain=workgroup
Copy the Code


Are you sure (if you're using a NAS), that the share options on the remote node are OK ?
Reply View the author
es02
deepin
2016-11-30 18:34
#6
https://bbs.deepin.org/post/131676
And in my case, 'poweruser' exists both on my machine and the remote one (my NAS)...
I can't figure  ...

I have three shares, one on a Linux development machine and the other two on a Windows fileserver.

As previously noted all three used to auto-mount fine under Fedora and xUbunbtu.
The only change here is moving to Deepin.

Mounting works as expected when using 'sudo mount -a' which tells me my fstab entries and smbcredential files are fine.
Reply View the author
DebuggerX
deepin
2016-11-30 21:20
#7
I have another way to solve this problem:
Edit this file with root permission——
  1. sudo gedit /etc/rc.local
Copy the Code

And then add codes before "exit 0"——
  1. echo 'your root password'|sudo -S mount -t cifs //10.0.0.8/shared /home/debuggerx/Shared -o username=debuggerx,password=dx,rw,dir_mode=0777,file_mode=0777
Copy the Code

so this mount codes will be executed when you login ..
Reply View the author
es02
deepin
2016-12-01 17:17
#8
https://bbs.deepin.org/post/131676
I have another way to solve this problem:
Edit this file with root permission——

That's honestly a terrible idea from a security standpoint.

Your password should never be stored in plaintext anywhere on your machine.
Reply View the author
faisal6309
deepin
2016-10-27 06:17
#9
It is not mounting cifs here at all. I need access to windows share with username and without password.
Reply View the author
savanweylyn
deepin
2016-10-27 06:46
#10
Add x-gvfs-show and users to the options, so that they will show up in file manager. This will still not mount them automatically, but you will be able to mount them by clicking on them in nautilus or in whatever file manager you use (faster then sudo mount -a).
Do you see these messages during boot:
CIFS VFS: Error connecting to socket. Aborting operation.
CIFS VFS: cifs_mount failed w/return code = -101

Since auto mounting is not working for me either and i think it's somehow related to these, but i didn't find anything useful about them by now.
Reply View the author
rhp
deepin
2016-10-28 11:27
#11
Had a similar issue when trying to properly auto-mount my NAS which uses SMB, with fstab (I couldn't automatically load my music library in a media player, unless I first accessed the share via nautilus).

After trying out all the tricks with FSTAB, I decided to go about this in a bit different way, and since I would anyways forget how I did it, I made some instructions that I can share here:

To automount an SMB Share with systemctl / systemd:

systemctl enable NetworkManager-wait-online.service
(I needed to enable this to indicate when the mounting should happen)

create a new SystemCTL Unit with .mount file extension to /etc/systemd/system/
Name for the Unit = Path to mount directory (e.g. "home-username-NAS.mount") with this content:

[Unit]
Description=Mount NAS at boot
Wants=network-online.target
After=network-online.target

[Mount]
What=//192.168.1.3/NAS  
Where=/home/yourusername/NAS
Options=credentials=/home/yourusername/.smbcredentials,iocharset=utf8,rw,uid=1000,gid=1000 (basically the same stuff you would use in fstab)
Type=cifs
TimeoutSec=30

[Install]
WantedBy=multi-user.target


Testing if the mount works:
systemctl start home-yourusername-NAS.mount

Finally to enable the mount on Startup:
systemctl enable home-yourusername-NAS.mount


Hope this helps, or at least gives some clues on how you could proceed
Reply View the author
th3blad3runn3r
deepin
2016-11-02 04:52
#12
Edited by th3blad3runn3r at 2016-11-1 13:56

Here's how I succeed with cifs mount :
Below an excerpt of my fstab
  1. //192.168.0.5/photo /home/poweruser/V7000/Pictures cifs user,credentials=/home/poweruser/.smbcredentials,uid=poweruser,gid=poweruser 0 0
  2. //192.168.0.5/video /home/poweruser/V7000/Videos cifs user,credentials=/home/poweruser/.smbcredentials,uid=poweruser,gid=poweruser 0 0
  3. //192.168.0.5/music /home/poweruser/V7000/Music cifs user,credentials=/home/poweruser/.smbcredentials,uid=poweruser,gid=poweruser 0 0
Copy the Code

The trick relies upon the use of a credential file:
  1. credentials=/home/poweruser/.smbcredentials,
Copy the Code

This one must contain the following entries
  1. username=poweruser
  2. password=MyVeryStrongPassword
  3. domain=workgroup
Copy the Code

and its access rights have to be :
  1. ls -al .smbcredentials
  2. -rw-rw-rw- 1 poweruser poweruser 56 sept. 29 23:06 .smbcredentials
Copy the Code

Hth
Reply View the author