LLI Wiki — My Digital Knowledge Base

Duplicati: Windows service, Linux backup to Storj and systemd

Run Duplicati as an HTTPS Windows service, back up to Storj from the CLI, schedule with systemd, limit memory and decrypt a volume.

Field notes for running Duplicati backups on Windows and Linux: Windows service with HTTPS, command-line backup to Storj, a systemd timer, memory limits and decrypting a volume by hand.

Windows: run Duplicati as a service

See the installation guide.

# local access only
Duplicati.WindowsService.exe install --webservice-interface=loopback --log-retention=10M

# remote access over HTTPS with a PKCS#12 certificate
Duplicati.WindowsService.exe install --webservice-interface=any --webservice-sslcertificatefile=C:\Duplicati\cert\duplicati_p12.p12 --webservice-sslcertificatepassword=<PASSWORD> --log-file=C:\Duplicati\log --log-retention=10M

# remove the service
Duplicati.WindowsService.exe uninstall

Self-signed certificate (no CA)

openssl x509 -req -sha256 -extfile v3.ext -days 3650 -in duplicati_csr.csr -signkey duplicati_key.key -out duplicati_crt.crt
openssl pkcs12 -export -name servercert -in duplicati_crt.crt -inkey duplicati_key.key -out duplicati_p12.p12

The .p12 file contains the certificate and the private key; point --webservice-sslcertificatefile at it.

Duplicati: Rclone destination

Linux: command-line backup to Storj

Duplicati is installed from the distribution packages (for example the AUR on Arch) and the service runs as root to read system folders. The Storj destination uses an access grant created in the Storj console.

duplicati-cli backup "storj://storj.io/config?storj-auth-method=Access%20grant&storj-satellite=<SATELLITE>&storj-shared-access=<ACCESS_GRANT>&storj-bucket=<BUCKET>&storj-folder=backups" \
  /etc/ /home/ /var/ /usr/local/ \
  --backup-name="storj backup" \
  --dbpath=/var/lib/duplicati/<DB_NAME>.sqlite \
  --encryption-module=aes --compression-module=zip \
  --dblock-size=64MB --keep-time=2M \
  --passphrase=<PASSPHRASE> \
  --asynchronous-concurrent-upload-limit=1 \
  --list-verify-uploads=true --threshold=0 \
  --disable-module=console-password-input

Options that can be added depending on the case: --backup-test-samples=0 and --no-auto-compact=true.

Schedule with systemd

A service unit runs a wrapper script containing the command above, and a timer unit starts it.

# /usr/lib/systemd/system/duplicati-backup.service
[Unit]
Description=Duplicati backup custom

[Service]
Type=simple
ExecStart=/bin/sh -cv '/root/exec_backup.sh'
Restart=on-failure
RestartSec=30s
# follow the execution
sudo journalctl -u duplicati-backup -f

# test the service manually
systemctl start duplicati-backup.service

Duplicati: general and advanced options

Storj console: generating an access grant

Access the web interface through an SSH tunnel

ssh -p <SSH_PORT> -L 8201:127.0.0.1:8200 user@example.com

The web UI is then available on http://127.0.0.1:8201.

Limit memory usage (Mono)

# /etc/environment
MONO_GC_PARAMS="max-heap-size=1G,soft-heap-limit=512m,nursery-size=4m"

Reload with source /etc/environment and check with echo $MONO_GC_PARAMS. See the forum thread on OOM killer with Duplicati.

Decrypt a volume manually

Volumes (duplicati-b<id>.dblock.zip) are AES-encrypted and can be decrypted with AES Crypt:

aescrypt.exe -d -p '<PASSWORD>' duplicati-b<id>.dblock.zip

Troubleshooting: remote files missing

When the backend reports missing remote files (Duplicati 2.0.6.3, Windows 10, Storj backend), the workaround used was to run a full backup with --no-backend-verification=true, then run a purge. Related reports: issue 2251 and forum thread.

Other references: Rclone storage provider and the test-filters command.

Notes

Mastodon LLIMastodon SocialFosstodon