Cannot add remote backup for restore

My main freedombox works ok but I want to make sure I am able to restore it, so I decided to try on another Pioneer box (actually, it also has an SSD).

I went with a fresh install microSD card:

  • waited until plinth on the Pioneer with the new microSD card says it is ready to setup
  • configured the admin user
  • entered the options to say the freedombox is behind a routeur and that I will setup forwarding rules for each app
  • waited for the software upgrades to be complete (I did not do anything else, i.e. I was offered to install apps and to do network settings, I did neither)
  • tried adding the existing remote backup location.

Unfortunately, I cannot remember and I did not write down how I exactly entered the configuration for the backup location and whether I have put encryption or not. What I see:

  • on the freedombox: my backup location is user@host:/data/
  • my password manager has an entry that says “backup key for freedombox” which might be a passphrase for encryption

I tried adding the remote backup location as user@host:/data/ on the newly installed freedombox, with the password of user on host (I tested with sftp in command line from another machine, it works), and first tried without encryption, it failed, then with encryption, it also failed.

Am I doing something wrong to use the remote backup location to restore?
How to find out whether encryption was used for the backup or not?

Here is what journalctl says for the attempt without encryption:

janv. 29 15:17:02 freedombox /usr/share/plinth/actions/actions[22415]: Error executing action: Command '['borg', 'init', '--encryption', 'none', '/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a']' returned non-zero exit statu>
                                                                       Traceback (most recent call last):
                                                                         File "/usr/share/plinth/actions/actions", line 92, in _call
                                                                           return_values = func(*arguments['args'], **arguments['kwargs'])
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 127, in init
                                                                           _init_repository(path, encryption, encryption_passphrase)
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 120, in _init_repository
                                                                           _run(cmd, encryption_passphrase)
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 350, in _run
                                                                           return subprocess.run(cmd, check=check, env=env, **kwargs)
                                                                         File "/usr/lib/python3.9/subprocess.py", line 528, in run
                                                                           raise CalledProcessError(retcode, process.args,
                                                                       subprocess.CalledProcessError: Command '['borg', 'init', '--encryption', 'none', '/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a']' returned non-zero exi>
janv. 29 15:17:02 freedombox sudo[22413]: pam_unix(sudo:session): session closed for user root
janv. 29 15:17:02 freedombox /usr/bin/plinth[21898]: Error running action backups..init(*('/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a', 'none', None), **{}): Command '['borg', 'init', '--encryption', 'none', '/media/d27a>
janv. 29 15:17:02 freedombox /usr/bin/plinth[21898]: # backups..info(…) 
janv. 29 15:17:03 freedombox sudo[22423]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups info --write-fd 16
janv. 29 15:17:03 freedombox sudo[22423]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 15:17:11 freedombox /usr/share/plinth/actions/actions[22425]: Error executing action: Command '['borg', 'info', '--json', '/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a']' returned non-zero exit status 2.
                                                                       Traceback (most recent call last):
                                                                         File "/usr/share/plinth/actions/actions", line 92, in _call
                                                                           return_values = func(*arguments['args'], **arguments['kwargs'])
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 133, in info
                                                                           process = _run(['borg', 'info', '--json', path], encryption_passphrase,
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 350, in _run
                                                                           return subprocess.run(cmd, check=check, env=env, **kwargs)
                                                                         File "/usr/lib/python3.9/subprocess.py", line 528, in run
                                                                           raise CalledProcessError(retcode, process.args,
                                                                       subprocess.CalledProcessError: Command '['borg', 'info', '--json', '/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a']' returned non-zero exit status 2.
janv. 29 15:17:11 freedombox sudo[22423]: pam_unix(sudo:session): session closed for user root


janv. 29 15:17:11 freedombox /usr/bin/plinth[21898]: Error running action backups..info(*('/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a', None), **{}): Command '['borg', 'info', '--json', '/media/d27a0b90-9fe7-11ed-9fed-02>
janv. 29 15:17:11 freedombox /usr/bin/plinth[21898]: Error adding repository: Command '['borg', 'info', '--json', '/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a']' returned non-zero exit status 2.
                                                     Traceback (most recent call last):
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/views.py", line 417, in _save_repository
                                                         repository.initialize()
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/repository.py", line 432, in initialize
                                                         super().initialize()
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/repository.py", line 208, in initialize
                                                         self.get_info()  # If password is incorrect raise an error early.
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/repository.py", line 139, in get_info
                                                         output = privileged.info(self.borg_path,
                                                       File "/usr/lib/python3/dist-packages/plinth/actions.py", line 57, in wrapper
                                                         return _run_privileged_method_as_process(module_name, action_name,
                                                       File "/usr/lib/python3/dist-packages/plinth/actions.py", line 116, in _run_privileged_method_as_process
                                                         return _wait_for_return(*wait_args)
                                                       File "/usr/lib/python3/dist-packages/plinth/actions.py", line 154, in _wait_for_return
                                                         raise exception
                                                     subprocess.CalledProcessError: Command '['borg', 'info', '--json', '/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a']' returned non-zero exit status 2.
janv. 29 15:17:11 freedombox /usr/bin/plinth[21898]: # backups..is_mounted(…) 
janv. 29 15:17:12 freedombox sudo[22431]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups is_mounted --write-fd 16
janv. 29 15:17:12 freedombox sudo[22431]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 15:17:16 freedombox sudo[22431]: pam_unix(sudo:session): session closed for user root
janv. 29 15:17:16 freedombox /usr/bin/plinth[21898]: # backups..umount(…) 
janv. 29 15:17:17 freedombox sudo[22436]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups umount --write-fd 16
janv. 29 15:17:17 freedombox sudo[22436]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 15:17:21 freedombox systemd[1]: media-d27a0b90\x2d9fe7\x2d11ed\x2d9fed\x2d02990b41e22a.mount: Succeeded.
janv. 29 15:17:21 freedombox sudo[22436]: pam_unix(sudo:session): session closed for user root
janv. 29 15:17:22 freedombox /usr/bin/plinth[21898]: # backups..is_mounted(…) 
janv. 29 15:17:22 freedombox sudo[22442]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups is_mounted --write-fd 16
janv. 29 15:17:22 freedombox sudo[22442]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 15:17:26 freedombox sudo[22442]: pam_unix(sudo:session): session closed for user root
janv. 29 15:17:27 freedombox /usr/bin/plinth[21898]: [Errno 13] Permission denied: '/media/d27a0b90-9fe7-11ed-9fed-02990b41e22a'
janv. 29 15:17:27 freedombox apache-access[21788]: 127.0.1.1:443 192.168.1.51 - - [29/Jan/2023:15:16:42 +0000] "POST /plinth/sys/backups/repositories/d27a0b90-9fe7-11ed-9fed-02990b41e22a/ssh-verify/ HTTP/2.0" 302 1318 "ht>
janv. 29 15:17:27 freedombox apache-access[21788]: 127.0.1.1:443 192.168.1.51 - - [29/Jan/2023:15:17:27 +0000] "GET /plinth/sys/backups/repositories/add-remote/ HTTP/2.0" 200 5627 "https://192.168.1.69/plinth/sys/backups/>

Here is what the attempt with encryption gave:

janv. 29 16:44:17 freedombox /usr/share/plinth/actions/actions[22713]: Error executing action: Command '['borg', 'init', '--encryption', 'repokey', '/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a']' returned non-zero exit st>
                                                                       Traceback (most recent call last):
                                                                         File "/usr/share/plinth/actions/actions", line 92, in _call
                                                                           return_values = func(*arguments['args'], **arguments['kwargs'])
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 127, in init
                                                                           _init_repository(path, encryption, encryption_passphrase)
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 120, in _init_repository
                                                                           _run(cmd, encryption_passphrase)
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 350, in _run
                                                                           return subprocess.run(cmd, check=check, env=env, **kwargs)
                                                                         File "/usr/lib/python3.9/subprocess.py", line 528, in run
                                                                           raise CalledProcessError(retcode, process.args,
                                                                       subprocess.CalledProcessError: Command '['borg', 'init', '--encryption', 'repokey', '/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a']' returned non-zero >
janv. 29 16:44:18 freedombox sudo[22711]: pam_unix(sudo:session): session closed for user root
janv. 29 16:44:18 freedombox /usr/bin/plinth[21898]: Error running action backups..init(*('/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a', 'repokey', '3^e#:5}I-[HXlBOL\\_:Xz$%
janv. 29 16:44:18 freedombox /usr/bin/plinth[21898]: # backups..info(…) 
janv. 29 16:44:18 freedombox sudo[22717]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups info --write-fd 13
janv. 29 16:44:18 freedombox sudo[22717]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 16:44:26 freedombox /usr/share/plinth/actions/actions[22719]: Error executing action: Command '['borg', 'info', '--json', '/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a']' returned non-zero exit status 2.
                                                                       Traceback (most recent call last):
                                                                         File "/usr/share/plinth/actions/actions", line 92, in _call
                                                                           return_values = func(*arguments['args'], **arguments['kwargs'])
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 133, in info
                                                                           process = _run(['borg', 'info', '--json', path], encryption_passphrase,
                                                                         File "/usr/lib/python3/dist-packages/plinth/modules/backups/privileged.py", line 350, in _run
                                                                           return subprocess.run(cmd, check=check, env=env, **kwargs)
                                                                         File "/usr/lib/python3.9/subprocess.py", line 528, in run
                                                                           raise CalledProcessError(retcode, process.args,
                                                                       subprocess.CalledProcessError: Command '['borg', 'info', '--json', '/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a']' returned non-zero exit status 2.
janv. 29 16:44:27 freedombox sudo[22717]: pam_unix(sudo:session): session closed for user root
janv. 29 16:44:27 freedombox /usr/bin/plinth[21898]: Error running action backups..info(*('/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a', '3^e#:5}I-[HXlBOL\\_:Xz$%
janv. 29 16:44:27 freedombox /usr/bin/plinth[21898]: Error adding repository: Command '['borg', 'info', '--json', '/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a']' returned non-zero exit status 2.
                                                     Traceback (most recent call last):
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/views.py", line 417, in _save_repository
                                                         repository.initialize()
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/repository.py", line 432, in initialize
                                                         super().initialize()
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/repository.py", line 208, in initialize
                                                         self.get_info()  # If password is incorrect raise an error early.
                                                       File "/usr/lib/python3/dist-packages/plinth/modules/backups/repository.py", line 139, in get_info
                                                         output = privileged.info(self.borg_path,
                                                       File "/usr/lib/python3/dist-packages/plinth/actions.py", line 57, in wrapper
                                                         return _run_privileged_method_as_process(module_name, action_name,
                                                       File "/usr/lib/python3/dist-packages/plinth/actions.py", line 116, in _run_privileged_method_as_process
                                                         return _wait_for_return(*wait_args)
                                                       File "/usr/lib/python3/dist-packages/plinth/actions.py", line 154, in _wait_for_return
                                                         raise exception
                                                     subprocess.CalledProcessError: Command '['borg', 'info', '--json', '/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a']' returned non-zero exit status 2.
janv. 29 16:44:27 freedombox /usr/bin/plinth[21898]: # backups..is_mounted(…) 
janv. 29 16:44:27 freedombox sudo[22724]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups is_mounted --write-fd 13
janv. 29 16:44:27 freedombox sudo[22724]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 16:44:32 freedombox sudo[22724]: pam_unix(sudo:session): session closed for user root
janv. 29 16:44:32 freedombox /usr/bin/plinth[21898]: # backups..umount(…) 
janv. 29 16:44:32 freedombox sudo[22729]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups umount --write-fd 13
janv. 29 16:44:32 freedombox sudo[22729]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 16:44:36 freedombox systemd[1]: media-20a2f032\x2d9ff4\x2d11ed\x2d9e9e\x2d02990b41e22a.mount: Succeeded.
janv. 29 16:44:37 freedombox sudo[22729]: pam_unix(sudo:session): session closed for user root
janv. 29 16:44:37 freedombox /usr/bin/plinth[21898]: # backups..is_mounted(…) 
janv. 29 16:44:37 freedombox sudo[22735]:   plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions backups is_mounted --write-fd 13
janv. 29 16:44:37 freedombox sudo[22735]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=115)
janv. 29 16:44:42 freedombox sudo[22735]: pam_unix(sudo:session): session closed for user root
janv. 29 16:44:42 freedombox /usr/bin/plinth[21898]: [Errno 13] Permission denied: '/media/20a2f032-9ff4-11ed-9e9e-02990b41e22a'
janv. 29 16:44:42 freedombox apache-access[21788]: 127.0.1.1:443 192.168.1.51 - - [29/Jan/2023:16:43:58 +0000] "GET /plinth/sys/backups/repositories/20a2f032-9ff4-11ed-9e9e-02990b41e22a/ssh-verify/ HTTP/2.0" 302 1427 "htt>
janv. 29 16:44:43 freedombox apache-access[21788]: 127.0.1.1:443 192.168.1.51 - - [29/Jan/2023:16:44:42 +0000] "GET /plinth/sys/backups/repositories/add-remote/ HTTP/2.0" 200 5648 "https://192.168.1.69/plinth/sys/backups/>

I found a solution:

  1. on the remote machine on which the backup is made, assuming borg is installed, run (you may need sudo):
    $ borg list /path/to/backup
    This lists all backups (there is a warning about using an existing backup location, say “yes” to proceeed). Entries look like:
    scheduled: daily: 2023-12-20:02:26   Wed, 2023-12-20 01:28:24 [f1ba065de353242d24e4c968666bd2eefb4de2e0fac6b67bbc80f4eb8a852b4c]
    which is the daily backup made on 20th December 2023. To restore that entry, create an archive file with
    $ borg export-tar /path/to/backup::“scheduled: daily: 2023-12-20:02:26” archive.tar.gz
  2. on the freedombox (if fresh install, set the admin username/password, the type of connection, wait for upgrades to finish), in backups, upload archive.tar.gz, ask to restore.

Note: the above quotes are straight double quotes (character "), the formatting above is not correct (but I can’t find how to fix that).

1 Like

While doing this, did you receive the 502 Proxy error? Like you, I wanted to take a backup from FreedomBox 1 and upload it to FreedomBox 2. From Plinth, I created a backup, and downloaded the .tar.gz. When uploading it to Freedombox 2, I encountered it when asking it to restore from the page which lists what you want to restore.

I get this message:

Proxy Error
The proxy server received an invalid response from an upstream server. The proxy server could not handle the request.
Reason: Error reading from remote server.

I made sure the new FreedomBox has its ports 80 and 443 open.

I am wondering whether this is the same action like I did. In my case, I don’t see any “list of what I want to restore” on Freedombox 2, Freedombox 2 has nothing listed, I just click on a button that is labeled “upload and restore” and select a file on my disk (I mean, the disk of the machine running the web browser).

Is it what you did?

I do remember that plinth wasn’t responsive during certain actions, perhaps during restore, and sometimes gave an error when trying to access/refresh the page but I am guessing it is because the restore operation somehow interrupts plinth so one just needs to wait.

I was doing everything while on the same local network, I am not 100% sure but I think I was accessing plinth directly with the local IP address.