Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vorta gives a "Connection closed by remote host. Is borg working on the server?" due to faulty key in known_hosts file #2179

Open
lumbric opened this issue Dec 29, 2024 · 3 comments

Comments

@lumbric
Copy link

lumbric commented Dec 29, 2024

Description

When attempting to start a backup or retrieve the backup list via Vorta, the following error appears:

ERROR - Connection closed by remote host. Is borg working on the server?

However, we successfully connected to the server manually using both an SSH client and Borg (to list backups).

The issue seems specific to Vorta caused by a faulty entry in the known_hosts file: removing the known_hosts file fixes the issue (see below) even if ssh and borg on the command line can connect to the server with the known_hosts file.

Is Vorta somehow connecting to the server in a different way than borg? Isn't it simply a front end to borg?

This seems distinct from borgbackup/borg#636 as it fails immediately after initializing the connection and during the backup. However, this might be related to #1997 and #1104. I don't really understand how ssh-askpass is related to this issue.

Solution: remove known_hosts file

We were able to solve the issue, by doing the following:

  1. remove ~/.ssh/known_hosts
  2. run a "borg list " on the command line and accept the new host key
  3. run the backup in vorta

Environment

  • OS: Ubuntu 20.04.6 LTS
  • Vorta version: 0.9.1
  • Installed from: flatpak
  • Borg version: 1.24

Logs

2024-12-07 18:08:19,316 - vorta.keyring.abc - DEBUG - No module named 'objc'
2024-12-07 18:08:19,319 - asyncio - DEBUG - Using selector: EpollSelector
2024-12-07 18:08:19,320 - vorta.keyring.abc - DEBUG - Using VortaSecretStorageKeyring
2024-12-07 18:08:19,320 - vorta.borg.borg_job - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2024-12-07 18:08:19,321 - asyncio - DEBUG - Using selector: EpollSelector
2024-12-07 18:08:19,322 - vorta.keyring.secretstorage - DEBUG - Found 1 passwords matching repo URL.
2024-12-07 18:08:19,323 - vorta.keyring.secretstorage - DEBUG - Retrieved password for repo ssh://<MY_USER>@<MY_DOMAIN>:<PORT>/<PATH>
2024-12-07 18:08:19,346 - vorta.borg.jobs_manager - DEBUG - Add job for site 1
2024-12-07 18:08:19,347 - vorta.borg.jobs_manager - DEBUG - Start job on site: 1
2024-12-07 18:08:19,368 - vorta.borg.borg_job - INFO - Running command /app/bin/borg create --list --progress --info --log-json --json --filter=AM -C lz4 ssh://<MY_USER>@<MY_DOMAIN>:<PORT>/<PATH>::xmg-2024-12-07-180819 <PATHS>
2024-12-07 18:08:19,952 - vorta.borg.borg_job - WARNING - Remote: ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
2024-12-07 18:08:19,957 - vorta.borg.borg_job - ERROR - Connection closed by remote host. Is borg working on the server?
2024-12-07 18:08:20,124 - vorta.borg.jobs_manager - DEBUG - Finish job for site: 1
2024-12-07 18:08:20,124 - vorta.borg.jobs_manager - DEBUG - No more jobs for site: 1
2024-12-07 18:08:20,130 - vorta.scheduler - DEBUG - Scheduler for profile 1 is disabled.
2024-12-07 18:08:51,042 - vorta.borg.borg_job - DEBUG - Cancel job on site default
2024-12-07 18:08:51,042 - vorta.borg.borg_job - DEBUG - Cancel job on site 1
2024-12-07 18:08:51,042 - vorta.borg.jobs_manager - INFO - Finished cancelling all jobs
@ConnorField
Copy link

Seem to have come across the same issue, starting approx 10 days ago

Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,403 - vorta.keyring.abc - DEBUG - No module named 'objc'
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,403 - vorta.keyring.abc - DEBUG - Using VortaKWallet5Keyring
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,403 - vorta.borg.borg_job - DEBUG - Using VortaKWallet5Keyring keyring to store passwords.
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,404 - vorta.keyring.kwallet - DEBUG - Retrieved password for repo ssh://[email protected]/./repo
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,405 - vorta.borg.jobs_manager - DEBUG - Add job for site 1
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,405 - vorta.borg.jobs_manager - DEBUG - Start job on site: 1
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,424 - vorta.borg.borg_job - INFO - Running command /usr/bin/borg create --list --progress --info --log-json --json --filter=AM -C lz4 ssh://[email protected]/./repo::confieArch-2025-01-21-161642 [BACKUPPATHS]
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,559 - vorta.borg.borg_job - WARNING - Remote: Pseudo-terminal will not be allocated because stdin is not a terminal.
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,715 - vorta.borg.borg_job - WARNING - Remote: ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,715 - vorta.borg.borg_job - WARNING - Remote: Host key verification failed.
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,716 - vorta.borg.borg_job - ERROR - Connection closed by remote host. Is borg working on the server?
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,850 - vorta.borg.jobs_manager - DEBUG - Finish job for site: 1
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,850 - vorta.borg.jobs_manager - DEBUG - No more jobs for site: 1
Jan 21 16:16:42 confieArch vorta[7108]: 2025-01-21 16:16:42,851 - vorta.scheduler - DEBUG - Nothing scheduled for profile 1 because of timeout until 2025-01-21 16:20:07.

After removing ~/.ssh/known_hosts I still get the same error.

Then run borg list "ssh://[email protected]/./repo"
Prompted to accept fingerprint.
Backups working again after closing and re-opening Vorta

@CountCypher
Copy link

CountCypher commented Feb 9, 2025

I'm using Vorta 0.10.3 as flatpak on Ubuntu 24.04.1 LTS (Wayland) and I'm running into the same issue when trying to connect to an existing repo in Vorta. But unfortunately, the workaround described by @lumbric doesn't seem to work for me.
I have tried the following with an empty remote repo called test:

  1. Exit Vorta
  2. Remove .ssh/known_hosts
  3. Run borg list [email protected]:/~/backups/test and accept fingerprint
  4. Start Vorta and add existing repo

The last step fails with this error in Vorta log:

2025-02-09 12:47:25,401 - vorta.borg.borg_job - DEBUG - Using VortaDBKeyring keyring to store passwords.
2025-02-09 12:47:25,411 - vorta.borg.borg_job - INFO - Running command /app/bin/borg info --info --json --log-json ssh://[email protected]/~/backups/test
2025-02-09 12:47:25,717 - vorta.borg.borg_job - WARNING - Remote: Bad owner or permissions on /home/maddin/.ssh/config
2025-02-09 12:47:25,718 - vorta.borg.borg_job - ERROR - Connection closed by remote host. Is borg working on the server?

If I run the command from the Vorta log in the terminal, it seems to succeed though:

$ borg info --info --json --log-json ssh://[email protected]/~/backups/test
Enter passphrase for key ssh://[email protected]/~/backups/test: 
{"type": "log_message", "time": 1739101774.2720957, "message": "Synchronizing chunks cache...", "levelname": "INFO", "name": "borg.cache"}
{"type": "log_message", "time": 1739101774.2723732, "message": "Archives: 0, w/ cached Idx: 0, w/ outdated Idx: 0, w/o cached Idx: 0.", "levelname": "INFO", "name": "borg.cache"}
{"type": "log_message", "time": 1739101774.2838507, "message": "Done.", "levelname": "INFO", "name": "borg.cache"}
{
    "cache": {
        "path": "/home/maddin/.cache/borg/9230b80f7b1d51d2e4bb6f74dabe6ffd70b26dd3da0f6cb718fad600e7eb356f",
        "stats": {
            "total_chunks": 0,
            "total_csize": 0,
            "total_size": 0,
            "total_unique_chunks": 0,
            "unique_csize": 0,
            "unique_size": 0
        }
    },
    "encryption": {
        "mode": "repokey"
    },
    "repository": {
        "id": "9230b80f7b1d51d2e4bb6f74dabe6ffd70b26dd3da0f6cb718fad600e7eb356f",
        "last_modified": "2025-02-09T12:32:54.000000",
        "location": "ssh://[email protected]/~/backups/test"
    },
    "security_dir": "/home/maddin/.config/borg/security/9230b80f7b1d51d2e4bb6f74dabe6ffd70b26dd3da0f6cb718fad600e7eb356f"
}

Any further ideas how troubleshoot / fix this?

EDIT: It seems the reason why it didn't work for me was indicated by this line in the Vorta log:

2025-02-09 12:47:25,717 - vorta.borg.borg_job - WARNING - Remote: Bad owner or permissions on /home/maddin/.ssh/config

After setting the permissions with chmod 600 .ssh/config, the connection to the remote repo and backup to it worked fine.

@NiklasMM
Copy link

I would still consider it a bug that it errors out because of an earlier warning and with a completely unrelated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants