Gcloud permissions error

@tom thanks, I can confirm that it’s working. :slight_smile:

I think it would be still nice to improve it a little bit and make it work with the latest version as well also would be nice to re-visit the sudo thing. Any chance that it’s on your roadmap?

We have a ticket with our product-engineering team to investigate the Gloud version issue. One of other customers who had this issue contacted both us and Gcloud support. Google’s support said they should pin their version to 120, so it’s possible that there’s an issue with newer versions of Gcloud.

As for sudo, it seems sudo is necessary for update because /opt/ is owned by root on Ubuntu. This is the default behavior of ubuntu. Is running gcloud with sudo creating problems?

Thanks for the information.
It doesn’t cause problem, just thought that permission issue with newer versions can come from it.

@Eric yes, running gcloud with sudo makes some files become owned by root instead of ubuntu. This causes problems because logs cannot be written, and crucially for me, the authentication provided to gsutil is owned by root instead of ubuntu, so it can’t authenticate to anything.

I was getting this error: gsutil anonymous users does not have storage.buckets.list because of permissions issues.

Here’s my workaround:

    # See https://discuss.circleci.com/t/gcloud-permissions-error/2631/13
    - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
    - sudo chown ubuntu:ubuntu /opt/google-cloud-sdk -R
    - sudo chown ubuntu:ubuntu ~/.config/gcloud/ -R
    #
1 Like

We solved it with switching to Circle 2.0, now our base image contains the latest gcloud:

2 Likes

Just solved this with a different approach on CircleCI 1.0:

- sudo chmod -R 0777 /opt
- echo Y | gcloud components install cloud-datastore-emulator