Skip to content

Uninstalling the ConHive Agent

If you need to remove the ConHive Agent from your system, follow the instructions below based on how you initially installed it.

Important: Uninstalling the agent may remove its configuration and log files. Back up any necessary data from the agent’s working directory (workdir) before proceeding if you might need it later. You can find the location using ./conhive-agent config location before stopping the agent.

Method 1: Using the Uninstall Script (Linux Only)

Section titled “Method 1: Using the Uninstall Script (Linux Only)”

This method is only applicable if you installed the ConHive Agent using the Installer Script (installer.sh) on Linux, which sets it up as a systemd service. This script typically creates an uninstaller helper script.

  1. Locate the Script: The uninstall script is usually placed in the same directory as the agent binary, commonly /usr/local/bin/. The typical name is conhive-agent-uninstall.
  2. Run the Script: Open your terminal and execute the script with administrative privileges:
    Terminal window
    sudo /usr/local/bin/conhive-agent-uninstall
    (Adjust the path if the script is located elsewhere).
  3. Follow Prompts: The script may ask for confirmation before proceeding.
  4. What it does: The script typically performs the following actions:
    • Stops the conhive-agent systemd service.
    • Disables the service from starting on boot.
    • Removes the agent binary (e.g., /usr/local/bin/conhive-agent).
    • Removes the systemd service file (/etc/systemd/system/conhive-agent.service).
    • Removes related helper scripts (like conhive-agent-killall).
    • Note: The script might not remove the agent’s working directory (workdir) containing configurations and logs, to prevent accidental data loss. If you want to remove this directory as well, you must do it manually after running the script (see Manual Uninstallation Step 2).

Use this method if you installed the agent manually, used the Quick Download script, or are running it via Docker.

Step 1: Stop the ConHive Agent

  • If running as a systemd service (Linux):
    Terminal window
    sudo systemctl stop conhive-agent.service
    sudo systemctl disable conhive-agent.service # Prevent starting on boot
  • If running manually in the foreground: Press Ctrl+C in the terminal where the agent is running.
  • If running manually in the background (Linux/macOS): Find the process ID (PID) and stop it.
    Terminal window
    # Find the PID
    pgrep conhive-agent
    # Stop using the PID (replace <PID> with the actual ID)
    kill <PID>
    # If it doesn't stop, force kill (use with caution)
    # kill -9 <PID>
  • If running via Docker:
    Terminal window
    docker stop conhive-agent # Use the container name you assigned
    docker rm conhive-agent # Remove the stopped container

Step 2: Remove Agent Files and Directories

  • Delete the Binary: Remove the conhive-agent (Linux/macOS) or conhive-agent.exe (Windows) file from the location where you installed or extracted it (e.g., /usr/local/bin/, C:\Program Files\ConHiveAgent\, or the directory where you ran the manual extract).
    Terminal window
    # Example Linux: Remove binary if installed to /usr/local/bin
    sudo rm /usr/local/bin/conhive-agent
  • Delete the Service File (if applicable, Linux): If you manually created a systemd service file or if one remains after stopping the service, remove it and reload the systemd daemon.
    Terminal window
    sudo rm /etc/systemd/system/conhive-agent.service
    sudo systemctl daemon-reload
  • Delete the Working Directory (workdir): This directory contains configurations, logs, and potentially other runtime data. Warning: This step permanently deletes agent data. Ensure you have backups if needed. Find the location before stopping the agent using config location, or check common locations like the directory where you first ran the agent, or /var/lib/conhive-agent if installed as a service.
    Terminal window
    # Example Linux: Remove workdir (replace path with actual location)
    sudo rm -rf /path/to/your/workdir
  • Delete Quick Download Directory: If you used the Quick Download script, remove the conhive directory created in your user’s directory.
    Terminal window
    # Example: Remove the default download directory
    rm -rf ./conhive

Step 3: Remove Docker Image (if applicable)

If you ran the agent via Docker and no longer need the image:

Terminal window
docker rmi ai2hive/conhive-agent:latest