Ssh backup: cannot resolve hostname on borg

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 10.14.0
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian 12
  • Web server and version (e.g, Apache 2.4.25):
    • Nextcloud AIO Container
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Caddy
  • PHP version (e.g, 8.3):
    • Nextcloud AIO Container
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • today, first try
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

Borg backup on ssh failed.

Steps to replicate it (hint: details matter!):

  1. Generate ssh public key and copy to remote
  2. try to create a backup

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.


2025-05-25T07:43:28.396976312Z Your public ssh key for borgbackup is: ssh-ed25519 ***
2025-05-25T07:43:28.906317539Z Remote: ssh: Could not resolve hostname ***: Name does not resolve
2025-05-25T07:43:28.910138481Z Connection closed by remote host. Is borg working on the server?
2025-05-25T07:43:28.943799305Z Initializing repository...
2025-05-25T07:43:29.254152976Z using builtin fallback logging configuration
2025-05-25T07:43:29.377190897Z 33 self tests completed in 0.12 seconds
2025-05-25T07:43:29.378006079Z SSH command line: ['ssh', '-o', 'StrictHostKeyChecking=accept-new', '-i', '/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/id_borg', '-p', '23', '***>
2025-05-25T07:43:29.395887575Z Remote: ssh: Could not resolve hostname ***: Name does not resolve
2025-05-25T07:43:29.399207325Z Connection closed by remote host. Is borg working on the server?
2025-05-25T07:43:29.399212375Z Traceback (most recent call last):
2025-05-25T07:43:29.399214325Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5391, in main
2025-05-25T07:43:29.399216365Z     exit_code = archiver.run(args)
2025-05-25T07:43:29.399218135Z                 ^^^^^^^^^^^^^^^^^^
2025-05-25T07:43:29.399219895Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 5309, in run
2025-05-25T07:43:29.399222015Z     rc = func(args)
2025-05-25T07:43:29.399223785Z          ^^^^^^^^^^
2025-05-25T07:43:29.399227815Z   File "/usr/lib/python3.12/site-packages/borg/archiver.py", line 169, in wrapper
2025-05-25T07:43:29.399229785Z     repository = RemoteRepository(location.omit_archive(), create=create, exclusive=argument(args, exclusive),
2025-05-25T07:43:29.399231745Z                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-25T07:43:29.399233755Z   File "/usr/lib/python3.12/site-packages/borg/remote.py", line 594, in __init__
2025-05-25T07:43:29.399235615Z     raise ConnectionClosedWithHint('Is borg working on the server?') from None
2025-05-25T07:43:29.399237435Z borg.remote.ConnectionClosedWithHint: Connection closed by remote host. Is borg working on the server?
2025-05-25T07:43:29.399239295Z
2025-05-25T07:43:29.399241085Z Platform: Linux 386ba90af4d8 6.1.0-35-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.137-1 (2025-05-07) x86_64
2025-05-25T07:43:29.399242995Z Linux: Unknown Linux
2025-05-25T07:43:29.399244745Z Borg: 1.4.0  Python: CPython 3.12.10 msgpack: 1.0.8 fuse: llfuse 1.5.1 [pyfuse3,llfuse]
2025-05-25T07:43:29.399246585Z PID: 41  CWD: /
2025-05-25T07:43:29.399248335Z sys.argv: ['/usr/bin/borg', 'init', '--debug', '--encryption=repokey-blake2']
2025-05-25T07:43:29.399250155Z SSH_ORIGINAL_COMMAND: None
2025-05-25T07:43:29.399251935Z
2025-05-25T07:43:29.424826804Z Could not initialize borg repository.

Thank you for any hint.
I can ping that url when borg container is running from inside.
Greetings

You can not resolve the name to ip adress.

What about this command. Change to the name of the server.

host yourname

Hello devnull,
thanks for your time.
I’m not sure where i have to type this?!

I think you have a dns resolving problem. Type it in your linux shell. Check your dns settings.

I’ve already done this, there is no output after command.

When I ping the url, the resolving is done and succesfull, on host and in container.