Removal
Removal can be done in two ways — and it is important not to confuse where the command runs.
On the server itself, from the unpacked distribution:
bash era/scripts/uninstall.sh
From your machine over ssh — then the distribution is first copied to the server, and it asks the questions:
bash uninstall_ssh.sh --host=192.168.0.10 --user=user
The difference is visible immediately: the wrapper starts with connection questions — address, port, user, key.
If you did not expect these questions, the wrapper was launched instead of era/scripts/uninstall.sh; conversely, era/scripts/uninstall.sh never asks about ssh.
Removal is arranged like installation: first a survey, then showing what will be removed, and only then the removal itself.
The removal plan shows what was found
The screen is called "Check removal parameters", and its questions are about what is already installed, not about what to install.
About the database it asks "How is PostgreSQL installed?": the answer determines what to remove — the postgres<postfix> container or a systemd cluster with the data directory.
If unsure, docker ps shows the container, and systemctl list-units postgresql* shows the cluster.
The difference from installation: in the plan each item is marked whether the object actually exists, and for directories — how much space they occupy.
Will be performed on 192.168.0.10:
1. Stop and remove container era_11 [found]
2. Remove container postgres_11 [not found]
3. Unmount 3 mount points inside /opt/era_11
4. Remove directory /opt/era_11 [found, 4.2G]
This is the only protection against a typo in the name: a container marked "not found" is most likely named differently than you think.
What is removed
| What | When |
|---|---|
Platform container |
Always, if found. |
PostgreSQL container |
With |
Cluster systemd unit |
With |
Cluster directory |
With |
Instance directory |
Always. |
PostgreSQL packages |
Only with |
Never removed: docker, images, kernel parameters, firewalld rules, and entries in /etc/exports.d.
These are server-wide settings, and the installer does not take it upon itself to remove them for you.
Mounts
Before removing the instance directory the installer unmounts everything mounted inside it.
The order matters: rm -rf on a mounted NFS directory would delete data on the server rather than local data.
If unmounting fails, directory removal is not performed, and this is reported explicitly.
What remains on the server
At the end of removal a form is printed — the same as after installation, but it answers the question "what remains":
== What remains on the server ==
[ ok ] Platform container removed: era<postfix>
[ ok ] PostgreSQL removed
[warn] Mounts remaining: /opt/era<postfix>/era_recpath
[ ok ] Instance directory removed: /opt/era<postfix>
The system state is checked, not command return codes: the container is absent, the service is removed together with the unit, the cluster directory and instance directory are gone, no mounts remain. A remaining mount point is a warning, not a refusal: removal detaches a busy mount point lazily, and the kernel releases it when the last process closes the files. A remaining container or directory is a refusal, and the installer exits with code 5.
With --dry-run there is no form: the server was not changed.
Protection against a dangerous path
Every directory removal passes a common check:
-
the path must be absolute;
-
length — at least eight characters;
-
an empty value removes nothing and prints a warning.
Thus --erainstancedatapath= with a lost value does not turn into rm -rf /.
Examples
Ask what to remove:
bash era/scripts/uninstall.sh
Remove the platform together with the database in a container:
bash era/scripts/uninstall.sh --non-interactive \
--datapath=/opt --eracontainername=era_11 \
--douninstallpg=y --pgcontainername=postgres_11 --pgmode=d
See what will be removed and exit (on the server itself, from the distribution directory):
cd /tmp/era_installer
bash era/scripts/uninstall.sh --dry-run --eracontainername=era_11
The same from your machine:
bash uninstall_ssh.sh --dry-run --host=192.168.0.10 --user=user --eracontainername=era_11
--dry-run applies to the target host, not the wrapper: the plan — what exactly will be removed, with found/not found marks — is built by the server itself, and only it can show it.
Therefore the wrapper does its work for real: copies the distribution to /tmp/era_installer and runs removal there with the same key.
The server is not changed; the distribution remains in /tmp and disappears on reboot.
The removal command for this exact server is printed at the end of a successful installation — it is convenient to save it immediately.