spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.84k stars 1.04k forks source link

BorgBackup not possible to IPv6-only remote host #2833

Open NickBouwhuis opened 1 year ago

NickBouwhuis commented 1 year ago

Playbook Configuration:

My vars.yml file looks like this:

backup_borg_enabled: true
backup_borg_location_repositories:
 - ssh://borg@hostname.to.ipv6.address.of.my.nas/data/borg/matrix
backup_borg_storage_encryption_passphrase: "xxx"
backup_borg_ssh_key_private: |
  -----BEGIN OPENSSH PRIVATE KEY-----
  xxx
  -----END OPENSSH PRIVATE KEY-----

Matrix Server:

Problem description: I have setup BorgBackup according to the documentation in this repo.

I have prepared a borg repo with borg init --encryption=repokey /data/borg/matrix

I have made an ssh key, configured it on my NAS and made sure I can ssh to the borg user (over IPv6)

When I configure everything and run a backup with sudo systemctl start matrix-backup-borg, I get the following result:

nick@matrix01:~$ sudo systemctl start matrix-backup-borg
Job for matrix-backup-borg.service failed because the control process exited with error code.
See "systemctl status matrix-backup-borg.service" and "journalctl -xeu matrix-backup-borg.service" for details.
nick@matrix01:~$ sudo systemctl status matrix-backup-borg
× matrix-backup-borg.service - Borg Backup
     Loaded: loaded (/etc/systemd/system/matrix-backup-borg.service; disabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-08-18 19:58:34 UTC; 33s ago
TriggeredBy: ● matrix-backup-borg.timer
    Process: 47808 ExecStartPre=/usr/bin/env sh -c /usr/bin/env docker kill matrix-backup-borg 2>/dev/null || true (code=exited, status=0/SUCCESS)
    Process: 47815 ExecStartPre=/usr/bin/env sh -c /usr/bin/env docker rm matrix-backup-borg 2>/dev/null || true (code=exited, status=0/SUCCESS)
    Process: 47823 ExecStartPre=/usr/bin/env docker run --rm --name matrix-backup-borg --log-driver=none --cap-drop=ALL --read-only --user=999:1001 --network=matrix --t>
    Process: 47955 ExecStart=/usr/bin/env docker run --rm --name matrix-backup-borg --log-driver=none --cap-drop=ALL --cap-add=CAP_DAC_OVERRIDE --read-only --network=ma>
   Main PID: 47955 (code=exited, status=1/FAILURE)
        CPU: 292ms

Aug 18 19:58:34 matrix01 matrix-backup-borg[47955]: summary:
Aug 18 19:58:34 matrix01 matrix-backup-borg[47955]: /etc/borgmatic.d/config.yaml: An error occurred
Aug 18 19:58:34 matrix01 matrix-backup-borg[47955]: ssh://borg@hostname.to.ipv6.address.of.my.nas/data/borg/matrix: Error running actions for repository
Aug 18 19:58:34 matrix01 matrix-backup-borg[47955]: Remote: ssh: connect to host hostname.to.ipv6.address.of.my.nas port 22: Address not available
Aug 18 19:58:34 matrix01 matrix-backup-borg[47955]: Connection closed by remote host. Is borg working on the server?
Aug 18 19:58:34 matrix01 matrix-backup-borg[47955]: Command 'borg create --exclude-from /tmp/tmpa4uxejx9 --compression lz4 --one-file-system --read-special ssh://borg@h>
Aug 18 19:58:34 matrix01 matrix-backup-borg[47955]: Need some help? https://torsion.org/borgmatic/#issues
Aug 18 19:58:34 matrix01 systemd[1]: matrix-backup-borg.service: Main process exited, code=exited, status=1/FAILURE
Aug 18 19:58:34 matrix01 systemd[1]: matrix-backup-borg.service: Failed with result 'exit-code'.
Aug 18 19:58:34 matrix01 systemd[1]: Failed to start matrix-backup-borg.service - Borg Backup.

This leads me to believe that the container that runs Borg is not setup to use IPv6. What would be the correct way to tackle this?

aine-etke commented 1 year ago

Correct way would be sending MR to the gitlab.com/etke.cc/borgmatic ;)

NickBouwhuis commented 1 year ago

Hehe. Fair enough.

Any idea what could be causing this error?

aine-etke commented 1 year ago

Unfortunately, no. We don't have any IPv6-only hosts, so never encountered that problem