Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'sudo apt-get update' does not work after trying to install elasticsearch through apt-get

First, I tried to install elasticsearch according to the instructions on the website https://www.elastic.co/guide/en/kibana/current/deb.html

but after echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list

deb https://artifacts.elastic.co/packages/8.x/apt stable main

but after that, when I try to $ sudo apt-get update

> E: Conflicting values set for option Signed-By regarding source
> https://artifacts.elastic.co/packages/8.x/apt/ stable:
> /usr/share/keyrings/elasticsearch-keyring.gpg != E: The list of
> sources could not be read.   

but in keyrings, there is no elasticsearch-keyring.gpg

in keyrings,

docker-archive-keyring.gpg      
ubuntu-advantage-ros.gpg   
ubuntu-advantage-cc-eal.gpg                
ubuntu-archive-keyring.gpg   
ubuntu-advantage-cis.gpg               
ubuntu-archive-removed-keys.gpg    
ubuntu-advantage-esm-apps.gpg          
ubuntu-cloudimage-keyring.gpg   
ubuntu-advantage-esm-infra-trusty.gpg  
ubuntu-cloudimage-removed-keys.gpg    
ubuntu-advantage-fips.gpg              
ubuntu-master-keyring.gpg   

I already changed the file sources.list from /usr/share/doc/apt/examples/ to /etc/apt/
for reset the list

I don't know how to get it back. I can't install any package through apt now

someone please, help me T_T

like image 325
kyu man Rho Avatar asked Oct 27 '25 07:10

kyu man Rho


1 Answers

I am by no means a linux or elasticsearch expert. I don't know if this is a GOOD solution. It could be a very nasty and BAD solution.

...But it allowed me to use apt-get again when I was having the same problem. Who knows, maybe the people who actually know the "correct" solution will respond if I trigger them with a dirty hack, haha.

In /etc/apt/sources.list.d, there's a file called "elastic-8.x.list", the same one used in the command you used above for installation. I removed the file and I could use apt-get again.

sudo rm /etc/apt/sources.list.d/elastic-8.x.list

I also removed the elasticsearch keyring, but that on it's own didn't work. It was removing the elastic list file that allowed things to work again.

sudo rm /usr/share/keyrings/elasticsearch-keyring.gpg

I hope my answer was helpful!

like image 178
A. L. Strine Avatar answered Oct 28 '25 22:10

A. L. Strine