Synapse gave me an error while upgrade and further the restore script gave error to while upgrade. So I lost synapse all together.
To restore the app from the backup archive, I need to extract the backup tar.gz from the archive fix the error in the restore and run the restore manually.
But when I create the synapse.tar.gz from this command $ tar czf synapse.tar.gz synapse/* and run $ yunohost backup restore synapse --debug . I got this error:
310 DEBUG loading actions map namespace 'yunohost'
331 DEBUG extra parameter classes loaded: ['comment', 'ask', 'password', 'required', 'pattern']
331 DEBUG initializing base actions map parser for cli
332 DEBUG registering new callback action 'yunohost.utils.packages.ynh_packages_version' to ['-v', '--version']
409 DEBUG initialize authenticator 'ldap-anonymous' with: uri='ldap://localhost:389', base_dn='dc=yunohost,dc=org', user_rdn='None'
416 DEBUG lock has been acquired
493 DEBUG loading python module yunohost.backup took 0.077s
494 INFO processing action [20312.1]: yunohost.backup.restore with args={'force': False, 'name': 'synapse', 'apps': None, 'system': None, 'auth': <moulinette.authenticators.ldap.Authenticator object at 0x7f00aac2b050>}
494 WARNING YunoHost is already installed
Do you really want to restore an already installed system? [y/N]: Y
12866 DEBUG unable to retrieve '/home/yunohost.backup/archives/synapse.info.json' inside the archive
Traceback (most recent call last):
File "/usr/lib/moulinette/yunohost/backup.py", line 2233, in backup_info
tar.extract('info.json', path=info_dir)
File "/usr/lib/python2.7/tarfile.py", line 2109, in extract
tarinfo = self.getmember(member)
File "/usr/lib/python2.7/tarfile.py", line 1829, in getmember
raise KeyError("filename %r not found" % name)
KeyError: "filename 'info.json' not found"
12868 DEBUG action [20312.1] executed in 12.375s
12868 DEBUG lock has been released
12869 ERROR Invalid backup archive
There are lot of my backups but synapse related files are:
drwxr-xr-x 3 root root 4096 May 7 18:24 synapse
-rw-r--r-- 1 root root 272 May 6 01:26 synapse-pre-upgrade2.info.json
-rw-r--r-- 1 root root 199269186 May 6 01:26 synapse-pre-upgrade2.tar.gz
-rw-r--r-- 1 root root 206604819 May 8 22:43 synapse.tar.gz
I have extracted synapse-pre-upgrade2.tar.gz to synapse folder, did changes in restore script and created the synapse.tar.gz as you told in above comment.
Follow-up of discussion on the forum : for tar, foo is not the same as ./foo …
A quickfix for this is to use tar -zcvf ../synapse.tar.gz * instead of tar -zcvf ../synapse.tar.gz .
A more longterm fix is https://github.com/YunoHost/yunohost/pull/726 though I don’t know how relevant it is considering this is really an edge case of “repackaging a backup archive manually”