Server Info (please complete the following information):
- OS: Ubuntu 20.04.4 LTS
- Browser: Firefox 103.0.2 (64-bit)
- RMM Version (as shown in top left of web UI): v0.14.5
Installation Method:
Agent Info (please complete the following information):
- Agent version (as shown in the 'Summary' tab of the agent from web UI): Agent v2.0.3
- Agent OS: Windows 10 Pro, 64 bit v21H1 (build 19043.1889)
Describe the bug
One agent is failing to update to v2.2.1. After logging into the computer, I discovered an existing update is pending. The inno logs show the upgrade failed to delete a file, retried, and ultimately prompted with a "Message box (Abort/Retry/Ignore)". The agent upgrade code starts the command but never checks if the command completed. Yes, I know it can't check if the current command spawned finished because part of the upgrade process is to restart the service. However, it can check if a previous upgrade is hung or still running. The agent.log
shows the agent keeps trying to update but fails because the tacticalagent-v2.2.1-windows-amd64.exe
is in use by another process. That other process is the previous upgrade that is waiting for a prompt.
To Reproduce
Steps to reproduce the behavior:
- I don't know how to reproducible this problem.
Expected behavior
I expect the agent to check if a previous upgrade is hung and handle the situation.
Screenshots
Here is a screenshot of the existing setup from Process Explorer.
![image](https://user-images.githubusercontent.com/7763429/185802192-fef95468-c24e-4bc7-aeab-5e1cd59ea8f1.png)
Here is the properties of the upgrade process started on 2022-08-19 10:35:05 PM.
![image](https://user-images.githubusercontent.com/7763429/185802244-117ee890-33d7-4fb4-8b08-f78e22cdd84d.png)
Additional context
The inno setup log is below.
C:\Program Files\TacticalAgent\agent.log:
time="2022-08-21T10:35:09-04:00" level=info msg="Agent updating from 2.0.3 to 2.2.1"
time="2022-08-21T10:35:09-04:00" level=info msg="Downloading agent update from https://agents.tacticalrmm.com/api/v2/agents/?version=2.2.1&arch=amd64&token=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee&plat=windows&api=api.smb.services"
time="2022-08-21T10:35:09-04:00" level=error msg="open C:\\Program Files\\TacticalAgent\\tacticalagent-v2.2.1-windows-amd64.exe: The process cannot access the file because it is being used by another process."
time="2022-08-21T10:35:15-04:00" level=info msg="Agent service started"
time="2022-08-21T11:35:13-04:00" level=info msg="Agent updating from 2.0.3 to 2.2.1"
time="2022-08-21T11:35:13-04:00" level=info msg="Downloading agent update from https://agents.tacticalrmm.com/api/v2/agents/?version=2.2.1&arch=amd64&token=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee&plat=windows&api=api.smb.services"
time="2022-08-21T11:35:14-04:00" level=error msg="open C:\\Program Files\\TacticalAgent\\tacticalagent-v2.2.1-windows-amd64.exe: The process cannot access the file because it is being used by another process."
time="2022-08-21T11:35:19-04:00" level=info msg="Agent service started"
time="2022-08-21T12:25:23-04:00" level=info msg="Agent updating from 2.0.3 to 2.2.1"
time="2022-08-21T12:25:23-04:00" level=info msg="Downloading agent update from https://agents.tacticalrmm.com/api/v2/agents/?version=2.2.1&arch=amd64&token=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee&plat=windows&api=api.smb.services"
time="2022-08-21T12:25:23-04:00" level=error msg="open C:\\Program Files\\TacticalAgent\\tacticalagent-v2.2.1-windows-amd64.exe: The process cannot access the file because it is being used by another process."
time="2022-08-21T12:25:29-04:00" level=info msg="Agent service started"
time="2022-08-21T12:35:12-04:00" level=info msg="Agent updating from 2.0.3 to 2.2.1"
time="2022-08-21T12:35:12-04:00" level=info msg="Downloading agent update from https://agents.tacticalrmm.com/api/v2/agents/?version=2.2.1&arch=amd64&token=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee&plat=windows&api=api.smb.services"
time="2022-08-21T12:35:12-04:00" level=error msg="open C:\\Program Files\\TacticalAgent\\tacticalagent-v2.2.1-windows-amd64.exe: The process cannot access the file because it is being used by another process."
time="2022-08-21T12:35:18-04:00" level=info msg="Agent service started"
C:\Windows\Temp\tacticalrmm3774362645\tacticalrmm.txt:
2022-08-19 22:35:07.147 Log opened. (Time zone: UTC-04:00)
2022-08-19 22:35:07.147 Setup version: Inno Setup version 6.2.1
2022-08-19 22:35:07.147 Original Setup EXE: C:\Program Files\TacticalAgent\tacticalagent-v2.2.1-windows-amd64.exe
2022-08-19 22:35:07.147 Setup command line: /SL5="$1C0046,3433926,825344,C:\Program Files\TacticalAgent\tacticalagent-v2.2.1-windows-amd64.exe" /VERYSILENT /LOG=C:\WINDOWS\TEMP\tacticalrmm3774362645\tacticalrmm.txt
2022-08-19 22:35:07.147 Windows version: 10.0.19043 (NT platform: Yes)
2022-08-19 22:35:07.147 64-bit Windows: Yes
2022-08-19 22:35:07.147 Processor architecture: x64
2022-08-19 22:35:07.147 User privileges: Administrative
2022-08-19 22:35:07.163 Administrative install mode: Yes
2022-08-19 22:35:07.163 Install mode root key: HKEY_LOCAL_MACHINE
2022-08-19 22:35:07.163 64-bit install mode: No
2022-08-19 22:35:07.178 Created temporary directory: C:\WINDOWS\TEMP\is-MUSDO.tmp
2022-08-19 22:35:08.556 Stop tacticalrpc: 2
2022-08-19 22:35:08.771 Stop tacticalagent: 2
2022-08-19 22:35:10.059 Stop tacticalrmm: 2
2022-08-19 22:35:10.422 taskkill: 128
2022-08-19 22:35:10.571 delete tacticalagent: 1060
2022-08-19 22:35:10.714 delete tacticalrpc: 1060
2022-08-19 22:35:10.927 Starting the installation process.
2022-08-19 22:35:10.927 Directory for uninstall files: C:\Program Files\TacticalAgent
2022-08-19 22:35:10.927 Will append to existing uninstall log: C:\Program Files\TacticalAgent\unins000.dat
2022-08-19 22:35:10.958 -- File entry --
2022-08-19 22:35:10.958 Dest filename: C:\Program Files\TacticalAgent\unins000.exe
2022-08-19 22:35:10.974 Time stamp of our file: 2022-08-19 22:35:06.475
2022-08-19 22:35:10.974 Dest file exists.
2022-08-19 22:35:10.974 Time stamp of existing file: 2022-04-28 06:35:08.812
2022-08-19 22:35:10.974 Version of our file: 51.1052.0.0
2022-08-19 22:35:11.177 Version of existing file: 51.1052.0.0
2022-08-19 22:35:11.177 Installing the file.
2022-08-19 22:35:11.371 Leaving temporary file in place for now.
2022-08-19 22:35:11.371 -- File entry --
2022-08-19 22:35:11.371 Dest filename: C:\Program Files\TacticalAgent\tacticalrmm.exe
2022-08-19 22:35:11.371 Time stamp of our file: 2022-08-01 15:48:00.000
2022-08-19 22:35:11.371 Dest file exists.
2022-08-19 22:35:11.371 Time stamp of existing file: 2022-04-22 11:41:58.000
2022-08-19 22:35:11.371 Installing the file.
2022-08-19 22:35:12.148 DeleteFile: The existing file appears to be in use (5). Retrying.
2022-08-19 22:35:13.162 DeleteFile: The existing file appears to be in use (5). Retrying.
2022-08-19 22:35:14.166 DeleteFile: The existing file appears to be in use (5). Retrying.
2022-08-19 22:35:15.182 DeleteFile: The existing file appears to be in use (5). Retrying.
2022-08-19 22:35:16.197 Message box (Abort/Retry/Ignore):
C:\Program Files\TacticalAgent\tacticalrmm.exe
An error occurred while trying to replace the existing file:
DeleteFile failed; code 5.
Access is denied.