jws
jws

Reputation: 2774

gcloud 'no such file or directory'

On Ubuntu 20.04, gcloud installed with snap install google-cloud-sdk --classic...

Today it no longer works. Yesterday there was an auto update.

$ kubectl get all
Unable to connect to the server: error executing access token command "/snap/google-cloud-sdk/188/bin/gcloud config config-helper --format=json": err=fork/exec /snap/google-cloud-sdk/188/bin/gcloud: no such file or directory output= stderr=

Version 188 it is referencing is gone, and it is now at 190. (Version 189 is also present.)

I've uninstalled and deleted the .config/gcloud, and reinstalled, but still have the same error.

Any tips on where to look for that stale path?

Upvotes: 2

Views: 4370

Answers (1)

Lari Hotari
Lari Hotari

Reputation: 5310

The problem is that gcloud stores the absolete reference to the gcloud binary to ~/.kube/config. The solution is to replace /snap/google-cloud-sdk/.*/gcloud -> /snap/bin/gcloud in ~/.kube/config.

Example of accomplishing this with perl on the command line:

perl -i -p -e 's/\/snap\/google-cloud-(sdk|cli)\/.*?\/gcloud/\/snap\/bin\/gcloud/' ~/.kube/config

Upvotes: 5

Related Questions