OpenSearch reinstall issue on Debian 12

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

OpenSearch 2.16
Debian 12

Describe the issue:

I am facing an issue when uninstalling/reinstalling OpenSearch 2.16 on Debian 12

I follow the install instructions (apt package thru repository), all appears correct. If I uninstall the package and attempt to install again, I get an error.
Issue is reproducible on a Debian 12 container

Install procedure ( docker run --rm -it debian:12 /bin/bash )

# apt update && apt install -y lsb-release ca-certificates curl gnupg2 openjdk-17-jre-headless iproute2 curl

# curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring

# echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | tee /etc/apt/sources.list.d/opensearch-2.x.list

# apt-get update

# env OPENSEARCH_INITIAL_ADMIN_PASSWORD="SuperSecretP@ssw0rd++" apt-get install -y opensearch

I get the install confirmation, with instructions on how to enable and configure the service, so it appears all is ok

If I remove and install again, I get the following error

# apt remove -y opensearch 

# rm -rf /var/log/opensearch* /var/lib/opensearch* /etc/opensearch* /usr/share/opensearch*

# env OPENSEARCH_INITIAL_ADMIN_PASSWORD="@SuperSecretPassw0rd++" apt-get install -y opensearch
Reading package lists... Done
<...>
Unpacking opensearch (2.16.0) ...
Setting up opensearch (2.16.0) ...
Running OpenSearch Post-Installation Script
ERROR: Something went wrong during demo configuration installation. Please see the logs in /var/log/opensearch/install_demo_configuration.log
dpkg: error processing package opensearch (--configure):
 installed opensearch package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.36-9+deb12u8) ...
Errors were encountered while processing:
 opensearch
E: Sub-process /usr/bin/dpkg returned an error code (1)

Content of /var/log/opensearch/install_demo_configuration.log

# cat /var/log/opensearch/install_demo_configuration.log

### OpenSearch Security Demo Installer
### ** Warning: Do not use on production or public reachable systems **
Unable to determine OpenSearch config file. Quit.

Configuration:

Relevant Logs or Screenshots:

Solved the issue with a dpkg --purge opensearch in addition to the apt remove