Inaccessible Greyhole Shares

Guillaume Boudreau edited this page Nov 5, 2013 · 2 revisions

If you can't access your shares when Greyhole is enabled for them, and can access them when it's not, you most probably have an issue with the Greyhole VFS module for Samba.

You can verify that this is indeed your problem by enabling the Samba logs, and looking for greyhole in them.

For example, the logs below show that the Greyhole VFS module couldn't be loaded:

[2013/10/27 07:33:33.468602, 0] smbd/vfs.c:173(vfs_init_custom)
error probing vfs module 'greyhole': NT_STATUS_UNSUCCESSFUL
[2013/10/27 07:33:33.468658, 0] smbd/vfs.c:315(smbd_vfs_init)
smbd_vfs_init: vfs_init_custom failed for greyhole
[2013/10/27 07:33:33.468680, 0] smbd/service.c:869(make_connection_snum)
vfs_init failed for service shared

The Greyhole VFS module is a .so file that is found in /usr/lib/greyhole/greyhole-samba3.so

For Samba to be able to use it, it needs a to have a symlink to the proper file in */usr/lib/samba/vfs/greyhole.so*

Example:

$ ls -l /usr/lib*/samba/vfs/greyhole.so
lrwxrwxrwx 1 root root 39 Sep 23 13:37 /usr/lib64/samba/vfs/greyhole.so -> /usr/lib64/greyhole/greyhole-samba36.so

Make sure this symlink exists, is not broken (pointing to a missing file), and targets the correct versions for your Samba.

Example:

$ smbd --version
Version 3.6.9-151.el6_4.1

The above indicates I run Samba 3.6, so my symlink needs to point to the greyhole-samba36.so file.

Apart from a broken symlink, another possible cause for this problem is that you would have AppArmor running, and preventing Samba from correctly loading the Greyhole VFS module.

Here's how you can fix issues with AppArmor, in decreasing order of specificity:

  1. Add something to the AppArmor profile for Samba (/etc/apparmor.d/usr.sbin.smbd) to allow access. Something like /usr/lib*/greyhole/*.so mr, Then reload the profile with cat /etc/apparmor.d/usr.sbin.smbd | sudo apparmor_parser -r

  2. Add an alias to the AppArmor config to make the directories considered equivalent. These are stored in /etc/apparmor.d/tunables/alias. Add a line something like alias /usr/lib/samba/vfs/ -> /usr/lib64/greyhole/,

  3. Set the AppArmor profile for Samba to complain mode (instead of enforce mode): sudo aa-complain /etc/apparmor.d/usr.sbin.smbd

  4. Disable the profile entirely: sudo ln -s /etc/apparmor.d/usr.sbin.smbd /etc/apparmor.d/disable/ ; sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.smbd

  5. Disable AppArmor completely: sudo service apparmor stop ; sudo update-rc.d -f apparmor remove

After you've done whichever of these, restart the services smbd, nmbd, and apparmor (assuming you didn't disable it), in that order.