Rclone service start problem

What is the problem you are having with rclone?

I am trying to connect PCloud cloud storage. I guess I used rclone config command properly because when I used rclone lsd PCloud: command, it displayed all the folders. But when I use systemctl --user start rclone@PCloud it gives me error Job for rclone@PCloud.service failed because the control process exited with error code.

Run the command 'rclone version' and share the full output of the command.

rclone version

rclone v1.59.1

  • os/version: arch rolling (64 bit)
  • os/kernel: 5.19.2-arch1-1 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.19
  • go/linking: dynamic
  • go/tags: none

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

pcloud

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

systemctl --user start rclone@PCloud

The rclone config contents with secrets removed.

rclone.conf

[PCloud]
type = pcloud
hostname = api.pcloud.com
token = {"access_token":"","token_type":"bearer","expiry":""}

rclone@.service


[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="off"
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=always
RestartSec=10

[Install]
WantedBy=default.target

A log from the command with the -vv flag

systemctl --user status rclone@PCloud

‚óŹ rclone@PCloud.service - RClone mount of users remote PCloud using filesystem permissions
     Loaded: loaded (/home/username/.config/systemd/user/rclone@.service; disabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sun 2022-08-21 19:48:34 IST; 1s ago
       Docs: http://rclone.org/docs/
    Process: 18471 ExecStartPre=/usr/bin/test -x /usr/bin/rclone (code=exited, status=0/SUCCESS)
    Process: 18472 ExecStartPre=/usr/bin/test -d ${MOUNT_DIR} (code=exited, status=0/SUCCESS)
    Process: 18473 ExecStartPre=/usr/bin/test -w ${MOUNT_DIR} (code=exited, status=0/SUCCESS)
    Process: 18474 ExecStartPre=/usr/bin/test -f ${RCLONE_CONF} (code=exited, status=0/SUCCESS)
    Process: 18475 ExecStartPre=/usr/bin/test -r ${RCLONE_CONF} (code=exited, status=0/SUCCESS)
    Process: 18476 ExecStart=/usr/bin/rclone mount --config=${RCLONE_CONF} --rc=${RCLONE_RC_ON} --cache-tmp-upload-path>
   Main PID: 18476 (code=exited, status=1/FAILURE)
        CPU: 88ms

journalctl --user -xeu rclone@PCloud.service

No journal files were found.

hello and welcome to the forum,

--- a bunch of those flags do nothing and/or have been deprecated.

--- fwiw, i would remove 99% of that and try a simple hardcoded command.
for example,
/usr/bin/rclone mount remote: /path/to/mountpoint

--- need to use a rclone debug log

not sure it matters, but i would not use RCLONE_ for most of those environment variables.
as rclone uses that for it own flags.
for example, would not use RCLONE_MOUNT_DAEMON_TIMEOUT

Thanks. This works. But there is some kind of message "NOTICE: pcloud root '': --vfs-cache-mode writes or full is recommended for this remote as it can't stream".
Also, how do I unmount this?

rclone mount has to emulate local file system for the mountpoint.
and handle differences between each cloud provider.
so you have to choose which --vfs-cache-mode is required.

for example,
--- cloud providers do not support random access writes, but local filesystem does.
--- pcloud does not support streamed uploads.

/bin/fusermount

Thanks a ton!!!

sure,

and i forgot to mention this link, which has well tested systemd service files and more....
https://github.com/animosity22/homescripts

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