[GH-ISSUE #2162] Error running update.sh - Stuck in loop "Old update script detected..." #3283

Closed
opened 2026-03-14 07:02:33 +03:00 by kerem · 2 comments
Owner

Originally created by @nativeit on GitHub (Mar 6, 2025).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/2162

Server Info (please complete the following information):

  • OS: Debian 12.7
  • RMM Version: v0.20.1

Installation Method:

  • Standard
  • Standard with --insecure flag at install
  • Docker

Agent Info (please complete the following information):

  • Agent version: N/A
  • Agent OS: N/A

Describe the bug
I went to update my server using the routine method of SSH, switch to user "tactical", run the update.sh script.

To Reproduce
Steps to reproduce the behavior:

  1. SSH into server as a sudo-enabled user
  2. Switch to dedicated tactical user
  3. Run script update.sh as tactical
  4. See error Old update script detected, downloading and replacing with the latest version... in an unending loop.

Expected behavior
The standard update routine, including the version check and downloading of an updated script, if necessary.

Screenshots

Image

Additional context
I notice this is a major version level update, my apologies if this is necessarily an exceptional version that requires additional steps that I just hadn't clocked (I read through the changelog). Only partially related, but kudos on getting to 1.0.0!

Originally created by @nativeit on GitHub (Mar 6, 2025). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/2162 **Server Info (please complete the following information):** - OS: Debian 12.7 - RMM Version: v0.20.1 **Installation Method:** - [x] Standard - [ ] Standard with `--insecure` flag at install - [ ] Docker **Agent Info (please complete the following information):** - Agent version: N/A - Agent OS: N/A **Describe the bug** I went to update my server using the routine method of SSH, switch to user "tactical", run the update.sh script. **To Reproduce** Steps to reproduce the behavior: 1. SSH into server as a sudo-enabled user 2. Switch to dedicated `tactical` user 3. Run script `update.sh` as `tactical` 4. See error `Old update script detected, downloading and replacing with the latest version...` in an unending loop. **Expected behavior** The standard update routine, including the version check and downloading of an updated script, if necessary. **Screenshots** ![Image](https://github.com/user-attachments/assets/cced142f-142e-4ddc-9384-9094dcb9aa08) **Additional context** I notice this is a major version level update, my apologies if this is necessarily an exceptional version that requires additional steps that I just hadn't clocked (I read through the changelog). Only partially related, but kudos on getting to 1.0.0!
kerem closed this issue 2026-03-14 07:02:38 +03:00
Author
Owner

@nativeit commented on GitHub (Mar 7, 2025):

OK, I found my problem to be the script path, it has to be run such that . == $PWD

I'm sure there's probably a way to avoid that in Bash, but it's likely not any kind of a priority just now (and I'm going to venture to guess that this is documented somewhere, but I hadn't fully registered it).

Anyway, congrats on v1!

<!-- gh-comment-id:2705258653 --> @nativeit commented on GitHub (Mar 7, 2025): OK, I found my problem to be the script path, it has to be run such that `.` == `$PWD` I'm sure there's probably a way to avoid that in Bash, but it's likely not any kind of a priority just now (and I'm going to venture to guess that this is documented somewhere, but I hadn't fully registered it). Anyway, congrats on v1!
Author
Owner

@nativeit commented on GitHub (Mar 7, 2025):

Just because it's front of mind now, I took a quick gander, and I think if the 'wget' output flag within the if statement that checks for updates was more specifically defined, this could be avoided.

Original code:

if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then
  printf >&2 "${YELLOW}Old update script detected, downloading and replacing with the latest version...${NC}\n"
  wget -q "${SCRIPT_URL}" -O update.sh
  exec ${THIS_SCRIPT}
fi

Modified code:

if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then
  printf >&2 "${YELLOW}Old update script detected, downloading and replacing with the latest version...${NC}\n"
  wget -q "${SCRIPT_URL}" -O "${THIS_SCRIPT}"
  exec ${THIS_SCRIPT}
fi

Since THIS_SCRIPT=$(readlink -f "$0") (declared up top) gets interpreted as the full path and filename for the script, then this would ensure that the update call will always re-write the original script, regardless of where the script is called from.

Might be helpful for some folks' automation (present company included). I'd be happy to pull request this, although it seems like kind of a dainty request...

EDIT: Added double-quotes around the variable. Tested this, and it does indeed work.

<!-- gh-comment-id:2705273016 --> @nativeit commented on GitHub (Mar 7, 2025): Just because it's front of mind now, I took a quick gander, and I think if the 'wget' output flag within the `if` statement that checks for updates was more specifically defined, this could be avoided. Original code: ```bash if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then printf >&2 "${YELLOW}Old update script detected, downloading and replacing with the latest version...${NC}\n" wget -q "${SCRIPT_URL}" -O update.sh exec ${THIS_SCRIPT} fi ``` Modified code: ```bash if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then printf >&2 "${YELLOW}Old update script detected, downloading and replacing with the latest version...${NC}\n" wget -q "${SCRIPT_URL}" -O "${THIS_SCRIPT}" exec ${THIS_SCRIPT} fi ``` Since `THIS_SCRIPT=$(readlink -f "$0")` (declared up top) gets interpreted as the full path and filename for the script, then this would ensure that the update call will always re-write the original script, regardless of where the script is called from. Might be helpful for some folks' automation (present company included). I'd be happy to pull request this, although it seems like kind of a dainty request... EDIT: Added double-quotes around the variable. Tested this, and it does indeed work.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#3283
No description provided.