fusioninventory / FusionInventory

Open and follow issues about the project (agent, plugin for GSIT, website and documentation)
0 stars 0 forks source link

Windows installer doesn't kill the currently running service and fails install #44

Open robertoetcheverryr opened 3 years ago

robertoetcheverryr commented 3 years ago

Running the currently available 2.6 installer (x64) on Win10 and Win2019, the previously installed version is 2.5.1 installed with service type. I detected that unless the Perl interpreter is killed, the installer fails to update the agent. Additionally, Microsoft has disabled .vbs execution in the latest cumulative updates, which prompted me to migrate the .vbs script to Powershell, maybe I could contribute that script for newer machines?

Back on track, since the installer already needs administrative privileges, it should be able to detect and kill the service/running agent before updating.

g-bougard commented 3 years ago

Hi @robertoetcheverryr

the win32 agent service is relying on Win32::Daemon perl module to handle the agent as a service. The installer is always requesting the service to shutdown while upgrading. So we don't really need to kill the agent as the operating system should handle the service shutdown request.

Btw it seems for some reasons, something is kept running some time and we don't still have no clue of what could have happened. Do you have more to share than just "it does not do what I think it should" ? I mean do you have agent log generated during the upgrade to share ? Did you check the agent is not still running due to another process ? Maybe some old planned tasks not removed for some reason ? We need any clue to find why something is still running and probably locking some files so the installer is failing not being able to install a file.

Also the problem may occur on some systems but not on all. Can you tell us if the problem occurs on all the systems where you installed agent 2.5.1 ? Can you also tell us what happen if you install back 2.5.1 and then install 2.6 ? Does this happen also for 2.5.1 to 2.5.2 upgrade or for 2.5.2 to 2.6 upgrade ?

If you find a system on which the problem always occurs, can you find the fusioninventory-win32-service.rc.sample file in the installation folder, rename it to fusioninventory-win32-service.rc ? Then retry an upgrade so we may see something useful is the stdout.txt & stderr.txt files that would be generated in the logs folder.

Maybe the agent is just unable or too long to release some windows resources when being a long running service and maybe the Win32::Daemon is doing something wrong.

About the Powershell script, any contribution would be appreciated.

robertoetcheverryr commented 3 years ago

I have a lot of machines to upgrade. So I will collect the info you need. I'll get back to you. The agents are configured with the bare minimum, 1 inventory report per day and no tasks beyond that.

robertoetcheverryr commented 3 years ago

I haven't been able to focus on the currently installed machines, but I did tweak the PowerShell script: https://github.com/robertoetcheverryr/PowerShellScripts/blob/master/DeployOrUpdateFusionInventory-Github.ps1 Is that OK or should I share it to somebody specific?