Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings backup/restore #11090

Open
jficz opened this issue Nov 24, 2022 · 11 comments
Open

Settings backup/restore #11090

jficz opened this issue Nov 24, 2022 · 11 comments

Comments

@jficz
Copy link

jficz commented Nov 24, 2022

I do occasional ROM tests and it is always pain to restore Nextcloud app to working order - mostly several auto-upload folders I use which are (nearly) always the same. I use SeedVault for most of my backups but NC doesn't allow backup.

An obvious solution for a cloud app would be, to, err, store its settings in the cloud :) App can export the settings and save it in the connected NC instance in the same way contacts and calendars are backed up.

Alternative solution (and simple from code perspective) would be to allow the app to have its data backed up by Android backup provider, which is now disallowed.

A poor man's fix might be adding a "export/import settings" option in settings, though this is essentially the same as the first suggestion.

@jcz1
Copy link

jcz1 commented Dec 27, 2022

Hello.

I use SeedVault (integrated in LineageOS, GrapheneOS etc.) for secure (encrypted) backup apps and data to my device (USB) or my server (NextCloud).

But Nextcloud is opted-out from backups so it is not possible to save app data by SeedVault :( Please can you allow encrypted backups? I think it is good compromise. There is more info:

https://github.com/seedvault-app/seedvault/wiki/FAQ

And an example of commit:

grote/Transportr@4dc38f4

Thanks.

@nazar-pc
Copy link

Migrating for the first time in many years to non-rooted phone (with GrapheneOS ROM) and it is a major pain how many apps disable backup feature. This is how trivial it is to enable: grote/Transportr@4dc38f4

@AlvaroBrey
Copy link
Member

Migrating for the first time in many years to non-rooted phone (with GrapheneOS ROM) and it is a major pain how many apps disable backup feature. This is how trivial it is to enable: grote/Transportr@4dc38f4

We disabled it recently because it caused problems when restoring in our case, and it wasn't easy to diagnose and fix. It's not always that easy...

@nazar-pc
Copy link

nazar-pc commented Jan 24, 2023

Hm, I see, is it still a plan to restore in the future though?

UPD: For context I had to create 14!!! bug reports with a tiny selection of apps I have installed on my phone (they all fit on one screen without scrolling).

@AE720
Copy link

AE720 commented Feb 5, 2023

Seconding this. I really is a PITA. Maybe the settings could be server side? With Nextcloud being a core app that many things can connect to, I wouldn't imagine it would be easy, but at the very least the auto uploads would be nice to have backed up and restored in an XML

@Mynacol
Copy link

Mynacol commented Jun 15, 2023

Adding some more thought to this: other Nextcloud apps using the Single-Sign-On feature could continue working if both sides save some mutual tokens.
Pro: Users don't have to accept logging in after restoring a backup.
Con: Saving a "secret." But this app can request only saving the backup if it is client side encrypted. That would be fine by me.

Relevant for the Nextcloud News app: nextcloud/news-android#1225 (comment)

@Zocker1999NET
Copy link

@AlvaroBrey What were the problems restoring the backup ran into?

If it is about the login credentials, Nextcloud should be able to exclude them from the backup (or, after restore, immediately delete them). Then it may ask the user again for its credentials so the potential new phone does not use the same credentials as the old one.

@jficz
Copy link
Author

jficz commented Jun 20, 2023

If it is about the login credentials, Nextcloud should be able to exclude them from the backup

This decision should ultimately be made by the user.

However, the creds might be encrypted using / stored in the on board TPM and I'm not sure how to backup those.

This shouldn't be a problem if the team adopts an iterative approach to backups instead of a project waterfall. Small, incremenal updates and features.

You could start with a simple json settings export saved in the cloud instance for example.

@Zocker1999NET
Copy link

Zocker1999NET commented Jun 20, 2023

This decision should ultimately be made by the user.

I can understand why this might be desired, but it can ran into problems if not properly implemented throughout the whole ecosystem. If one migrate from an old to a new device by restoring a backup without disabling the first device, both might use the same credentials. I do not know if this may be a problem for Nextcloud (at least the device name in security settings could be wrong if not updated).

On Apple's forced app backup, the migration of credentials breaks apps which depend on the fact that this credential might be only used by one device at the same time. (saw a migration to new phone, Signal messages were received by either one of two iPhones, depending on which one was faster).

You could start with a simple json settings export saved in the cloud instance for example.

👍 sounds like a good starting point. That JSON file could then also be given to Android's Backup system, so the Nextcloud app may also already insert domain & username when logging in.

@AlvaroBrey
Copy link
Member

AlvaroBrey commented Jun 22, 2023

@AlvaroBrey What were the problems restoring the backup ran into?

See #10637. Esentially restoring backups from previous Android versions (which is done automatically on install if your Google Account is configured to do it) could lead to invalid permissions/sharedpreferences states

As I understood back then it's not unfixable, but it would take time to diagnose and fix the backup config and app start logic so that only the relevant things would be restored while leaving the app in a consistent state

@jficz
Copy link
Author

jficz commented Jun 22, 2023

Esentially restoring backups from previous Android versions ... could lead to invalid permissions/sharedpreferences states

If I read the thread correctly, the invalid permission problem can be worked around by fiddling with the folder settings / adding the rights manually. That's a minor inconvenience. Imho still better than no backups at all but I understand why it might be easier to just disable (native) backups. That's why I've been suggesting this:

App can export the settings and save it in the connected NC instance in the same way contacts and calendars are backed up.

from the beginning. NC app already exports a VCF file and stores is in the cloud instance. A subset of settings (like upload folders, auth info for SSO, etc.) can be exported as a, say, JSON file and stored in the cloud as well. The restore part would then be under full control of the app. Not ideal, not native, but still much better than no backups at all.

@joshtrichards joshtrichards changed the title automatic settings backup Server-side client app settings backup/restore Oct 11, 2023
@joshtrichards joshtrichards changed the title Server-side client app settings backup/restore Settings backup/restore Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants