2

I would like to do what is described in this post: How to mount rclone on Android? and then have Termux:Boot automatically mount my rclone remotes at boot time.

As per that post, I am using the static fusermount binary from here. I am using the official rclone binary from here.

Referring to this page, Termux:Boot, I have the general idea. However, I have several questions:

  1. I have 3 remotes configured in rclone-mount. Is this script adequate to run with Termux:Boot to mount these 3 remotes? I appear to have it working on one device, but I can't replicate that success on my 2nd device. Also, I understand that only root can mount a FUSE filesystem, so I am confused that this appears* to be working on one device. (*The rclone mounts do in fact work on that device.)
#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
rclone -v mount pcloud: /mnt/runtime/write/emulated/0/pcloud --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other &

rclone -v mount desktop: /mnt/runtime/write/emulated/0/desktop --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other &

rclone -v mount server: /mnt/runtime/write/emulated/0/server --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other &

Or if I do need to run this script as root, how would I do it? For example, I tried adding these lines from the above referenced answer:

#!/data/data/com.termux/files/usr/bin/bash -e

[ $(id -u) -eq 0 ] || exec su --mount-master -c "LD_LIBRARY_PATH=$LD_LIBRARY_PATH HOME=$HOME PATH=$PATH:$HOME/bin $0"

[ $(readlink /proc/1/ns/mnt) = $(readlink /proc/self/ns/mnt) ] || nsenter -t 1 -m -- "$0"

That does not appear to work with Termux:Boot.

  1. Related question, what permissions do the above scripts need for Termux:Boot to work? Does it need to be executable? Who should the owner and group be? Should it be run as root? Can it be run as root?

I set executable perms for owner & group and I gave it the same owner/group that I saw for the ~/.termux/boot/ directory in Termux on the phone (which is not root, just the regular user).

During testing on one device, I got this working without running the Termux:Boot script as root, but I had made so many different attempts to get rclone-mount working on that device that I also have the rclone-mount Magisk module installed as well some another custom script. So I don't (yet) know the precise steps required to repeat this successfully.

Now I am setting it up on a second device, and I cannot get the rclone mounts to mount at boot whether I run the above script in the non-root version or with the added root privileges (as suggested by the answer I referenced). Nothing I'm trying is working, even though I repeated the same Termux:Boot steps I used on the other device. In this question, I'm seeking clarification on the details, and hopefully I will be able to understand where I'm going wrong.

  1. I assume backgrounding the rclone commands (&) is also needed, but I'm not sure. When I run the commands in the terminal, it is needed.

  2. I manually created my 3 mount points (e.g., /mnt/runtime/write/emulated/0/pcloud) before running the script.

When I run the rclone mount commands as root in Termux (while logged in via SSH), I get this error:

Fatal error: failed to mount FUSE fs: fusermount: fork/exec /system/bin/fusermount: permission denied

/system/bin/fusermount is a symlink to:

# ls -la /data/data/com.termux/files/usr/bin/fusermount
-rwxr-xr-x 1 u0_a212 u0_a212 95904 2021-10-21 16:48 /data/data/com.termux/files/usr/bin/fusermount

In turn, that is the statically linked binary recommended in the other post.

When I run the rclone mount command as the non-root user, I get this error:

$ rclone -v mount pcloud: /sdcard/pcloud --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other
WARNING: linker: /data/data/com.termux/files/usr/bin/rclone: unsupported flags DT_FLAGS_1=0x8000001
2021/10/21 23:57:07 mount helper error: fusermount: failed to open /dev/fuse: Permission denied
2021/10/21 23:57:07 Fatal error: failed to mount FUSE fs: fusermount: exit status 1

That would seem to support the statement that only root can mount FUSE filesystems.

Is it possible to get rclone mount to work with Termux:Boot? I'm wondering how I got it to work on my other device.

That working device is running Lineage OS and it also has the rclone-mount Magisk module installed -- which, by itself is not working. That is why I assumed that my non-root Termux:Boot setup is responsible the rclone mounts working.

I can't replicate that success on this device, a rooted Samsung (stock firmware). Maybe the working solution is some strange mix of the two main methods I tried (Termux and Magisk). Or maybe a working solution requires a non-stock firmware?

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Firelord
    Oct 23, 2021 at 2:42

0

You must log in to answer this question.

Browse other questions tagged .