this post was submitted on 03 Aug 2025
26 points (93.3% liked)

Selfhosted

51532 readers
375 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

I'm having trouble automating the restic backup using systemd.

I followed the linked guide, which seems pretty straightforward. Backup works fine when I run it manually, but when I try to run systemctl status restic-backup.service I get the following error: Fatal: parsing repository location failed: s3: bucket name not found

I have triple-checked the file paths, and also added PassEnvironment=AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY RESTIC_REPOSITORY RESTIC_PASSWORD_FILE B2_ACCOUNT_ID B2_ACCOUNT_KEY to the restic-backup.service file, which I saw used elsewhere. This is my first time using systemd, so I'm not sure if I am overlooking an obvious step or what.

OS: Xubuntu

restic: installed locally following these steps

backup: Backblaze B2 bucket with s3

you are viewing a single comment's thread
view the rest of the comments
[–] gedaliyah@lemmy.world 1 points 1 month ago* (last edited 1 month ago)

my Files look like this:

# /etc/systemd/system/restic-backup.service

[Unit]
Description=Generate a restic backup snapshot
After=network.target

[Service]
Type=oneshot
WorkingDirectory=/
EnvironmentFile=/etc/restic-env
PassEnvironment=AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY RESTIC_REPOSITORY RESTIC_PASSWORD_FILE
Environment=XDG_CACHE_HOME=/var/cache
ExecStart=/usr/bin/restic backup -r s3:https://s3.us-west-004.backblazeb2.com/XXXBUCKETNAMEXXX /home/XXXX /etc /media/XXXX/Storage --tag auto
ExecStart=/usr/bin/restic forget --prune --keep-hourly 6 --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --tag auto
ExecStart=/usr/bin/restic check --read-data

Nice=19
IOSchedulingClass=best-effort 
IOSchedulingPriority=7
TimeoutSec=3600
Restart=no

[Install]
WantedBy=multi-user.target
# /etc/restic-env

export AWS_ACCESS_KEY_ID=004XXXXXXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=K00XXXXXXXXXXXXXXXXXXXXXXXX
export RESTIC_REPOSITORY=s3:s3.us-west-004.backblazeb2.com
export RESTIC_PASSWORD_FILE=/etc/restic-password

DEBUG_LOG=restic.log

I'm running the systemd commands from a root terminal and the permissions on restic-env and restic-password are 700