在 Ubuntu 18.04 LTS 上安装 Google Cloud SDK 后,Apt-get 被破坏

我使用以下命令在我的 Ubuntu VM 上安装 Google Cloud SDK

# Add the Cloud SDK distribution URI as a package source
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list


# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -


# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk

我想它现在坏了。

 apt-get install unixODBC unixODBC-dev
E: Conflicting values set for option Signed-By regarding source https://packages.cloud.google.com/apt/ cloud-sdk: /usr/share/keyrings/cloud.google.gpg !=
E: The list of sources could not be read.
E: Conflicting values set for option Signed-By regarding source https://packages.cloud.google.com/apt/ cloud-sdk: /usr/share/keyrings/cloud.google.gpg !=
E: The list of sources could not be read.

有没有什么办法可以修好它,这样我就可以继续下载软件包了。

45604 次浏览

I followed all these commands (for trying to reproduce error in system)

1st command

echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

2nd command

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

3rd command

sudo apt-get update && sudo apt-get install google-cloud-sdk

4th command

sudo apt-get install unixODBC unixODBC-dev

above command prompted E: Unable to locate package unixODBC E: Unable to locate package unixODBC-dev

Then I installed all the gCloud sdk dependencies By below command 5th command

sudo apt-get install google-cloud-sdk-app-engine-java google-cloud-sdk-app-engine-python google-cloud-sdk-pubsub-emulator google-cloud-sdk-bigtable-emulator google-cloud-sdk-datastore-emulator kubectl

All above commands are given by you except 5th one,

I am unable to reproduce that error in my machine,

But it seems Your apt needs to clean up signed certificats and reconfigure again..

refer below link it might help you.

https://www.fossmint.com/keep-ubuntu-system-clean/

and please let me know about the solution if you got..

feel free to discuss on the same.

I got into a very similar situation today by not following the installation instructions carefully enough. What I think happened is that I accidentally pasted and executed some of the commands that were only supposed to be run if you had trouble with any of the previous steps.(The ones having "Troubleshooting Tip" above them.)

It looks like I "solved" it now by by removing these files

sudo rm /usr/share/keyrings/cloud.google.gpg
sudo rm /usr/share/keyrings/cloud.google.gpg~


sudo rm /etc/apt/sources.list.d/google-cloud-sdk.list

and then following the installation instruction again (more carefully this time) to install Google Cloud SDK.

Hopefully, this will work for you too. Good luck.

Remove the existing sdk by running single command:

sudo rm /usr/share/keyrings/cloud.google.gpg && sudo rm /usr/share/keyrings/cloud.google.gpg~ && sudo rm /etc/apt/sources.list.d/google-cloud-sdk.list

Install google cloud sdk by running the single command

sudo apt-get install apt-transport-https ca-certificates gnupg && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && sudo apt-get update && sudo apt-get install google-cloud-sdk && sudo apt-get install google-cloud-sdk-app-engine-java && sudo apt-get install google-cloud-sdk-app-engine-python && gcloud init

Hope this issue will be fixed.

In case of no such files found, you can remove related link in sources.list or sources.list.save. It worked for me.