My Backup

Rating: 
4.925925
Your rating: None Average: 4.9 (27 votes)

Allows to add arbitrary files and dconf keys to Sailfish OS backups. Requires Sailfish OS 3.2 or greater.

Important: do not uninstall MyBackup versions 1.0.5 and older. Due to what seems to be a bug in busybox, the uninstall script can end up doing rm -fr / on some versions of Sailfish OS. Update the app prior to uninstalling it - update is safe, it doesn't run that script.

Sailfish OS applications can declare what they need to be added to the backup by providing [X-HarbourBackup] section in their desktop file, which looks like this:

[X-HarbourBackup]
BackupPathList=.local/share/foil/:Documents/FoilAuth/
BackupConfigList=/apps/harbour-foilauth/

BackupPathList is a colon-separated list of files and directories to backup. Paths are relative to the home directory. Directory names end with a slash and are copied recursively. Absolute paths are ignored.

BackupConfigList is a colon-separated list of dconf keys and groups. Similarly to directories, group names end with a slash and are saved and restored recursively. There is one important difference, though - the existing contents of dconf groups is lost during restore and is completely replaced by whatever was saved in the backup.

Source code: https://github.com/monich/harbour-mybackup

Translations are welcome in the form of GitHub pull requests.

Stay safe, backup often!

Screenshots: 

Keywords:

Application versions: 
AttachmentSizeDate
File openrepos-mybackup-1.0.6-1.aarch64.rpm152.73 KB20/07/2022 - 22:33
File openrepos-mybackup-1.0.6-1.armv7hl.rpm138.16 KB20/07/2022 - 22:33
File openrepos-mybackup-1.0.6-1.i486.rpm151.8 KB20/07/2022 - 22:33
File openrepos-mybackup-1.0.5-1.aarch64.rpm146.76 KB16/09/2021 - 00:41
File openrepos-mybackup-1.0.5-1.armv7hl.rpm137.4 KB16/09/2021 - 00:41
File openrepos-mybackup-1.0.5-1.i486.rpm149.63 KB16/09/2021 - 00:41
File openrepos-mybackup-1.0.4-16.1.aarch64.rpm147.75 KB26/02/2021 - 07:07
File openrepos-mybackup-1.0.4-16.1.armv7hl.rpm136.44 KB26/02/2021 - 07:07
File openrepos-mybackup-1.0.4-16.1.i486.rpm150.71 KB26/02/2021 - 07:07
File openrepos-mybackup-1.0.3-12.1.armv7hl.rpm136.2 KB17/01/2021 - 15:46
File openrepos-mybackup-1.0.3-12.1.i486.rpm150.4 KB17/01/2021 - 15:46
File openrepos-mybackup-1.0.2-11.1.armv7hl.rpm135.12 KB11/01/2021 - 03:00
File openrepos-mybackup-1.0.2-11.1.i486.rpm149.37 KB11/01/2021 - 03:00
File openrepos-mybackup-1.0.1-10.1.armv7hl.rpm134.27 KB10/01/2021 - 18:50
File openrepos-mybackup-1.0.1-10.1.i486.rpm148.59 KB10/01/2021 - 18:50
File openrepos-mybackup-1.0.0-9.1.armv7hl.rpm131.92 KB10/01/2021 - 02:44
File openrepos-mybackup-1.0.0-9.1.i486.rpm146.44 KB10/01/2021 - 02:44
Changelog: 
  • 1.0.6 (Jul 20 2022)
    - Fixed uninstall script
    - Added Chum metadata
  • 1.0.5 (Sep 16 2021)
    - Opt out of sandboxing
    - Tweaked icon sizes
  • 1.0.4 (Feb 26 2021)
    - Added missing Chinese string
  • 1.0.3 (Jan 17 2021)
    - Speed up the backup process by hard-linking
    - Fixed a problem with backing up the entire home
  • 1.0.2 (Jan 10 2021)
    - Chinese translation (@dashinfantry)
    - Update Swedish translation (Åke Engelbrektson)
    - Updated Polish translation (Atlochowski)
  • 1.0.1 (Jan 10 2021)
    - Swedish translation (Åke Engelbrektson)
    - Polish translation (Atlochowski)
    - Russian translation
    - UI tweaks
  • 1.0.0 (Jan 9 2021)
    - Initial release

Comments

silta's picture

Last weekend I had to reflash my X10II and I tried this app.
All backups of app settings, folders and files are there after this.
I have to say a big thank you for your work. It safed me a lot of time.
Are there any way to make a donation?

slava's picture

I suggest that you donate some money to OpenRepos as a platform. Hosting, storage, etc. cost money too. And the platform works as a concentrator and amplifier of individual efforts, which is great.

silta's picture

Done, thank you.

rob_k's picture

Hi slava,

Will things change with Sandboxing, i.e. do I need to define other details for [X-HarbourBackup]?

slava's picture

No, I think everything should work as is.

prometheos's picture

I want to backup my Xperia10 Plus 2x SIM by CLI over ssh. (the command "vault" doe not exist in my 4.2.0.21 system).

I found the command /usr/bin/openrepos-mybackup, and with help of the parameter --help I tried to backup on my sdcard (encrypted, by the way).

Doing it as defaultuser brings:

$ usr/bin/openrepos-mybackup --action=export --home-dir=/home/defaultuser --dir=/home/defaultuser/android_storage/mccard/SFOS-BACKUP

where the target-dir has:

$ ls -ld /home/defaultuser/android_storage/mccard/SFOS-BACKUP
drwxr-xr-x    3 defaultu privileg      4096 Oct 28 17:18 /home/defaultuser/android_storage/mccard/SFOS-BACKUP

Error removing "/home/defaultuser/android_storage/mccard/SFOS-BACKUP/users/0/config.json" "No such file or directory"

But the target dir remains empty.

I got some more results after another group choice for the target dir:

$ sudo chown -R defaultuser:media_rw /home/defaultuser/android_storage/mccard/SFOS-BACKUP

$ time /usr/bin/openrepos-mybackup --action=export --home-dir=/home/defaultuser --dir=/home/defaultuser/android_storage/mccard/SFOS-BACKUP # 
[W] unknown:0 - Error removing "/home/defaultuser/android_storage/mccard/SFOS-BACKUP/users/100000/config.json" "No such file or directory"
real    4m 36.56s
user    0m 3.89s
sys     0m 15.68s

No .tar was built, but a good portion of the home was replicated and partially filled under the <target dir>/users/.

Note the huge elapsed time for 388.8M onto a quick card: the GUI under Settings takes only few seconds and collects a sailfish-backup with 438.7M.

Could you help me further? I must miss here something.

My aim is to integrate a sailfish backup into my extablished backup rithmus and tools on my desktop.

slava's picture

openrepos-mybackup is registered as what's called a backup unit. Backup units don't build the .tar file, that's done by org.sailfishos.backup D-Bus service (provided by /usr/libexec/sailfish-backup). Backup units are only responsible for copying files to the temporary directory, or restoring files from there.

prometheos's picture

Ok @slava, then I expect to find something like an org.sailfishos.backup.xxx

But if I search for it, I find nothing like that:

$ systemctl --user  list-units --all -l | grep -i sailfish | cat -n #
     1    dev-disk-by\x2did-dm\x2dname\x2dsailfish\x2dhome.device                                                                                               loaded    active   plugged   /dev/disk/by-id/dm-name-sailfish-home                                                                         
     2    dev-disk-by\x2did-dm\x2dname\x2dsailfish\x2droot.device                                                                                               loaded    active   plugged   /dev/disk/by-id/dm-name-sailfish-root                                                                         
     3    dev-mapper-sailfish\x2dhome.device                                                                                                                    loaded    active   plugged   /dev/mapper/sailfish-home                                                                                     
     4    dev-mapper-sailfish\x2droot.device                                                                                                                    loaded    active   plugged   /dev/mapper/sailfish-root                                                                                     
     5    dev-sailfish-home.device                                                                                                                              loaded    active   plugged   /dev/sailfish/home                                                                                            
     6    dev-sailfish-root.device                                                                                                                              loaded    active   plugged   /dev/sailfish/root                                                                                            
     7    booster-silica-media.service                                                                                                                          loaded    active   running   Application launch booster for Sailfish Media                                                                 
     8  sailfish-eas-accounts-accounts-check.service                                                                                                          not-found inactive dead      sailfish-eas-accounts-accounts-check.service                                                                  
     9  sailfish-eas-accounts-check.service                                                                                                                   loaded    failed   failed    check for Sailfish-EAS accounts                                                                               
    10    sailfish-eas.service                                                                                                                                  loaded    inactive dead      sailfish-eas daemon                                                                                           
    11    sailfish-homescreen-services.service                                                                                                                  loaded    active   running   Sailfish homescreen user agent service                                                                        
    12    sailfish-secretsd.service                                                                                                                             loaded    active   running   Sailfish Secrets Daemon                                                      

  What is wrong?   

(edited by adding list-units --all parameters to show also inactive  units, and piping into cat -n to index a count of the findings.)                                                     

slava's picture

Try dbus-send --session --print-reply --type=method_call --dest=org.sailfishos.backup /sailfishbackup org.freedesktop.DBus.Introspectable.Introspect

prometheos's picture

@slava what I get is the text of a 162 lines long file. Here following in line:

$ dbus-send --session --print-reply --type=method_call --dest=org.sailfishos.backup /sailfishbackup org.freedesktop.DBus.Introspectable.Introspect
method return time=1635636537.621860 sender=:1.167 -> destination=:1.169 serial=19 reply_serial=2
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
  <interface name="org.sailfishos.backup">
    <property name="mode" type="s" access="read"/>
    <property name="status" type="s" access="read"/>
    <property name="statusText" type="s" access="read"/>
    <property name="progress" type="d" access="read"/>
    <property name="currentUnit" type="s" access="read"/>
    <property name="error" type="s" access="read"/>
    <property name="errorString" type="s" access="read"/>
    <property name="canCancel" type="b" access="read"/>
    <property name="logFilePath" type="s" access="read"/>
    <property name="localBackupUnits" type="as" access="read"/>
    <property name="cloudBackupUnits" type="as" access="read"/>
    <signal name="listCloudBackupsFinished">
      <arg name="accountId" type="i" direction="out"/>
      <arg name="fileNames" type="as" direction="out"/>
      <arg name="success" type="b" direction="out"/>
    </signal>
    <signal name="cloudBackupStatusChanged">
      <arg name="accountId" type="i" direction="out"/>
      <arg name="status" type="s" direction="out"/>
    </signal>
    <signal name="cloudBackupError">
      <arg name="accountId" type="i" direction="out"/>
      <arg name="error" type="s" direction="out"/>
      <arg name="errorString" type="s" direction="out"/>
    </signal>
    <signal name="cloudRestoreStatusChanged">
      <arg name="accountId" type="i" direction="out"/>
      <arg name="status" type="s" direction="out"/>
    </signal>
    <signal name="cloudRestoreError">
      <arg name="accountId" type="i" direction="out"/>
      <arg name="error" type="s" direction="out"/>
      <arg name="errorString" type="s" direction="out"/>
    </signal>
    <signal name="fileBackupStatusChanged">
      <arg name="filePath" type="s" direction="out"/>
      <arg name="status" type="s" direction="out"/>
    </signal>
    <signal name="fileBackupError">
      <arg name="filePath" type="s" direction="out"/>
      <arg name="error" type="s" direction="out"/>
      <arg name="errorString" type="s" direction="out"/>
    </signal>
    <signal name="fileRestoreStatusChanged">
      <arg name="filePath" type="s" direction="out"/>
      <arg name="status" type="s" direction="out"/>
    </signal>
    <signal name="fileRestoreError">
      <arg name="filePath" type="s" direction="out"/>
      <arg name="error" type="s" direction="out"/>
      <arg name="errorString" type="s" direction="out"/>
    </signal>
    <method name="backupToCloud">
      <arg name="accountId" type="i" direction="in"/>
    </method>
    <method name="restoreFromCloud">
      <arg name="accountId" type="i" direction="in"/>
      <arg name="fileName" type="s" direction="in"/>
    </method>
    <method name="listCloudBackups">
      <arg name="accountId" type="i" direction="in"/>
      <arg name="refresh" type="b" direction="in"/>
    </method>
    <method name="backupToFile">
      <arg name="filePath" type="s" direction="in"/>
    </method>
    <method name="restoreFromFile">
      <arg name="filePath" type="s" direction="in"/>
    </method>
    <method name="cancel">
    </method>
    <method name="backupFileDeviceId">
      <arg type="s" direction="out"/>
    </method>
    <method name="logFileForBackup">
      <arg type="s" direction="out"/>
      <arg name="fileName" type="s" direction="in"/>
      <arg name="accountId" type="i" direction="in"/>
    </method>
    <method name="createBackupForSyncProfile">
      <arg type="s" direction="out"/>
      <arg name="profileId" type="s" direction="in"/>
    </method>
    <method name="setCloudBackups">
      <arg name="profileId" type="s" direction="in"/>
      <arg name="backups" type="as" direction="in"/>
    </method>
    <method name="mode">
      <arg type="s" direction="out"/>
    </method>
    <method name="status">
      <arg type="s" direction="out"/>
    </method>
    <method name="statusText">
      <arg type="s" direction="out"/>
    </method>
    <method name="progress">
      <arg type="d" direction="out"/>
    </method>
    <method name="currentUnit">
      <arg type="s" direction="out"/>
    </method>
    <method name="error">
      <arg type="s" direction="out"/>
    </method>
    <method name="errorString">
      <arg type="s" direction="out"/>
    </method>
    <method name="canCancel">
      <arg type="b" direction="out"/>
    </method>
    <method name="logFilePath">
      <arg type="s" direction="out"/>
    </method>
    <method name="localBackupUnits">
      <arg type="as" direction="out"/>
    </method>
    <method name="cloudBackupUnits">
      <arg type="as" direction="out"/>
    </method>
  </interface>
  <interface name="org.freedesktop.DBus.Properties">
    <method name="Get">
      <arg name="interface_name" type="s" direction="in"/>
      <arg name="property_name" type="s" direction="in"/>
      <arg name="value" type="v" direction="out"/>
    </method>
    <method name="Set">
      <arg name="interface_name" type="s" direction="in"/>
      <arg name="property_name" type="s" direction="in"/>
      <arg name="value" type="v" direction="in"/>
    </method>
    <method name="GetAll">
      <arg name="interface_name" type="s" direction="in"/>
      <arg name="values" type="a{sv}" direction="out"/>
      <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
    </method>
    <signal name="PropertiesChanged">
      <arg name="interface_name" type="s" direction="out"/>
      <arg name="changed_properties" type="a{sv}" direction="out"/>
      <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
      <arg name="invalidated_properties" type="as" direction="out"/>
    </signal>
  </interface>
  <interface name="org.freedesktop.DBus.Introspectable">
    <method name="Introspect">
      <arg name="xml_data" type="s" direction="out"/>
    </method>
  </interface>
  <interface name="org.freedesktop.DBus.Peer">
    <method name="Ping"/>
    <method name="GetMachineId">
      <arg name="machine_uuid" type="s" direction="out"/>
    </method>
  </interface>
</node>

"

No .tar is built in the target dir.

slava's picture

Of course it won't build you the .tar file, it just gives you the description of the D-Bus interface provided by org.sailfishos.backup service. That's the service used by the Backup settings page which is of course it's undocumented, unstable and may change at any time. Try calling backupToFile on that D-Bus interface from a privileged shell, like this:

[nemo@Sailfish ~]$ devel-su -p
Password:
Enjoy your privileges.
[nemo@Sailfish ~]$ dbus-send --session --print-reply --type=method_call --dest=org.sailfishos.backup /sailfishbackup org.sailfishos.backup.backupToFile string:$HOME/backup.tar
method return time=1635639229.394690 sender=:1.411 -> destination=:1.432 serial=169 reply_serial=2
[nemo@Sailfish ~]$ ls -l backup.tar
-rw-r--r-- 1 nemo privileg 2411065856 Oct 31 03:15 backup.tar
[nemo@Sailfish ~]$

You would of course have to wait long enough for the tarball to appear.

rob_k's picture

Hi slava, when I made a clean install on my 10ii with Verla 4.2, the backup of my app GMFS did not do what I wanted: backup the database.

In the .desktop file I added:

[X-HarbourBackup]
BackupPathList=.local/share/harbour-multi-coords/
BackupConfigList=/apps/harbour-multi-coords/

I hoped to save the database in .local/share/harbour-multi-coords/harbour-multi-coords/QML/OfflineStorage\Databases
This should have worked, right?

slava's picture

Looks about right, if you create a backup and then do tar -tvf sailfish_backup_2021<whatever>.tar | grep harbour-multi-coords you should see your files under ./MyBackup/data/users/100000/files/.local/share/harbour-multi-coords/

rob_k's picture

Finally I looked, and indeed. The files are there. Thanks!

miroj56's picture

Great app. Why not push to jolla store? Many users would be grateful.

slava's picture

It's doing all kinds of stuff disallowed in Jolla Store. Most importantly, it installs a backup unit.

ERROR [/usr/share/jolla-vault/units/openrepos-mybackup.json] Installation not allowed in this location
ERROR [/usr/bin/openrepos-mybackup] Cannot link to shared library: libdconf.so.1
ERROR [postuninstall] RPM 'postuninstall' script not allowed
ERROR [/bin/sh] Dependency not allowed
ERROR [jolla-vault] Dependency not allowed
rob_k's picture

Great! I included the X-HarbourBackup in my apps, and it seems to work straightaway. Thanks!

slava's picture

Cheers!

anasyntes's picture

Many thanks. Another high-quality app from you, much appreciated!

Firefox84's picture

Do you know "My data transfer" it was a quite similar app that unfortunately was discontinued. The source can be found here: https://forum.sailfishos.org/t/my-data-transfer-missing-from-openrepos/2887

magare's picture

Great and big Thanks!
Notice one thing: I selected the entire /home/nemo folder for backup, it took a long time 30+ minutes and I stopped the process because I noticed that user data storage was running out of space. My entire /home folder uncompressed is 3.7 GB, compressed is 1.2 GB, but the backup had already consumed 8 GB when I stopped it. I suspect that the reason is some temporary file that happens in the /home/nemo folder itself or something with android_storage, don't know.

slava's picture

I think that's because the temporary files created during the backup process (those are currently under under ~/.local/share/system/privileged/Backups-tmp) were being added to the backup.

If that's not enough, some things  (e.g. ~/Pictures) are going to be included into such backup more than once.

I need to check if source files are already under the destination directory and skip those.

I'll also consider hard-linking the files during the backup process if both source and destination are on the same filesystem - that would speed up the process and save the space.

Malakay's picture

Hi, did I understood correctly, that purpose of this app is to mark certain apps to be obtained in backup in standard backup proccess? Can someone confirm or explain? :)

slava's picture

Well, I tried to explain it in the description. It allows you to add arbitrary data and dconf entries to the backup (and then restore those from the backup). Check the backup talball with tar -tvf, the configured items should be there under MyBackup/

The application integration thing is just a convenience. If you know which files and dconf keys are being used by the application, you can add them manually. But I doubt that you know much about applications which you haven't written yourself))

Malakay's picture

I dont know what Dconf entries are :D So, for example - when I want to backup Acid Pass app, I backup with this and when its needed to be restored, I can restore it from backup. Does backed-up app need to be installed and then restored, or whole app will be restored without reinstallation?

slava's picture

That really depends on the app. DConf and filesystem are two places where apps can persistently store their state. What would actually happen when you restore app's data and configuration from the backup, depends on the app. In any case you better exit the app prior to restoring its data/configuration (to avoid partially or completely overwriting the data you've just restored) unless the app handles its persistent data and configuration being changed behind its back (like my Counter app does). So, it's really case-by-case. Sometimes it will work, sometimes it won't. The [X-HarbourBackup] entry in the .desktop file could serve as an indication that it at least should work.

And this tool isn't even supposed to backup the contents of app's rpm. Those files can be easily restored by reinstalling the app.

nephros's picture

Wow, this is very cool. Brilliant idea with the .desktop file parameters!

eson's picture

Thanks a lot!