Subject: Re: bug#42036: Failed to mount fuse sshfs

From: Oleg Pykhalov <[email-masked]>
Date: Fri, 26 Jun 2020 09:01:05 +0300

Hi,

Tobias Geerinckx-Rice <[email-masked]> writes:

> Efraim Flashner 写道：
>> I'm not clear on the usage of sshfs, but I just tried 'sshfs
>> efraim@other-machine: mnt/' and it worked without any issues.
>
> Right.  The bug is mount(8) not finding it because it(?) only looks in /bin,
> apparently.  This poses a problem with e.g. autofs.
>
> However, Oleg: are you sure it looks *only* in /bin?  Did you install ‘sshfs’
> to your user profile (‘guix install’ or a manifest) or system profile (the
> ‘packages’ field of your ‘operating-system’)?

I tried to install in Guix system profile via ‘packages’ field.  No
success to run mount.

Then I added to ‘services’ field:
--8<---------------cut here---------------start------------->8---
    ;; mount -t fuse and autofs
    (extra-special-file "/bin/sshfs"
                        (file-append sshfs "/bin/sshfs"))
    (extra-special-file "/bin/ssh"
                        (file-append openssh "/bin/ssh"))
--8<---------------cut here---------------end--------------->8---
which works without problems.

I didn't have an idea to install them in non-priveleged user profile,
because I tested with a ‘root’ account.

Here is a ‘mount -t‘ strace:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~$ mount -t fuse -o rw,allow_other sshfs#oleg@workstation:/home/oleg /tmp/f
/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/sh: sshfs: command not found

execve("/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/sh", ["/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/sh", "-c", "'sshfs' 'oleg@workstation:/home/oleg' '/tmp/f' '-o' 'rw,allow_other,dev,suid'"], 0x961430 /* 74 vars */) = 0
...
stat(".", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
stat("/usr/local/bin/sshfs", 0x7ffed0ac1c90) = -1 ENOENT (No such file or directory)
stat("/usr/local/sbin/sshfs", 0x7ffed0ac1c90) = -1 ENOENT (No such file or directory)
stat("/usr/bin/sshfs", 0x7ffed0ac1c90)  = -1 ENOENT (No such file or directory)
stat("/usr/sbin/sshfs", 0x7ffed0ac1c90) = -1 ENOENT (No such file or directory)
stat("/bin/sshfs", 0x7ffed0ac1c90)      = -1 ENOENT (No such file or directory)
stat("/sbin/sshfs", 0x7ffed0ac1c90)     = -1 ENOENT (No such file or directory)
stat(".", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
stat("./sshfs", 0x7ffed0ac1c90)         = -1 ENOENT (No such file or directory)
--8<---------------cut here---------------end--------------->8---