fuser icon indicating copy to clipboard operation
fuser copied to clipboard

using helloworld example with mount

Open jdrouet opened this issue 1 year ago • 3 comments

Hi everyone!

Thank you again for that nice crate! I've been using it to implement a fuse driver for pcloud but I'm having some issue to make it work with mount or systemd. So I went back to basics and tried to use it with one of your examples, the hello-world. I created a simple project, built it, put it in /usr/local/bin/hello-world-fuse and updated my /etc/fstab as follows

hello-world-fuse	/mnt/hello-world	fuse	ro,allow_other

But when I run sudo mount /mnt/hello-world, it hangs... Am I doing something wrong?

jdrouet avatar Jul 31 '22 14:07 jdrouet

Thanks!

Hmm, unfortunately I've never tried using a fuser binary as part of fstab. The only thing I can think of is that maybe it's expecting some kind of handshake that fuser doesn't perform properly. I would try enabling the MountOption::AutoUnmount option. That goes through a different code path, so could have different behavior.

cberner avatar Jul 31 '22 15:07 cberner

Enabling MountOption::AutoUnmount doesn't change anything 🤔

jdrouet avatar Jul 31 '22 16:07 jdrouet

This may not be working because /usr/local/bin is probably removed from the PATH search when mount.fuse is eventually executed. You could try see if putting hello-world-fuse in /sbin works for you. This may or may not work.

My preferred way to support fstab (or systemd) mounts is to create a filesystem specific mounting binary mount.fstype in your case e.g. mount.helloworld (avoid -'s etc because systems are weird)

If we implemented it as a shell script that looks like this:

#!/bin/sh

/usr/bin/local/hello-world-fuse mount "$@"

Some notes: You just have to take care that your binary accepts mount compatible options in args.

I've indicated that below by introducing a sub-command called mount -- you have to accept -t for filesystem type, i would suggest using that to name your fuse filesystem and make sure you accept -o ...

Hopefully this helps.

ahmed-masud avatar Aug 02 '22 13:08 ahmed-masud