Apt-get is broken after install Google Cloud SDK on Ubuntu 18.04 LTS

Vinay Joseph picture Vinay Joseph · Jun 20, 2019 · Viewed 13.2k times · Source

I was installing the Google Cloud SDK on my Ubuntu VM using the following commands

# 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

and I think its broken now.

 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.

Is there anyway to fix it so I can continue to download packages.

Answer

jonahe picture jonahe · Jun 21, 2019

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.