Step by step:
yunohost app install borg
on aa.tld
Read email from root@aa.tld
Copy line yunohost app install https://github-address
to get the latest version to CLI on bb.tld; change ‘borg_server_ynh’ to ‘borgserver_ynh’ in the address
Answer the questions
Correct the public key in authorized_keys (there was a ‘+’ in the key, it was removed)
service borg start
on aa.tld
tail -f /var/log/auth
on bb.tld
Nothing happens in the auth log of bb.tld; no messages in journalctl -xe on aa.tld (I didn’t change ‘set -e’ to ‘set -x’ in the hook yet); systemctl status borg.service shows:
Nov 26 21:51:28 aa.tld backup-with-borg[27287]: [################++..] > Backing up fail2ban configuration...
Nov 26 21:51:31 aa.tld backup-with-borg[27287]: Now creating a backup archive from the files collected…
Nov 26 21:51:31 aa.tld backup-with-borg[27287]: Script execution failed: /etc/yunohost/hooks.d/backup_method/05-borg_app
Nov 26 21:51:31 aa.tld backup-with-borg[27287]: Custom backup method failure on 'backup' step
Nov 26 21:51:32 aa.tld systemd[1]: borg.service: Main process exited, code=exited, status=1/FAILURE
Nov 26 21:51:32 aa.tld systemd[1]: Failed to start Run backup borg.
Nov 26 21:51:32 aa.tld systemd[1]: borg.service: Unit entered failed state.
Nov 26 21:51:32 aa.tld systemd[1]: borg.service: Failed with result 'exit-code'.
On aa.tld:
./05-borg_app: line 31: borg: command not found
./05-borg_app: line 44: borg: command not found
./05-borg_app: line 31: borg: command not found
That is strange! aa.tld was borgserver before, I didn’t test borg on this one yet. The installation seemed OK:
# yunohost app install borg
Indicate the server where you want put your backups: bb.tld
Indicate the ssh user to use to connect on this server: aatldbak
You are now about to define a new user password. The password should be at least 8 characters - though it is good practice to use longer password (i.e. a passphrase) and/or to use various kind of characters (uppercase, lowercase, digits and special characters).
Indicate a strong passphrase, that you will keep preciously if you want to be able to use your backups:
Would you like to backup your YunoHost configuration ? [yes | no] (default: yes):
Would you like to backup mails and user home directory ? [yes | no] (default: yes):
Which apps would you backup (list separated by comma or 'all') ? (default: all):
Indicate the backup frequency (see systemd OnCalendar format) (default: Daily):
Info: Installing application borg…
Warning: Created symlink /etc/systemd/system/multi-user.target.wants/borg.service → /etc/systemd/system/borg.service.
Warning: Created symlink /etc/systemd/system/timers.target.wants/borg.timer → /etc/systemd/system/borg.timer.
Success! The SSOwat configuration has been generated
Success! Installation complete
Yunohost also thinks borg is installed, yunohost app list
description: Backup your server with borg.
id: borg
installed: True
label: Borg
license: BSD-3-Clause
name: Borg
but,
Sorting... Done
Full Text Search... Done
borg-ynh-deps/now 1.1.10~ynh1 all [installed,local]
Fake package for borg (YunoHost app) dependencies
borgbackup/oldstable 1.0.9-1 armhf
deduplicating and compressing backup program
Installing borg via apt, try running service borg once more.
On bb.tld, /var/log/auth prints many attempts:
Nov 26 22:14:45 bb systemd: pam_unix(systemd-user:session): session closed for user aatldbak
Nov 26 22:14:49 bb sshd[25587]: Connection from 2001::1768:1:853f:c923 port 55808 on 2001::1768:1:ddde::234d port 22
Nov 26 22:14:49 bb sshd[25587]: Postponed publickey for aatldbak from 2001:982:1768:1:853f:c9a7:90bd:c923 port 55808 ssh2 [preauth]
Nov 26 22:14:49 bb sshd[25587]: Accepted publickey for aatldbak from 2001:982:1768:1:853f:c9a7:90bd:c923 port 55808 ssh2: ED25519 SHA256:U46GhNSqK+AdaY5Agdcn2J1eCu0Mm+jtfK+iRFemhVk
Nov 26 22:14:49 bb sshd[25587]: pam_unix(sshd:session): session opened for user aatldbak by (uid=0)
Nov 26 22:14:49 bb systemd-logind[604]: New session 36096 of user aatldbak.
Nov 26 22:14:49 bb systemd: pam_unix(systemd-user:session): session opened for user aatldbak by (uid=0)
Nov 26 22:14:50 bb sshd[25587]: User child is on pid 25680
Nov 26 22:14:50 bb sshd[25680]: Starting session: forced-command (key-option) 'borg serve --storage-quota 10G --restrict-to-repository /home/aatldbak/backup' for aatldbak from 2001::1768:1:853f::c923 port 55808 id 0
Nov 26 22:14:50 bb sshd[25680]: Close session: user aatldbak from 2001::1768:1:853f::c923 port 55808 id 0
Nov 26 22:14:50 bb sshd[25680]: Received disconnect from 2001:::1:853f::c923 port 55808:11: disconnected by user
Nov 26 22:14:50 bb sshd[25680]: Disconnected from 2001::1768:1:853f::c923 port 55808
Nov 26 22:14:50 bb sshd[25587]: pam_unix(sshd:session): session closed for user aatldbak
Nov 26 22:14:50 bb systemd-logind[604]: Removed session 36096.
Nov 26 22:14:50 bb systemd: pam_unix(systemd-user:session): session closed for user aatldbak
The error log looks more familiar now:
Remote: Debian GNU/Linux 9
Remote: bash: /usr/local/bin/borg: Permission denied
Connection closed by remote host. Is borg working on the server?
Remote: Debian GNU/Linux 9
Perhaps borg is not installed on bb.tld? Unfortunately borg is installed, no easy solution there 
I do recall from yesterday, that the backupuser on bb.tld, aatldbak, does not have permission to run borg. That may be because it is such a narrow account: it can not normally log in. Ordinary users on the bb.tld are not allowed to run borg either (I got an ordinary user left over from the Armbian base install).
I found mention of 'try borg as non-root, with capabilities’, does that imply borg does need root on the borg server? I understood borg was running on aa.tld as root, and only needed bb.tld as datastore. Is borg needed on borgserver?
[edit]
I had some hope on a solution after reading Borg backup remotely gives error,
Oh, I found the answer here. https://pod.disroot.org/posts/e18176ef-415c-e091-c340-9b5239891533
So, doing which borg on Machine1 was giving me /usr/bin/borg and on Machine2 the output was /usr/local/bin/borg. All it takes is to create a symlink
On aa.tld:
# which borg
/usr/bin/borg # as installed by apt, after borg_ynh did not
On bb.tld:
# which borg
/usr/local/bin/borg #as installed by borgserver_ynh
Now each of them is symlinked to the other location.
The error log still reads:
Remote: bash: /usr/local/bin/borg: Permission denied
Connection closed by remote host. Is borg working on the server?
Remote: Debian GNU/Linux 9
Remote: bash: /usr/local/bin/borg: Permission denied
Connection closed by remote host. Is borg working on the server?
^C
I am quite convinced it should work, after all, @ljf tells it is working OK and I read no other people with problems like this. Any idea what to troubleshoot?