'elasticsearch 7.9.0 jarhell lucene50.Lucene50StoredFieldsFormat$1 debian 10 cannot start

Any help on finding the issue with this.
I manually installed elasticsearch 7.9.0 (https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html) I had to add lucene-backward-codecs-8.7.0.jar in /usr/share/elasticsearch/lib or I get the error below.

    [2022-01-22T21:25:39,352][ERROR][o.e.b.Bootstrap          ] [guest] Exception
java.lang.IllegalStateException: jar hell!
class: org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat$1
jar1: /usr/share/elasticsearch/lib/lucene-backward-codecs-8.7.0.jar
jar2: /usr/share/elasticsearch/lib/lucene-core-8.6.0.jar

before and if I remove the lucene-backward-codecs-8.7.0.jar

[2022-01-22T21:32:05,863][ERROR][o.e.b.Bootstrap          ] [guest] Exception
java.lang.IllegalArgumentException: Could not load codec 'Lucene87'.  Did you forget to add lucene-backward-codecs.jar?


Solution 1:[1]

Just encountered this exact issue while running elasticsearch in a docker container. I resolved it by removing all containers/images related to elasticsearch and repulling them.

I didn't see you mention Docker anywhere in your post, so I'm not sure how relevant this will be, but I figured I'd toss it out there just incase.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 James McGuire