• Support
  • What's correct way to remove Netdata? Automated method not working

corus9

I tried:

wo stack stop --netdata --force

wo stack remove --netdata --force

wo stack purge --netdata --force

but it still is running:

I already report on Github, but there is no reply.

    jonathannz

    The following method does not work for m:

    Run wo stack remove --netdata
    Then run wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall

    sudo wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall
    --2024-09-18 04:17:46-- https://my-netdata.io/kickstart.sh
    Resolving my-netdata.io (my-netdata.io)... 2606:4700:3031::6815:d9f, 2606:4700:3036::ac43:9cc0, 172.67.156.192, ...
    Connecting to my-netdata.io (my-netdata.io)|2606:4700:3031::6815:d9f|:443... connected.
    HTTP request sent, awaiting response... 307 Temporary Redirect
    Location: https://get.netdata.cloud/kickstart.sh [following]
    --2024-09-18 04:17:46-- https://get.netdata.cloud/kickstart.sh
    Resolving get.netdata.cloud (get.netdata.cloud)... 2606:4700:20::681a:98d, 2606:4700:20::681a:88d, 2606:4700:20::ac43:48aa, ...
    Connecting to get.netdata.cloud (get.netdata.cloud)|2606:4700:20::681a:98d|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 93642 (91K) [application/octet-stream]
    Saving to: ‘/tmp/netdata-kickstart.sh’

    /tmp/netdata-kickstart.sh 100%[=========================================================>] 91.45K --.-KB/s in 0.003s

    2024-09-18 04:17:46 (27.9 MB/s) - ‘/tmp/netdata-kickstart.sh’ saved [93642/93642]

    --- Using /tmp/netdata-kickstart-6QKZyR1c32 as a temporary directory. ---
    --- Checking for existing installations of Netdata... ---
    [/tmp/netdata-kickstart-6QKZyR1c32]# test -x /usr/libexec/netdata/netdata-uninstaller.sh
    FAILED

    --- Downloading netdata-uninstaller ... ---
    [/tmp/netdata-kickstart-6QKZyR1c32]# /usr/bin/curl --fail -q -sSL --connect-timeout 10 --retry 3 --output /tmp/netdata-kickstart-6QKZyR1c32/netdata-uninstaller.sh https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/netdata-uninstaller.sh
    OK

    [/tmp/netdata-kickstart-6QKZyR1c32]# /tmp/netdata-kickstart-6QKZyR1c32/netdata-uninstaller.sh --yes
    /tmp/netdata-kickstart-6QKZyR1c32/netdata-uninstaller.sh: 720: .: cannot open /etc/netdata/.environment: No such file

    Wed Sep 18 04:17:46 UTC 2024 : FATAL: netdata-uninstaller.sh: FAILED TO UNINSTALL NETDATA: Failed to completely remove Netdata from this system.
    FAILED

    WARNING Uninstaller failed. Some parts of Netdata may still be present on the system.

    Finished uninstalling the Netdata Agent.The following non-fatal warnings or errors were encountered:

    • Command "test -x /usr/libexec/netdata/netdata-uninstaller.sh" failed with exit code 1.
    • Command "/tmp/netdata-kickstart-6QKZyR1c32/netdata-uninstaller.sh --yes" failed with exit code 1.
    • Uninstaller failed. Some parts of Netdata may still be present on the system.

    [/root]# rm -rf /tmp/netdata-kickstart-6QKZyR1c32
    OK

    I was just about to go and submit an official bug report. but am happy to see you have already done that alexlii

    I hope this gets resolved soon as I remember having issues uninstalling this for many versions now

    portofacil I just did a reboot and netdata is still showing up as a running/active service

    This script is part of a tool I use on non-WO servers. I stripped the parts that don't relate to removing Netdata. Perhaps it can help you.

    #!/bin/bash
    
    # Function to print messages
    print_message() {
        echo "--------------------------------------------------"
        echo "$1"
        echo "--------------------------------------------------"
    }
    
    # Stop the Netdata service
    print_message "Stopping Netdata service"
    sudo systemctl stop netdata
    
    # Disable the Netdata service
    print_message "Disabling Netdata service"
    sudo systemctl disable netdata
    
    # Uninstall Netdata
    print_message "Uninstalling Netdata"
    sudo apt-get remove --purge -y netdata
    
    # Remove residual configuration files
    print_message "Removing residual configuration files"
    sudo apt-get autoremove --purge -y netdata
    
    # Remove Netdata directories and files
    print_message "Removing Netdata directories and files"
    sudo rm -rf /etc/netdata /var/lib/netdata /usr/lib/netdata /var/cache/netdata /var/log/netdata /usr/share/netdata
    
    # Remove Netdata user and group
    print_message "Removing Netdata user and group"
    sudo deluser --remove-home netdata
    sudo delgroup netdata
    
    # Clean up systemd service
    print_message "Cleaning up systemd service"
    sudo systemctl daemon-reload
    sudo systemctl reset-failed
    
    # Check for any remaining Netdata processes and kill them
    print_message "Checking for remaining Netdata processes"
    remaining_processes=$(ps aux | grep netdata | grep -v grep)
    
    if [ -n "$remaining_processes" ]; then
        print_message "Killing remaining Netdata processes"
        sudo killall netdata
    else
        print_message "No remaining Netdata processes found"
    fi
    
    print_message "Netdata uninstallation complete"
      5 days later

      portofacil I could just copy/paste these commands, right? instead of uploading a script and running it?

      The code I provided is not a full script. I only meant to give you a solid starting point.

        portofacil oof, I appreciate the effort, truly
        but things like this (features offered within the official documentation of WordOps) should actually work

          Endda WordOps is open source, and so is its documentation. Perhaps this is an excellent opportunity to contribute to the project (reviewing documentation) without dealing with code directly.

          a month later

          I wish there was an update on this. Removing Netdata doesn't work with the Wordops stack remove command. I even tried to remove the entire admin stack, and that didn't work.

            3 months later
            • EEndda

                Level 14

              rsmith4321 I had to grab the individual commands from the script @portofacil posted earlier
              that was the only way I could get netdata off my server

              Hosted by VirtuBox