Configuration files are not backed up when behind a symbolic link #1270

Closed
opened 2026-02-18 21:02:37 +00:00 by Deric-W · 4 comments

What I'm trying to do and why

Hi,
I am using NixOS to manage a small home server, using Borgmatic to perform backups. Because of the design of NixOS the configuration files for Borgmatic are placed under /etc/static/borgmatic.d and pointed to by symbolic links placed under /etc/borgmatic.d.

This causes Borgmatic to only include the symbolic links in the created archives, probably breaking the config bootstrap action.

Steps to reproduce

  1. Copy configuration files to a directory not included in the backup
  2. Replace original config files with symbolic links pointing to the newly created files
  3. Perform a backup
  4. Inspect created backup

Actual behavior

Backup only includes the symbolic links.

Expected behavior

Backup should include the configuration files.

Other notes / implementation ideas

Maybe this could be classified as "working as intended", but since the documentation mentions included configuration files being handled by Borgmatic I expected the same for symbolic links.
If my expectations are wrong, maybe a warning could be produced or included in the documentation.

The configuration file used (/etc/borgmatic.d/mail.yaml):

archive_name_format: '{hostname}-mail-{now:%Y-%m-%dT%H:%M:%S.%f}'
checks:
- frequency: 1 month
  name: repository
- frequency: 1 month
  name: archives
exclude_patterns:
- /var/vmail/*/*/mail/tmp
- /var/vmail/*/*/mail/dovecot-uidlist.lock
- /var/dkim/thetwins.xyz.mail.key
- /var/lib/rspamd/*.hs
- /var/lib/rspamd/*.hsmp
- /var/lib/rspamd/*.map
keep_daily: 7
keep_hourly: 0
keep_minutely: 0
keep_monthly: 6
keep_secondly: 0
keep_weekly: 4
keep_within: 1H
keep_yearly: 2
repositories:
- label: services repository
  path: ssh://borg@localhost:3724//backup/services
source_directories:
- /var/vmail
- /var/sieve
- /var/dkim
- /var/lib/rspamd
- /var/lib/redis-rspamd/dump.rdb
source_directories_must_exist: false
ssh_command: ssh -i /secrets/ssh_host_ed25519_key

borgmatic version

2.0.11

borgmatic installation method

NixOS

Borg version

1.4.3

Python version

3.13.11

Database version (if applicable)

No response

Operating system and version

ANSI_COLOR="0;38;2;126;186;228"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="25.11.20260216.fa56d7d"
CPE_NAME="cpe:/o:nixos:nixos:25.11"
DEFAULT_HOSTNAME=nixos
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
ID_LIKE=""
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 25.11 (Xantusia)"
SUPPORT_END="2026-06-30"
SUPPORT_URL="https://nixos.org/community.html"
VARIANT=""
VARIANT_ID=""
VENDOR_NAME=NixOS
VENDOR_URL="https://nixos.org/"
VERSION="25.11 (Xantusia)"
VERSION_CODENAME=xantusia
VERSION_ID="25.11

### What I'm trying to do and why Hi, I am using [NixOS](https://search.nixos.org/options?channel=25.11&show=services.borgmatic) to manage a small home server, using Borgmatic to perform backups. Because of the design of NixOS the configuration files for Borgmatic are placed under `/etc/static/borgmatic.d` and pointed to by symbolic links placed under `/etc/borgmatic.d`. This causes Borgmatic to only include the symbolic links in the created archives, probably breaking the `config bootstrap` action. ### Steps to reproduce 1. Copy configuration files to a directory not included in the backup 2. Replace original config files with symbolic links pointing to the newly created files 3. Perform a backup 4. Inspect created backup ### Actual behavior Backup only includes the symbolic links. ### Expected behavior Backup should include the configuration files. ### Other notes / implementation ideas Maybe this could be classified as "working as intended", but since the [documentation](https://torsion.org/borgmatic/how-to/extract-a-backup/#extract-the-configuration-files-used-to-create-an-archive) mentions included configuration files being handled by Borgmatic I expected the same for symbolic links. If my expectations are wrong, maybe a warning could be produced or included in the documentation. The configuration file used (`/etc/borgmatic.d/mail.yaml`): ```yaml archive_name_format: '{hostname}-mail-{now:%Y-%m-%dT%H:%M:%S.%f}' checks: - frequency: 1 month name: repository - frequency: 1 month name: archives exclude_patterns: - /var/vmail/*/*/mail/tmp - /var/vmail/*/*/mail/dovecot-uidlist.lock - /var/dkim/thetwins.xyz.mail.key - /var/lib/rspamd/*.hs - /var/lib/rspamd/*.hsmp - /var/lib/rspamd/*.map keep_daily: 7 keep_hourly: 0 keep_minutely: 0 keep_monthly: 6 keep_secondly: 0 keep_weekly: 4 keep_within: 1H keep_yearly: 2 repositories: - label: services repository path: ssh://borg@localhost:3724//backup/services source_directories: - /var/vmail - /var/sieve - /var/dkim - /var/lib/rspamd - /var/lib/redis-rspamd/dump.rdb source_directories_must_exist: false ssh_command: ssh -i /secrets/ssh_host_ed25519_key ``` ### borgmatic version 2.0.11 ### borgmatic installation method NixOS ### Borg version 1.4.3 ### Python version 3.13.11 ### Database version (if applicable) _No response_ ### Operating system and version ANSI_COLOR="0;38;2;126;186;228" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="25.11.20260216.fa56d7d" CPE_NAME="cpe:/o:nixos:nixos:25.11" DEFAULT_HOSTNAME=nixos DOCUMENTATION_URL="https://nixos.org/learn.html" HOME_URL="https://nixos.org/" ID=nixos ID_LIKE="" IMAGE_ID="" IMAGE_VERSION="" LOGO="nix-snowflake" NAME=NixOS PRETTY_NAME="NixOS 25.11 (Xantusia)" SUPPORT_END="2026-06-30" SUPPORT_URL="https://nixos.org/community.html" VARIANT="" VARIANT_ID="" VENDOR_NAME=NixOS VENDOR_URL="https://nixos.org/" VERSION="25.11 (Xantusia)" VERSION_CODENAME=xantusia VERSION_ID="25.11
Owner

Thanks for filing this. I'm fine "fixing" it, even if the current feature is blindly working as intended. I think the question will be whether to store the link + the destination ... or just the destination.

Thanks for filing this. I'm fine "fixing" it, even if the current feature is blindly working as intended. I think the question will be whether to store the link + the destination ... or just the destination.
Owner

This is implemented in main and will be part of the next release! I went with storing everything—symlinks, destination config files, and any intervening symlinks along the way. Thanks again for bringing this to my attention.

This is implemented in main and will be part of the next release! I went with storing everything—symlinks, destination config files, and any intervening symlinks along the way. Thanks again for bringing this to my attention.
Author

Thanks for the quick fix, and taking your time to work on Borgmatic :)

Thanks for the quick fix, and taking your time to work on Borgmatic :)
Owner

Released in borgmatic 2.1.3!

Released in borgmatic 2.1.3!
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
borgmatic-collective/borgmatic#1270
No description provided.