[Borg] Host key verification failed + ModuleNotFoundError : No module named 'borg'

What type of hardware are you using: VPS bought online
What YunoHost version are you running: 12.0.10
How are you able to access your server: SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: Rien de spécial

Describe your issue

J’ai deux serveurs qui envoient les backups l’un vers l’autre.

Depuis le 23/12/2024, les backups ne marchent plus.

Yunohost est à jour. Les applications sont à jour (borg y compris).

Share relevant logs or error messages

Dans les logs, j’ai ce messages :

2025-01-18 09:38:28,168: WARNING - Remote: No ED25519 host key is known for [serverB.be]:PORT and you have requested strict checking.
2025-01-18 09:38:28,170: WARNING - Remote: Host key verification failed.

Le script de backup utilise ces lignes :

if ssh-keygen -F "serverB.be" >/dev/null ; then
    BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes "
else
    BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=no "
fi

J’ai bien une clé ssh à cet emplacement :

root@serverA:# ls -al /root/.ssh/id_${app}_ed25519
-rw------- 1 root root 411 Aug 10  2020 /root/.ssh/id_borg_ed25519

Je ne comprends pas pourquoi il ne veut pas l’utiliser.

[Edit: J’essaye de comprendre. J’ai essayé de changer l’option “StrictHostKeyChecking” et mettre à “no” :

root@serverA:# app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -p PORT -oStrictHostK
eyChecking=no " $borg list ssh://userA@serverB.be/~/backup                                                                       
Remote: Warning: Permanently added '[serverB.be]:PORT' (ED25519) to the list of known hosts.                                                                 
Remote: Traceback (most recent call last):                                                                                                                       
Remote:   File "/var/www/borgserver/venv/bin/borg", line 5, in <module>                                                                                          
Remote:     from borg.archiver import main                                                                                                                       
Remote: ModuleNotFoundError: No module named 'borg'                                                                                                              
Connection closed by remote host. Is borg working on the server? 

Le problème évolue… Il faut simplement autoriser la clé SSH pour passer à l’étape suivante. Sur le deuxième serveur, j’ai fait comme ça :

# ssh -p PORT -i /root/.ssh/id_borg_ed25519 serverB@serverA.be
The authenticity of host '[serverA.be]:PORT ([5.196.88.19]:PORT)' can't be established.
ED25519 key fingerprint is SHA256:C7RGzit(...).
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[serverA.be]:PORT' (ED25519) to the list of known hosts.

Maintenant, l’erreur importante semble être :

ModuleNotFoundError: No module named 'borg'

Une idée pour continuer à avancer ?

J’ai trouvé une piste sur ce message :

J’ai donc fait ceci sur le serveurB (qui reçoit les backups du serveurA donc) :

root@serverB:/# yunohost app upgrade borgserver --force
Info: Now upgrading borgserver…
Info: Creating a safety backup prior to the upgrade
Info: Collecting files to be backed up for borgserver…
Info: Declaring files to be backed up...
Info: Borg backup repo in /home/userA/ won't be backup to avoid backup of backup loop issue.
Info: Backup script completed for borgserver. (YunoHost will then actually copy those files to the archive).
Info: Creating a backup archive from the collected files…
Info: The archive will contain about 63.3MB of data.
Success! Backup created: borgserver-pre-upgrade1
Success! Backup deleted: borgserver-pre-upgrade2
Info: Updating sources...
Info: Updating system_user...
Info: Updating install_dir...
Info: Updating permissions...
Info: Updating apt...
Info: [++++................] > Ensuring downward compatibility...
Info: [####++++............] > Upgrading Borg...
Info: [########++++........] > Making sure SSH user exists with appropriate permissions...
Info: [############++++....] > Configuring cron to monitor backup...
Info: [####################] > Upgrade of borgserver completed
Success! borgserver upgraded
Success! Upgrade complete

Après avoir fait l’upgrade sur le serveurB, j’ai pu afficher la liste des backups :

root@serverA:/# app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -p PORT 
-oStrictHostKeyChecking=yes " $borg list ssh://userA@serverB.be/~/backup                                                              
_auto_conf-2023-12-31_00:00          Sun, 2023-12-31 00:00:40 [f2167ba414184ea9c1a77ea3c6c1fa5efe78024135b5051d2d93fa75525e8cdc]          
_auto_data-2023-12-31_00:02          Sun, 2023-12-31 00:02:24 [52565b310c3ba748f09ea1dad95d83e95c4955cc061dc574750c838867149ed4]          
_auto_borg-2023-12-31_00:03          Sun, 2023-12-31 00:03:57 [7931eb9a9c812c8b94368bbd21312878718a0d4800825457c3223baa5ef879d1]
(...)

On dirait que c’est la solution que je cherchais.

J’ai donc fait ensuite la même chose sur le serveurA (qui reçoit les backups du serveurB donc). :smiley:

2 Likes