Total bafflement with first steps for restic with a Gdrive account

NB OS at this particular time is W10. I’m using Firefox.

I have created a new gmail account.

I have looked at this page … but Google has successfully managed to confuse me utterly about what to do to create a “service account key”.

I have gone to this google page and managed to get the “console” to display.

My first attempt was then to list the existing “service keys” (presumably there wouldn’t be any).

Welcome to Cloud Shell! Type "help" to get started.
To set your Cloud Platform project in this session use “gcloud config set project [PROJECT_ID]”
mrodent_restic_location_w10@cloudshell:~$ serviceAccount.keys.list()
> ;
-bash: syntax error near unexpected token `;'
mrodent_restic_location_w10@cloudshell:~$

… at this point I’m not clear whether this “service key” (and the file I’m meant to download) is specific to the account … or to one or more “project(s)” which are mentioned. As far as I’m aware I haven’t create any projects.

[NB My initial attempts to do so after installing the gcloud “package” on my machine failed for reasons unknown:

Enter a Project ID. Note that a Project ID CANNOT be changed later.
Project IDs must be 6-30 characters (lowercase ASCII, digits, or
hyphens) in length and start with a lowercase letter. project1
WARNING: Project creation failed: HttpError accessing <https://cloudresourcemanager.googleapis.com/v1/projects?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'content-encoding': 'gzip', 'date': 'Tue, 12 Jul 2022 16:44:23 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'server-timing': 'gfet4t7; dur=634', 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': 409}>, content <{
  "error": {
    "code": 409,
    "message": "Requested entity already exists",
    "status": "ALREADY_EXISTS"
  }
}
>
Please make sure to create the project [project1] using
    $ gcloud projects create project1
or change to another project using
    $ gcloud config set project <PROJECT ID>

D:\Google\Cloud SDK>gcloud projects create project1
ERROR: (gcloud.projects.create) Project creation failed. The project ID you specified is already in use by another project. Please try an alternative ID.

D:\Google\Cloud SDK>gcloud projects create project2
ERROR: (gcloud.projects.create) Project creation failed. The project ID you specified is already in use by another project. Please try an alternative ID.

D:\Google\Cloud SDK>gcloud projects create xxxx11111
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/xxxx11111].
Waiting for [operations/cp.8163186370385598357] to finish...failed.
ERROR: (gcloud.projects.create) Operation [cp.8163186370385598357] failed: 9: Callers must accept Terms of Service

… wow, I really thought I had (accepted the “Terms of Service”). How do I convince it that I have …?]

Nor do I have (obviously) the faintest clue how to use this in-webpage console to do the things I want, such as 1) listing existing keys 2) creating a new “service key” and 3) downloading a new file associated with this.

Could someone point me to an idiot’s guide? If you do, please make sure that it is up-to-date. Things change so fast, and guides often go out of date. At the moment I’m beginning to wonder things like “maybe this ‘service key’ used to be specific to a gmail account… but is now specific to a ‘gmail account project’…”.

But more likely I just haven’t got a clue and have totally lost “situational awareness”.

1 Like

Do you intend to store your backup using Google Drive or the Google Cloud Storage Service? The instructions you’ve followed are for the latter, whereas the topic title suggests you want to use the former.

Google Drive all the way!

I had no idea that Google Cloud Storage Service was in fact different to Google Drive / GDrive.

Obviously I really do need an idiot’s guide…! Are there instructions somewhere for using GDrive?

In the form of “official documentation”, the only page which seemed relevant was this one:

https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html

… this mentions only one thing which might come under the heading of “storing your repo with Google”…

Did you already search the forum? I know that there are some users of google drive and restic, maybe someone can help? What you essentially have to do is to setup rclone such that it can access Google Drive, and then follow the steps to use restic with rclone: Preparing a new repository — restic 0.13.1 documentation

Thanks. Yes, I searched. But as I say, I didn’t know that that page I referenced (and you referenced) was NOT dealing with GDrive.

This looks promising for setting up rclone with GDrive: https://www.howtogeek.com/451262/how-to-use-rclone-to-back-up-to-google-drive-on-linux/ (except that I’m currently operating from W10, but that should be OK, if necessary using WSL).

In fact I have set up an rclone “connection” with a Gmail GDrive account in the past. Then I have the feeling that it may have failed because Gmail made things more difficult for security-related reasons.

Once “keys” or “encrypted keys” start being required I usually find the explanations and documentation are usually confusing. Will try again though.

Maybe I should offer to put up a “GDrive how to” page here if I manage it?

This does not seem to be a restic question. Can you upload a file to Gdrive with rclone?

Once you are there, post back if you can’t backup with restic.

I think this is a restic question, in the sense that the “official docs” page for this (as linked above) is slightly confusing if you are as un-knowledgeable about Google as I am.

The solution is:

  1. configure rclone for a GDrive connection, as explained very clearly here.
  2. initiate your restic repo:
    > restic -r "rclone:google-drive-restic-w10:test_repo/" init
  3. do a snapshot:
    > restic -r "rclone:google-drive-restic-w10:test_repo/" backup "D:/My Documents/some_test_directory"
  4. check it worked:
    > restic -r "rclone:google-drive-restic-w10:test_repo" --verbose --json snapshots | jq .
    NB jq.exe (for W10) can be downloaded here.

Is it too much to ask to request that a note is included in the “how to” page to the effect that GDrive is not Google Cloud Services and needs configuring with rclone?

2 Likes

Thanks for your feedback @mrodent :slight_smile: I’m not sure its restic’s thing to help people keep track of various vendor’s confusing service names, but I don’t see why we can’t add a little note letting people know that the Google Cloud Storage backend which is supported in restic out of the box is not the same thing as Google Drive! :+1: I’ve opened doc: Add note about using rclone for Google Drive by rawtaz · Pull Request #3825 · restic/restic · GitHub to address this.

2 Likes