Uninstall and Cleanup

Remove a FIO installation and cleanup leftover FIO install artifacts

Uninstall FIO package

The following instructions will remove FIO artifacts installed during a package install. For a listing of those files, see FIO Package Install.

APT Remove

To remove a package installed with dpkg, apt, or apt-get, execute the corresponding command, e.g. dpkg --remove <package>. In the following instructions apt will be used, however, note that whichever command is used, it only partially cleans up an install and additional steps must be taken.

apt remove should remove everything except configuration and data. Configuration would include users, groups, ini and json files, and data would include state, history, etc.

sudo apt remove fioprotocol

apt purge should remove everything including configuration, and data!

sudo apt purge fioprotocol

FIO Installation artifact cleanup

However, currently both remove and purge do not do exactly what is implied. Note: purge appears to remove /var/log/fio/nodeos.log but does not remove any log backups (rotated logs).

Directories/files/configuration that should be removed when using apt remove include:

  • /etc/fio/genesis.json
  • /usr/local/bin/cleos
  • /usr/local/bin/fio-cleos
  • /usr/local/bin/nodeos

In addition to the items above, directories/files/configuration that should be removed when using apt purge include:

  • /var/lib/fio
  • /var/log/fio
  • fio-nodeos service
  • fio-wallet service
  • fio user
  • fio group

🚧

Destructive

The following script must be run as root/using sudo. Note that the use of 'sudo' is for Advanced users!

#!/usr/bin/env bash
# Run this script using sudo, i.e. sudo cleanup-fio-install.sh

echo
if [[ "$EUID" -ne 0 ]]; then
  echo "ERROR: Script must be run as root! Use sudo command as follows; sudo ./<script name>"
  echo
  exit 1
fi

# Utility functions
function pause(){
  echo
  read -s -n 1 -p "Press any key to continue (CTRL-c to exit)..."
  echo
  echo
}

echo
echo "Confirm complete removal of the fioprotocol package and all related artifacts..."
pause

# Stop and disable fio-nodeo application
echo
echo "Stopping fio-nodeos..."
systemctl stop fio-nodeos
sleep 5
echo
echo "Disabling fio-nodeos service..."
systemctl disable fio-nodeos
sleep 1

# Stop and disable fio-wallet application
echo
echo "Stopping fio-wallet..."
systemctl -q stop fio-wallet
sleep 5
echo
echo "Disabling fio-wallet service..."
systemctl -q disable fio-wallet
sleep 1

# Remove installed package
echo
echo "Removing fioprotocol package from system..."
apt remove fioprotocol

# Remove leftover artifacts from fio package install
echo
echo "Removing fioprotocol binaries from system..."
rm -f /usr/local/bin/cleos
rm -f /usr/local/bin/fio-cleos
rm -f /usr/local/bin/clio
rm -f /usr/local/bin/nodeos
rm -f /usr/local/bin/fio-nodeos
rm -f /usr/local/bin/fio-wallet

# ********************************** WARNING ***********************************
# The following commands remove runtime data that is critical for node execution
# Only proceed if cleanup of an outdated install is desired
# ******************************************************************************
# Remove configuration, blocks log, history, state
echo
echo "Removing fioprotocol artifacts from system..."
rm -r /etc/fio
rm -r /var/lib/fio
rm -r /var/log/fio

# Remove the fio user
# This step is useful if not re-installing/upgrading the fio package
echo
echo "Removing fioprotocol user from system..."
/usr/sbin/deluser --system --remove-home --group fio fio