Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot mount CIFS shares shared via ZFS #1170

Closed
atoponce opened this issue Dec 29, 2012 · 15 comments
Closed

Cannot mount CIFS shares shared via ZFS #1170

atoponce opened this issue Dec 29, 2012 · 15 comments
Assignees
Labels
Type: Documentation Indicates a requested change to the documentation
Milestone

Comments

@atoponce
Copy link

I've discovered a bug with mounting Samba shares on Debian testing with up-to-date packages and using the 0.6.0-rc13 packages compiled from source. First, I installed the necessary Samba packages, created my ZFS dataset, and made it available to Samba:

# aptitude install -R samba samba-client samba-tools cifs-utils
# zfs create -o casesensitivity=mixed -o sharesmb=on pool/srv
# zfs share pool/srv

Using the Samba client, I can verify that it is available (assuming 'eightyeight' is my workstation):

# smbclient -U guest -NL eightyeight 2> /dev/null | grep Disk
      print$          Disk      Printer Drivers
      sysvol          Disk      
      netlogon        Disk      
      pool_srv        Disk      Comment: /srv

Yet, trying to mount it fails:

# mount -t cifs -o guest '//eightyeight/srv' /mnt
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Trying to access the share via the interactive Samba client without mounting also fails:

# smbclient -U guest -N //eightyeight/srv
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

However, if I add the relevant config to /etc/samba/smb.conf and restart the Samba daemon, I can mount the share and browse it:

# awk 'NR>343' /etc/samba/smb.conf
[srv]
  read only = no
  browsable = yes
  guest ok = yes
  path = /srv
# mount -t cifs -o guest '//eightyeight/srv' /mnt
# ls /mnt
foo
# mount | grep srv
pool/srv on /srv type zfs (rw,relatime,xattr)
//eightyeight/srv on /mnt type cifs (rw,relatime,sec=ntlm,unc=\\eightyeight\srv,username=,uid=0,noforceuid,gid=0,noforcegid,addr=10.0.0.74,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)
# smbclient -U guest -N //eightyeight/srv
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
smb: \> ls
  .                                   D        0  Wed Dec 26 15:11:40 2012
  ..                                  D        0  Thu Dec 27 13:40:23 2012
  foo                                          4  Wed Dec 26 15:11:40 2012

                40812 blocks of size 4194304. 40812 blocks available

Relevant operating system info:

# dpkg -l 'zfs*' 'spl*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-================================================================================================================
ii  spl                                                   0.6.0-1                         amd64                           SPL Utils
ii  spl-modules                                           0.6.0-1                         amd64                           Solaris Porting Layer Modules
ii  spl-modules-devel                                     0.6.0-1                         amd64                           Solaris Porting Layer Headers and Symbols
ii  zfs                                                   0.6.0-1                         amd64                           ZFS Library and Utils
ii  zfs-devel                                             0.6.0-1                         amd64                           ZFS File System User Headers
ii  zfs-dracut                                            0.6.0-1                         amd64                           ZFS Dracut Module
ii  zfs-modules                                           0.6.0-1                         amd64                           ZFS File System
ii  zfs-modules-devel                                     0.6.0-1                         amd64                           ZFS File System Headers and Symbols
ii  zfs-test                                              0.6.0-1                         amd64                           ZFS File System Test Infrastructure
# uname -a
Linux eightyeight 3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux
# lsmod | awk '/zfs/ || /spl/'
zfs                   809810  10 
zunicode              324505  1 zfs
zavl                   13115  1 zfs
zcommon                35894  1 zfs
znvpair                31373  2 zcommon,zfs
spl                   124517  5 znvpair,zcommon,zavl,zunicode,zfs
zlib_deflate           25638  1 spl

I can provide straces or other debugging output as needed.

@ghost ghost assigned FransUrbo Dec 29, 2012
@ismell
Copy link

ismell commented Jan 6, 2013

Is the path not //eightyeight/pool_srv ?

@atoponce
Copy link
Author

atoponce commented Jan 6, 2013

No. The path is //eightyeight/srv. The "pool/srv" mountpoint is "/srv" on the box, not "/pool/srv". This can be verified:

# zfs get mountpoint pool/srv
NAME      PROPERTY    VALUE       SOURCE
pool/srv  mountpoint  /srv        local
# mount | grep srv
pool/srv on /srv type zfs (rw,relatime,xattr)

@aikudinov
Copy link

All it does is running "net usershare add" and since it is bad to just give
everyone access to your shares, it sets guest_ok=n. Check
/var/lib/samba/usershares.
You are trying to access share as a guest and it fails as expected. Also
share name should be pool_srv indeed.

I was looking at the code earlier trying to figure out how to rename share
(on solaris you can) and I think you can't set any options there yet.

@atoponce
Copy link
Author

atoponce commented Jan 7, 2013

It won't share using standard authentication. Using guest is just a simple example. Also, as mentioned, I should not be sharing //eightyeight/pool/srv as the mountpoint is not '/pool/srv' but '/srv'. If that is what is expected, then that's another bug. Without ZFS, I can share //eightyeight/srv with no problem.

@FransUrbo
Copy link
Contributor

the mountpoint is not '/pool/srv' but '/srv'.

Why is this a bug?

@atoponce
Copy link
Author

atoponce commented Jan 7, 2013

Having pool/srv mounted to /srv is not a bug. Using a Samba client to mount /pool/srv/ when it does not exist, is.

@aikudinov
Copy link

Look, you run smbclient -U guest -NL eightyeight 2> /dev/null | grep Disk
and getting pool_srv Disk Comment: /srv

Then you are doing smbclient -U guest -N //eightyeight/srv
When you should run smbclient -U guest -N //eightyeight/pool_srv

You are confused, ZoL just picks dataset name, replaces slashes with underscores and uses it as share name, NOT the mountpoint!

@FransUrbo
Copy link
Contributor

Ok, so now I'M confused! Do we have a bug here or not? What IS the bug in such case?

@atoponce
Copy link
Author

atoponce commented Jan 7, 2013

Well, all I can tell you is that I still cannot mount a Samba share when using "zfs share" with "sharesmb=on", whether I use underscores, directory paths or datasets. Doesn't matter if I try "//eightyeight/pool_srv", "//eightyeight/pool/srv" or "//eightyeight/srv", it won't mount. The Samba clients can see that the share exists, but can't do anything with it. Further, I can mount the //eightyeight/srv directory path fine using native Samba config, getting ZFS out of the way.

So, if there exists some documentation on how to do this correctly, I would be much appreciated, but everything I've thrown at it shows me that I cannot mount a Samba share using ZFS natively. Has anyone even tried this? Or, are we arguing for the sake of argument?

@atoponce
Copy link
Author

atoponce commented Jan 7, 2013

Okay. So, tearing everything down, and starting from scratch, I am getting a "permission denied" error, as guest, my user, and root. So, I'm guessing I also need to make some modifications in the smb.conf. Again, docs would be helpful, seeing as though the Solaris ones from Oracle only go so far.

@FransUrbo
Copy link
Contributor

It's all in the man page - 'man zfs'. And the user you're trying to auth as must have access to the FS, naturally. Can you auth as 'my user' normally (i.e., against another share, not shared via zfs)?

@aikudinov
Copy link

There is no bug, Aaron is just confused with how samba share names work, he seems to expect is to be same as mountpoint.
Nevertheless being able to change share name like on solaris would be nice feature. :)

edit: Check how usershares work in samba, because this is what zfs does. All their options are most likely stored in /var/lib/samba/usershares

@atoponce
Copy link
Author

atoponce commented Jan 7, 2013

I guess I'm confused, because the Samba tools share a directory. ZFS isn't doing that. :)

@atoponce
Copy link
Author

atoponce commented Jan 7, 2013

I'll close the ticket.

@FransUrbo
Copy link
Contributor

Aikudinov, just for the record. Did you get it to work? It works for me, but there might be two other bugs lurking here:

  1. Documentation (see CIFS share documentation lacking #1181).
  2. Changing share name (see CIFS options missing #1182).

FransUrbo added a commit to FransUrbo/zfs that referenced this issue Mar 31, 2013
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
Closes: openzfs#1181

* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
Closes: openzfs#1124

* Give an example on how to mount a SMB filesystem shared via ZFS.
Improves: openzfs#1170
FransUrbo added a commit to FransUrbo/zfs that referenced this issue Mar 31, 2013
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
Closes: openzfs#1181

* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
Closes: openzfs#1124

* Give an example on how to mount a SMB filesystem shared via ZFS.
Improves: openzfs#1170
behlendorf pushed a commit that referenced this issue Apr 3, 2013
* Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
* Give an example on how to mount a SMB filesystem shared via ZFS.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1181
Issue #1170
FransUrbo added a commit to FransUrbo/zfs that referenced this issue Apr 13, 2013
+ Merge from iscsi+smbfs+snapshot+zvol
  Commits:
    c519b70606fc2cfba3423aeed1f7d6dfbc55b27e
    Add some ignores (among them pkg files).

    9cc55935e3f1eed3cd0f67bfcc46aa5908e90927
    Indicate full 'path' (latest git commit date
    and all patches) in the Release tag.
+ Script to run through some tests to test share/unsharing...
+ Improve upon the module load string to include the Release
  from META.
+ New automake'd Makefile.in's.
+ Merge latest from iscsi+smbfs+mine
* Put the extra share script (/sbin/zfs_share_iscsi) as a define.
* Optional /etc/iscsi_target_id which contain the TID - this instead
  of autogenerating one (which changes every month!).
* Document iSCSI for ZFS for Linux.
* Makefile.in is recreated by autogen.sh so remove it...
* Remove a failed patch merge.
* Re-add some debug from ZoL:master.
* Mark the Release with the last GIT commit date.
+ In zfs_unmount(), support VOLUMEs. This function is called
  when (for example) doing a 'zfs destroy' on a shared volume
  as well as mounted filesystems so make sure we unshare instead
  of unmount any active volume.
* Simplify domainname retreival.
  + Tripple check before continuing with reversing it.
* Sanity checks for EXTRA_SHARE_SCRIPT, IETM_CMD_PATH and PROC_IET_VOLUME.
* Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
  Closes: openzfs#1181
* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
  Closes: openzfs#1124
* Give an example on how to mount a SMB filesystem shared via ZFS.
  Improves: openzfs#1170
* Remove superfluous ZFS_PROP_SHAREISCSI.
* Remove some extra heavy debugging I forgot to remove from
  my development of iSCSI/SMBFS!
FransUrbo added a commit to FransUrbo/zfs that referenced this issue Apr 13, 2013
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
Closes: openzfs#1181

* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
Closes: openzfs#1124

* Give an example on how to mount a SMB filesystem shared via ZFS.
Improves: openzfs#1170
FransUrbo added a commit to FransUrbo/zfs that referenced this issue Apr 13, 2013
  * Update manpage with more information about the ACL, guest access
    and that samba needs to be able to authenticate user(s).
  * Add information that 'net' can be used to modify the share after
    ZFS sharing and that it will be undone with a 'zfs unshare'.
    Closes: openzfs#1181
  * Do basic sanity checks in smb_available() to verify that the 'net'
    command and the usershare directory exists.
    Closes: openzfs#1124
  * Give an example on how to mount a SMB filesystem shared via ZFS.
    Improves: openzfs#1170
FransUrbo added a commit to FransUrbo/zfs that referenced this issue Apr 13, 2013
  * Update manpage with more information about the ACL, guest access
    and that samba needs to be able to authenticate user(s).
  * Add information that 'net' can be used to modify the share after
    ZFS sharing and that it will be undone with a 'zfs unshare'.
    Closes: openzfs#1181
  * Do basic sanity checks in smb_available() to verify that the 'net'
    command and the usershare directory exists.
    Closes: openzfs#1124
  * Give an example on how to mount a SMB filesystem shared via ZFS.
    Improves: openzfs#1170
unya pushed a commit to unya/zfs that referenced this issue Dec 13, 2013
* Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
* Give an example on how to mount a SMB filesystem shared via ZFS.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#1181
Issue openzfs#1170
pcd1193182 pushed a commit to pcd1193182/zfs that referenced this issue Sep 26, 2023
…openzfs#1170)

Bumps [memchr](https://github.com/BurntSushi/memchr) from 2.5.0 to 2.6.0.
- [Commits](BurntSushi/memchr@2.5.0...2.6.0)

---
updated-dependencies:
- dependency-name: memchr
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Indicates a requested change to the documentation
Projects
None yet
Development

No branches or pull requests

4 participants