Serve restic APPEND_ONLY environment variable

What is the problem you are having with rclone?

I am using rclone serve restic on my local backup server. The CLI switch --append-only works correctly but I cannot get it to work as an environment variable RCLONE_APPEND_ONLY=true in a systemd service.

What is your rclone version (output from rclone version)

rclone v1.52.0
- os/arch: linux/amd64
- go version: go1.14.3

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

Debian Linux 64 bit

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

N/A

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

This is my systemd service file. It works in all respects except append only is not effective. When I run restic forget --prune across the LAN it deletes the snapshot.

[Unit]
Description=rclone serve
Documentation=http://rclone.org/docs/
After=network-online.target

[Service]
Type=exec
User=me
Environment="RCLONE_ADDR=0.0.0.0:5005"
Environment="RCLONE_APPEND_ONLY=true"
Environment="RCLONE_PASSWORD_COMMAND=cat /home/me/rclonepass"
Environment="RCLONE_CONFIG=/home/me/.config/rclone/rclone.conf"
Environment="RCLONE_HTPASSWD=/home/me/users.db"
ExecStart=/usr/bin/rclone serve restic local:/backups
TimeoutStartSec=30

#Restart info
Restart=on-failure
RestartSec=10

[Install]
WantedBy=default.target

When I move append only into the command it is effective, for example:

rclone serve restic local:/backups --htpasswd /home/me/users.db --append-only --addr 0.0.0.0:5009 --password-command "cat /home/me/rclonepass" --config /home/me/.config/rclone/rclone.conf 

All other environment variables in the systemd service file work correctly. Have I named the RCLONE_APPEND_ONLY=true variable incorrectly?

This is a bug!

There was an old way of configuring flags in rclone which didn't read env vars - I thought I'd got them all but obviously not.

Try this

https://beta.rclone.org/branch/v1.52.1-053-ge7a367be-fix-restic-serve-env-beta/ (uploaded in 15-30 mins)

That version works, thanks for such a quick fix :slight_smile:

By the way, is it intended that attempting to write to an append-only repo has such a complicated error message?

Edit: Scratch that, I forgot it is a restic error message, not a rclone error message :slight_smile:

repository 607d3eab opened successfully, password is correct
found 18 old cache directories in /home/me/.cache/restic, pass --cleanup-cache to remove them
Remove(<snapshot/5d132273cd>) returned error, retrying after 582.280027ms: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 890.117305ms: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 671.590708ms: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 2.216767434s: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 2.070709754s: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 3.011308614s: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 4.004869008s: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 11.639721773s: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 16.05103845s: blob not removed, server response: 403 Forbidden (403)
Remove(<snapshot/5d132273cd>) returned error, retrying after 23.002952479s: blob not removed, server response: 403 Forbidden (403)
blob not removed, server response: 403 Forbidden (403)
github.com/restic/restic/internal/backend/rest.(*Backend).Remove
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/internal/backend/rest/rest.go:312
github.com/restic/restic/internal/backend.(*RetryBackend).Remove.func1
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/internal/backend/backend_retry.go:98
github.com/cenkalti/backoff.RetryNotify
	/usr/share/gocode/src/github.com/cenkalti/backoff/retry.go:37
github.com/restic/restic/internal/backend.(*RetryBackend).retry
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/internal/backend/backend_retry.go:36
github.com/restic/restic/internal/backend.(*RetryBackend).Remove
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/internal/backend/backend_retry.go:97
github.com/restic/restic/internal/cache.(*Backend).Remove
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/internal/cache/backend.go:38
main.runForget
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/cmd/restic/cmd_forget.go:107
main.glob..func10
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/cmd/restic/cmd_forget.go:22
github.com/spf13/cobra.(*Command).execute
	/usr/share/gocode/src/github.com/spf13/cobra/command.go:762
github.com/spf13/cobra.(*Command).ExecuteC
	/usr/share/gocode/src/github.com/spf13/cobra/command.go:852
github.com/spf13/cobra.(*Command).Execute
	/usr/share/gocode/src/github.com/spf13/cobra/command.go:800
main.main
	/builddir/build/BUILD/restic-0.9.5/_build/src/github.com/restic/restic/cmd/restic/main.go:86
runtime.main
	/usr/lib/golang/src/runtime/proc.go:200
runtime.goexit
	/usr/lib/golang/src/runtime/asm_amd64.s:1337

Great!

I've queued that fix up for a potential 1.52.2 if I don't end up making that it will be in 1.53 and in the latest beta

Yes a full traceback is a little intimidating there!

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