From 8eca465ef6c3ba38215010901721d4e2f505d62e Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Fri, 24 Apr 2026 14:35:11 -0400 Subject: [PATCH 1/2] uninstall elastic-agent before stopping dockers on reinstall --- setup/so-functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index ca58dbbcb..f9b601a93 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1604,6 +1604,9 @@ reinstall_init() { # Drop systemd's in-memory references to the now-removed units systemctl daemon-reload + # Uninstall local Elastic Agent, if installed + elastic-agent uninstall -f + if command -v docker &> /dev/null; then # Stop and remove all so-* containers so files can be changed with more safety if [[ $(docker ps -a -q --filter "name=so-" | wc -l) -gt 0 ]]; then @@ -1626,9 +1629,6 @@ reinstall_init() { backup_dir /nsm/hydra "$date_string" backup_dir /nsm/influxdb "$date_string" - # Uninstall local Elastic Agent, if installed - elastic-agent uninstall -f - } >> "$setup_log" 2>&1 info "System reinstall init has been completed." From 199c2746f1b397cc21f5c618ade5c1356d0104b9 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Fri, 24 Apr 2026 15:24:11 -0400 Subject: [PATCH 2/2] stop salt-minion and salt-master regardless of install type. display reinstall on console and save to logfile --- setup/so-functions | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index f9b601a93..23098cac8 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -202,10 +202,10 @@ check_service_status() { systemctl status $service_name > /dev/null 2>&1 local status=$? if [ $status -gt 0 ]; then - info " $service_name is not running" + info "$service_name is not running" return 1; else - info " $service_name is running" + info "$service_name is running" return 0; fi @@ -1541,11 +1541,8 @@ clear_previous_setup_results() { reinstall_init() { info "Putting system in state to run setup again" - if [[ $install_type =~ ^(MANAGER|EVAL|MANAGERSEARCH|MANAGERHYPE|STANDALONE|FLEET|IMPORT)$ ]]; then - local salt_services=( "salt-master" "salt-minion" ) - else - local salt_services=( "salt-minion" ) - fi + # Always include both services. check_service_status skips units that aren't present. + local salt_services=( "salt-master" "salt-minion" ) { # remove all of root's cronjobs @@ -1629,7 +1626,7 @@ reinstall_init() { backup_dir /nsm/hydra "$date_string" backup_dir /nsm/influxdb "$date_string" - } >> "$setup_log" 2>&1 + } 2>&1 | tee -a "$setup_log" info "System reinstall init has been completed." }