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

Operation not permitted when running mergerfs as user (not root) #799

Closed
robertbaker opened this issue Aug 4, 2020 · 7 comments
Closed

Comments

@robertbaker
Copy link

robertbaker commented Aug 4, 2020

Describe the bug
When trying to run mergerfs that contain directories all inside the user home directory with proper permissions, I'm getting Operation not permitted errors.

To Reproduce
Use 2.29.0 and do any simple configuration.

Expected behavior
It works on 2.29.0 (it works on 2.30.0)

System information:

  • OS, kernel version: Linux instance-2 5.4.0-1021-gcp #21-Ubuntu SMP Fri Jul 10 06:53:47 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • mergerfs version: 2.29.0
  • mergerfs settings /mnt/cache/a/local=RW:/mnt/cache/a/remote=NC /mnt/cache/a/merged -o rw,allow_other,use_ino,func.getattr=newest,category.action=all,category.create=ff,cache.files=auto-full

Additional context

I'm not sure this worked before 2.29.0 or if I just stumbled on a brand new feature?

I compiled the 2.30.0 release and installed that and it instantly worked.
I also found that the build tools install script is missing a package needed, I made a PR for that.

@trapexit
Copy link
Owner

trapexit commented Aug 4, 2020

Can you show exactly how to produce it? What creates operation not permitted errors? The mounting or the filesystem itself.

@trapexit
Copy link
Owner

trapexit commented Aug 4, 2020

No, it's not a new feature. If you're saying that it wasn't mounting as a regular use... yes. That was a known bug and fixed. It was a deb package build problem. Not a mergerfs issue.

@robertbaker
Copy link
Author

robertbaker commented Aug 5, 2020

Can you show exactly how to produce it? What creates operation not permitted errors? The mounting or the filesystem itself.

just by running mergerfs /mnt/cache/a/local=RW:/mnt/cache/a/remote=NC /mnt/cache/a/merged -o rw,allow_other,use_ino,func.getattr=newest,category.action=all,category.create=ff,cache.files=auto-full

throws an operation not permitted error, the options and branches themselves do not matter.

I'm not sure how the deb package bug caused it, but anyway it works with 2.30.0

@doak
Copy link

doak commented Jan 10, 2024

@trapexit, is there a regression? It does not work as non-root for version v2.38.1-1-gc1c2f07.

Okay, there is this big warning "warning: mergerfs is not running as root and may not work correctly" but according to the docs it imho should work as long as the permissions are fine.

Output of a test script (see below):

  • Failing for some v2.38:
    warning: mergerfs is not running as root and may not work correctly                                                                                                                                                
    mergerfs v2.38.1-1-gc1c2f07                                                                                                                                                                                        
                                                                                                                                                                                                                       
    https://github.com/trapexit/mergerfs                                                                                                                                                                               
    https://github.com/trapexit/support                                                                                                                                                                                
                                                                                                                                                                                                                       
    ISC License (ISC)                                                                                                                                                                                                  
                                                                                                                                                                                                                       
    Copyright 2023, Antonio SJ Musumeci <[email protected]>                                                                                                                                                          
                                                                                                                                                                                                                       
    Permission to use, copy, modify, and/or distribute this software for                                                                                                                                               
    any purpose with or without fee is hereby granted, provided that the                                                                                                                                               
    above copyright notice and this permission notice appear in all                                                                                                                                                    
    copies.                                                                                                                                                                                                            
                                                                                                                                                                                                                       
    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL                                                                                                                                                      
    WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED                                                                                                                                                      
    WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE                                                                                                                                                   
    AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL                                                                                                                                               
    DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
    PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
    TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    
    
    warning: mergerfs is not running as root and may not work correctly
    fusermount: mount failed: Operation not permitted
    ERR: Preparation failed.
    fusermount: entry for /home/doak/daten/software/linux/mergerfs/DOAK/MERGED not found in /etc/mtab
    
  • Succeeding for pretty old version:
    mergerfs version: 2.25.1-70-g85e2a3e
    FUSE library version: 2.9.7-mergerfs_2.26.0
    fusermount3 version: 3.14.0
    using FUSE kernel interface version 7.27
    
    MERGED/dir/file
    

This is the test script: [Edited to use absolute paths for branches.]

#!/usr/bin/env bash

set -u

SCRIPTDIR=$(dirname -- "$0")
LOG="STRACE.LOG"


log() {
    echo "STRACE: ${@@Q}" >>"$LOG"
    strace -o "|sed 's/^/    /' >>$LOG" "$@"
}

error() {
    echo "ERR: $*" >&2
    exit 1
}


prepare() {
    mergerfs --version
    echo

    rm -rf branch1 branch2 MERGED "$LOG" &&
    mkdir -p branch1 branch2/dir &&
    touch branch2/dir/file &&
    mkdir -p MERGED &&
    trap "fusermount -u MERGED" EXIT &&
    mergerfs "$PWD/branch1:$PWD/branch2" MERGED &&
    true
}

testcase() {
    log ls MERGED/dir/file &&
    true
}


cd "$SCRIPTDIR"

prepare ||
error "Preparation failed."

testcase ||
error "Execution of test case failed."

@doak
Copy link

doak commented Jan 10, 2024

First version with "permission denied" is v2.33.0. But the versions before that throw another strange error:

mergerfs version: 2.32.3

* ERROR: unable to parse 'branches' - branch1:branch2
* ERROR: unable to parse 'branches' - MERGED
* ERROR: branches not set
* ERROR: mountpoint not set
ERR: Preparation failed.
fusermount: entry for /home/doak/daten/software/linux/mergerfs/DOAK/MERGED not found in /etc/mtab

Just found out that absolute paths are required since v2.30.0 or so.
Taking this into account, first version with "permission denied" is 2.28.3-28-g5ce428c. Even v2.30.0 does not work for me. 😕
Am I doing something wrong?

@trapexit
Copy link
Owner

Please create new tickets for new issues.

Okay, there is this big warning "warning: mergerfs is not running as root and may not work correctly" but according to the docs it imho should work as long as the permissions are fine.

mergerfs does not officially support that. Hence the warning. Why would you consider the warning a regression? It has always been this way and I mentioned it in the docs for a long time. I just added the logging to make sure people know.

Am I doing something wrong?

Without you providing me the exact and most simplistic reproduction of the commandline / mount command I am unable to comment.

@doak
Copy link

doak commented Jan 13, 2024

mergerfs does not officially support that. Hence the warning. Why would you consider the warning a regression?

I did not meant the warning a regression but not working as non-root at all.

Without you providing me the exact and most simplistic reproduction of the commandline / mount command […]

As you wish … #1292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants