rclone: Mounting using AutoFS doesn't work
Output of rclone version
rclone v1.47.0
- os/arch: linux/amd64
- go version: go1.12.3
Describe the issue
I have been trying to add a few rclone-mounts to my autofs configuration without success
Mounting the drive using the exact commandline that autofs uses works though, so something is weird…
handle_packet_missing_indirect: token 20, name TeamDrive-Archive, request pid 3291
attempting to mount entry /media/GoogleTest/TeamDrive-Archive
lookup_mount: lookup(file): looking up TeamDrive-Archive
lookup_mount: lookup(file): TeamDrive-Archive -> -fstype=fuse,config=/home/scuttle/.config/rclone/rclone.conf :rclonefs\#dom-td01\:
parse_mount: parse(sun): expanded entry: -fstype=fuse,config=/home/scuttle/.config/rclone/rclone.conf :rclonefs\#dom-td01\:
parse_mount: parse(sun): gathered options: fstype=fuse,config=/home/scuttle/.config/rclone/rclone.conf
parse_mount: parse(sun): dequote(":rclonefs\#dom-td01\:") -> :rclonefs#dom-td01:
parse_mount: parse(sun): core of entry: options=fstype=fuse,config=/home/scuttle/.config/rclone/rclone.conf, loc=:rclonefs#dom-td01:
sun_mount: parse(sun): mounting root /media/GoogleTest, mountpoint TeamDrive-Archive, what rclonefs#dom-td01:, fstype fuse, options config=/home/scuttle/.config/rclone/rclone.conf
do_mount: rclonefs#dom-td01: /media/GoogleTest/TeamDrive-Archive type fuse options config=/home/scuttle/.config/rclone/rclone.conf using module generic
mount_mount: mount(generic): calling mkdir_path /media/GoogleTest/TeamDrive-Archive
mount_mount: mount(generic): calling mount -t fuse -o config=/home/scuttle/.config/rclone/rclone.conf rclonefs#dom-td01: /media/GoogleTest/TeamDrive-Archive
Just running “mount -t fuse -o config=/home/scuttle/.config/rclone/rclone.conf rclonefs#dom-td01: /media/GoogleTest/TeamDrive-Archive” mounts the folder just fine, but when automount tries it, it just hangs on that last line
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 58 (30 by maintainers)
Commits related to this issue
- Add redirection to and from /dev/null - see https://github.com/ncw/rclone/issues/3246 and autofs section — committed to Linux-project/rclone-wiki by ncw 5 years ago
Thank you. It explains why you don’t hit the unmount bug. Looks like the pseudo-mount abstraction is used only by systemd automounter while the Autofs daemon uses an alternative kernel mechanism for that. I will mention it when I submit final patch for rclone.
@ncw
Let’s close this ticket.
I will open another PR with ultimate goal to get rid of shell wrappers so rclone like
sshfscan work natively withmountandautofs!My last open task is to teach cobra translate
-o xxxinto rclone flags…ok done 😃
Well, back when the bug was originally opened, there were some minor adjustments, but right now it looks like this:
Autofs:
Music -fstype=fuse.rclonefs,config=/home/scuttle/.config/rclone/rclone.conf,allow-other,default-permissions,allow-non-empty,max-read-ahead=16M,uid=1000,gid=1000Rclonefs:
The mount:
Tried the new binary, and works fine that one too
I can make rclone mount work with
systemd.mountandsystemd.automounton Linux using a wrapping shell script.My dev branch rclone-for-autofs has two patches against latest rclone
1.56(of course it can fork using--daemon):--daemon-timeout=30sflag./proc/mounts.I use systemd files from https://gist.github.com/ivandeex/038ac805293f44e6859c3c876f586c46:
The former file is a shell wrapper invoked by systemd when it establishes a
type=rclonemount. Systemd passes mount options as-o option=valueto the wrapper, and expects it to do the mount and exit with zero status.The path must be fully mounted when the wrapper exits, so the default way
rclone mount --daemonworks (parent exits immediately without waiting for mount) is not enough. The wrapper must ensure that mount is completely established by the time it exits, or systemd will detect failure. I tried three methods to ensure this.I don’t use the
--daemonflag. The wrapper runsrclone mount ... &i.e. backrounds it, then polls/proc/mountsuntil the mount establishes. This method works fine both with systemd mount and automount.The wrapper just translates
-o opt=valinto rclone flags like--opt=valand invokesrclone mount --daemon --daemon-timeout=30s ..... This way rclone does all: it forks, the child mounts, the parent waits for the child and then exits.Combination of 1 and 2. Wrapper translates args and invokes
rclone mount --daemon ..., then polls /proc/mounts.All methods work fine with systemd mount. After
systemctl start mnt-mysftp.mountI can access/mnt/mysftpwithout problems. But if I stop mount, start automount and try to accessls /mnt/myfork, methods 2 and 3 fail with errorrclone: fusermount: /mnt/myfork: ENODEV. This means for sure that https://github.com/sevlyar/go-daemon (rclone calls it for --daemon) is incompatible with autofs/automount.I am investigaing this, trying kludges on the above branch, etc etc…
Sorry we don’t use systemd so I can’t test it with it… Let me know if I can help