Google Drive, RClone, and NextCloud

What is the problem you are having with rclone?

I want to setup a NextCloud hxxps://nextcloud.com on my Raspberry pi and use Google Drive as a storage while encrypting content with rclone.

I followed this video hxxps://www.youtube.com/watch?v=KBr_qf5G4CY) and via rclone config I have working gdrive point which is encrypted: rclone lsd gdrive_encrypted:/ works as expected.

I did copy this template hxxps://github.com/rclone/rclone/wiki/Systemd-rclone-mount from wiki and change RCLONE_MOUNT_VFS_CACHE_MODE to full and uncommented -o allow_other line.
Also uncommented user_allow_other from "/etc/fuse.conf file.

after enabling the mounting:
systemctl --user enable rclone@gdrive_encrypted
systemctl --user start rclone@gdrive_encrypted
I can write a plain file in local mounted point and in the Google drive will create encrypted files.

Now I want to bind this folder to NextCloud docker image:

I have following docker-compose.yml:

version: "2.1"
services:
  nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud

# In order to access FUSE
    devices:
      - /dev/fuse:/dev/fuse
    security_opt:
      - "apparmor:unconfined"
    cap_add:
      - SYS_ADMIN

    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - ./appdata:/config
      - /home/ubuntu/gdrive_encrypted/data:/data:rshared
    ports:
      - 443:443
    restart: unless-stopped

After that when I try to access NextCloud web page, there are fwrite() write permission error in the log of docker image and setup process fails.

Do you have recommendations?

What is your rclone version (output from rclone version)

rclone v1.53.3-DEV

  • os/arch: linux/arm64
  • go version: go1.15.4

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux raspiubuntu 5.11.0-1015-raspi

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Paste command here

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = client_id
client_secret = client_secret
scope = drive
token = {"access_token":"...","token_type":"Bearer","refresh_token":"...","expiry":"2021-07-22T21:42:29.48460505Z"}

[gdrive_enc]
type = crypt
remote = gdrive:/rclone
password = password
password2 = password2

A log from the command with the -vv flag

Paste  log here

hello and welcome to the forum,

that is an old version of rclone, best to update.
https://rclone.org/downloads/#script-download-and-install

please post the config file, redact id/secrets

1 Like

please understand that we cannot see into your computer.

when you posted there was a template of questions for you to answer.
so we do not have to keep going back and forth, trying to pull the needed info from you.

I did provide config content, command is already above.
I don't know how to run that command with -vv to provide the third data

add -vv to the rclone command and post the output

This is command executed by systemd, I'm not running it seperatly:

post your systemd file....

[Unit]
Description=RClone mount of users remote %i using filesystem permissions
Documentation=http://rclone.org/docs/
After=network-online.target


[Service]
Type=notify
#Set up environment
Environment=REMOTE_NAME="%i"
Environment=REMOTE_PATH="/"
Environment=MOUNT_DIR="%h/%i"
Environment=POST_MOUNT_SCRIPT=""
Environment=RCLONE_CONF="%h/.config/rclone/rclone.conf"
Environment=RCLONE_TEMP_DIR="/tmp/rclone/%u/%i"
Environment=RCLONE_RC_ON="false"

#Default arguments for rclone mount. Can be overridden in the environment file
Environment=RCLONE_MOUNT_ATTR_TIMEOUT="1s"
#TODO: figure out default for the following parameter
Environment=RCLONE_MOUNT_DAEMON_TIMEOUT="UNKNOWN_DEFAULT"
Environment=RCLONE_MOUNT_DIR_CACHE_TIME="60m"
Environment=RCLONE_MOUNT_DIR_PERMS="0777"
Environment=RCLONE_MOUNT_FILE_PERMS="0666"
Environment=RCLONE_MOUNT_GID="%G"
Environment=RCLONE_MOUNT_MAX_READ_AHEAD="128k"
Environment=RCLONE_MOUNT_POLL_INTERVAL="1m0s"
Environment=RCLONE_MOUNT_UID="%U"
Environment=RCLONE_MOUNT_UMASK="022"
Environment=RCLONE_MOUNT_VFS_CACHE_MAX_AGE="1h0m0s"
Environment=RCLONE_MOUNT_VFS_CACHE_MAX_SIZE="off"
Environment=RCLONE_MOUNT_VFS_CACHE_MODE="full"
Environment=RCLONE_MOUNT_VFS_CACHE_POLL_INTERVAL="1m0s"
Environment=RCLONE_MOUNT_VFS_READ_CHUNK_SIZE="128M"
Environment=RCLONE_MOUNT_VFS_READ_CHUNK_SIZE_LIMIT="off"
#TODO: figure out default for the following parameter
Environment=RCLONE_MOUNT_VOLNAME="UNKNOWN_DEFAULT"

#Overwrite default environment settings with settings from the file if present
EnvironmentFile=-%h/.config/rclone/%i.env

#Check that rclone is installed
ExecStartPre=/usr/bin/test -x /usr/bin/rclone

#Check the mount directory
ExecStartPre=/usr/bin/test -d "${MOUNT_DIR}"
ExecStartPre=/usr/bin/test -w "${MOUNT_DIR}"
#TODO: Add test for MOUNT_DIR being empty -> ExecStartPre=/usr/bin/test -z "$(ls -A "${MOUNT_DIR}")"

#Check the rclone configuration file
ExecStartPre=/usr/bin/test -f "${RCLONE_CONF}"
ExecStartPre=/usr/bin/test -r "${RCLONE_CONF}"
#TODO: add test that the remote is configured for the rclone configuration

#Mount rclone fs
ExecStart=/usr/bin/rclone mount \
            --config="${RCLONE_CONF}" \
#See additional items for access control below for information about the following 2 flags
            --allow-other \
#            --default-permissions \
            --rc="${RCLONE_RC_ON}" \
            --cache-tmp-upload-path="${RCLONE_TEMP_DIR}/upload" \
            --cache-chunk-path="${RCLONE_TEMP_DIR}/chunks" \
            --cache-workers=8 \
            --cache-writes \
            --cache-dir="${RCLONE_TEMP_DIR}/vfs" \
            --cache-db-path="${RCLONE_TEMP_DIR}/db" \
            --no-modtime \
            --drive-use-trash \
            --stats=0 \
            --checkers=16 \
            --bwlimit=40M \
            --cache-info-age=60m \
            --attr-timeout="${RCLONE_MOUNT_ATTR_TIMEOUT}" \
#TODO: Include this once a proper default value is determined
#           --daemon-timeout="${RCLONE_MOUNT_DAEMON_TIMEOUT}" \
            --dir-cache-time="${RCLONE_MOUNT_DIR_CACHE_TIME}" \
            --dir-perms="${RCLONE_MOUNT_DIR_PERMS}" \
            --file-perms="${RCLONE_MOUNT_FILE_PERMS}" \
            --gid="${RCLONE_MOUNT_GID}" \
            --max-read-ahead="${RCLONE_MOUNT_MAX_READ_AHEAD}" \
            --poll-interval="${RCLONE_MOUNT_POLL_INTERVAL}" \
            --uid="${RCLONE_MOUNT_UID}" \
            --umask="${RCLONE_MOUNT_UMASK}" \
            --vfs-cache-max-age="${RCLONE_MOUNT_VFS_CACHE_MAX_AGE}" \
            --vfs-cache-max-size="${RCLONE_MOUNT_VFS_CACHE_MAX_SIZE}" \
            --vfs-cache-mode="${RCLONE_MOUNT_VFS_CACHE_MODE}" \
            --vfs-cache-poll-interval="${RCLONE_MOUNT_VFS_CACHE_POLL_INTERVAL}" \
            --vfs-read-chunk-size="${RCLONE_MOUNT_VFS_READ_CHUNK_SIZE}" \
            --vfs-read-chunk-size-limit="${RCLONE_MOUNT_VFS_READ_CHUNK_SIZE_LIMIT}" \
#TODO: Include this once a proper default value is determined
#            --volname="${RCLONE_MOUNT_VOLNAME}"
            "${REMOTE_NAME}:${REMOTE_PATH}" "${MOUNT_DIR}"

#Execute Post Mount Script if specified
ExecStartPost=/bin/sh -c "${POST_MOUNT_SCRIPT}"

#Unmount rclone fs
ExecStop=/bin/fusermount -u "${MOUNT_DIR}"

#Restart info
Restart=on-success
RestartSec=10

[Install]
WantedBy=default.target


command to run: systemctl --user start rclone@gdrive_encryption

imho, i am not a linux expert but that is not a good systemd file

  • many flags do nothing based on your config.
  • many flags use the cache remote which has been deprecated and has been removed from the rclone website.

here at the forum, this is the guide for systemd+gdrive
https://github.com/animosity22/homescripts/blob/master/systemd/rclone.service

1 Like

Couldn't find crypt option in the updated rclone. Is it deprecated?

https://rclone.org/crypt/

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.