garethgeorge / backrest

Backrest is a web UI and orchestrator for restic backup.
GNU General Public License v3.0
1.72k stars 50 forks source link

Adding a repo hangs on Windows #502

Closed mikejsavage closed 1 month ago

mikejsavage commented 1 month ago

Describe the bug

Adding a repo on Windows hangs, the network inspector says it's stuck in AddRepo:

image

The generated JSON config is

{
  "id": "nas",
  "uri": "sftp:root@100.64.0.4:/pool/restic",
  "password": "redacted",
  "flags": [
    "-o sftp.args=\"-i C:/id_ed25519\""
  ],
  "prunePolicy": {
    "maxUnusedPercent": 10,
    "schedule": {
      "clock": "CLOCK_LAST_RUN_TIME",
      "disabled": true
    }
  },
  "checkPolicy": {
    "readDataSubsetPercent": 0,
    "schedule": {
      "clock": "CLOCK_LAST_RUN_TIME",
      "disabled": true
    }
  },
  "autoUnlock": true
}

If I refresh the page the repo is not there, if I get it wrong (e.g. no sftp.args) then AddRepo returns 500 immediately and that's fine.

Unfortunately I have no debug symbols and it seems like Go can't generate them for Windows so the stack trace I can give you is limited to

image

Platform Info

Windows 10 IOT x64, backrest 1.5.1 from the releases page

garethgeorge commented 1 month ago

Hey, this usually indicates that you hit the SFTP password prompt. Backrest tries to set a batchmode option which disables prompts for sftp but it’s overridden when specifying the args flag manually.

I talk about this a little in https://github.com/garethgeorge/backrest/issues/165#issuecomment-2166702417 and there are a few other topics related to SFTP setup in the discussions section that might help!

mikejsavage commented 1 month ago

It was stuck on the host key verification prompt, so setting flags to -o ssh.args="-i blah -o BatchMode=yes -o StrictHostKeyChecking=accept-new" worked.

Thanks!

mikejsavage commented 1 month ago

Btw it might be worth mentioning this in the docs, https://github.com/garethgeorge/backrest/blob/main/docs/content/1.introduction/1.getting-started.md just tells you to use -o sftp.args="-i /path/to/key" which is a bit of a landmine