gboudreau / Greyhole

Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.
http://www.greyhole.net
GNU General Public License v3.0
263 stars 34 forks source link

No access to files from shares. #305

Closed burnshroom closed 2 years ago

burnshroom commented 2 years ago

Hi.

I am re-setting up my server with a fresh Ubuntu 20.04 install and attempting to get Greyhole up and running.

I am able to setup my shares fine however I have an issue where once I write a file to the share and only AFTER greyhole pushes it from the landing zone to the storage pool, I lose access to the file. I can see the file available from my Windows PC on the network share however it will not allow me to open the file.

Since it's a new server I re-imaged the drive and started over but still have the same result.

As long as the file resides on the landing zone I can open it fine but only after it goes to the share and is linked do I have the issue.

image

The above image shows two test text files I was able to write to the share from windows, but once GH

image

Copied the file to the pool and created the symlink, I get the above error and lose access.

Here is the share, and it's settings in smb.conf. I have tried it with unix extensions and insecure wide links off and on with the same results.

image

I am hoping someone can help.

Any additional information, or logs or screengrabs I will gladly provide.

I have setup GH a few times before and this is stumping me.

gboudreau commented 2 years ago

Hi.

This is most probably a permission problem with your storage pool drives.

See here for details : https://github.com/gboudreau/Greyhole/wiki/Permissions-Data-Drives

burnshroom commented 2 years ago

I went through all the tips from the link.

image

Here you can see that the permissions are fine 775 and the file permission 777, but I get the same results even here.

gboudreau commented 2 years ago

Did you try to login on your shell with the same user you use to connect to your share, to verify that this user can read the symlink, and the target?

burnshroom commented 2 years ago

image

It's just the one user?

gboudreau commented 2 years ago

Create a testfile inside the comicbooks/test/ folder, on your share, wait for Greyhole to process it and the problem to occur, then :

sudo su shroom
cd /mnt/drives/4TB001/landingzone/comicbooks/test
md5sum testfile
cd /mnt/drives/4TB002
cd gh
cd comicbooks
cd test
md5sum testfile

If you still can't figure out the problem, restart the Greyhole daemon, and try this: https://github.com/gboudreau/Greyhole/wiki/GetHelp#gather-system-information And post the resulting URL in a new comment.

burnshroom commented 2 years ago

http://ix.io/4fmJ

Thanks for taking time to look at this, it is appreciated.

I normally feel I can futz my way through problems and get things working, but am at a loss. So again, thanks.

gboudreau commented 2 years ago

Somewhere in your Samba logs:

[2022/11/08 09:30:52] update-apparmor-samba-profile
  WARNING: "wide links" enabled. You might need to modify the smbd apparmor profile manually.

Maybe you have AppArmor configured to protect Samba, which prevents wide links in smb.conf from working?

gboudreau commented 2 years ago

I don't know much about AppArmor, but if you can't figure out how to force it to allow Samba to access your storage pool drives, maybe this workaround would work : https://unix.stackexchange.com/a/493092/16277 Juste create a fake share that uses path = /mnt/drives, restart smbd, and I would guess AppArmor would then allow Samba to access the storage pool drives that will be under /mnt/drives

burnshroom commented 2 years ago

Just an update:

Tried the above workaround and it provides a new share directly to the drives in the pool and from there I can access the files. However if I attempt to access the intended share with the symlinks it still gives the same error.

I went so far as to remove apparmor altogether but still came across the same issues, and pulled a new log and the same apparmor error was listed. I then did a fresh install of Ubuntu and before installing greyhole removed apparmor, but still have the same issue with the same apparmor reference in the logs.

Continuing to look at apparmor...

But guess I am also confused as I can't be the only one running Ubuntu 20.04...

burnshroom commented 2 years ago

So may not have been apparmor after all.

Based on a bunch of reading and trying different things, the suggestion here worked:

https://unix.stackexchange.com/questions/5120/how-do-you-make-samba-follow-symlink-outside-the-shared-path/137192#137192

Added:

follow symlinks = yes
wide links = yes

to the actual share instead of [global] and the files just showed up and I can delete them as well...

I am hoping this is resolved now. Thanks for your patience in my issue.

gboudreau commented 2 years ago

Thanks for the follow-up ; I added a note about this in the wiki page about this error.