fusioninventory / fusioninventory-agent

FusionInventory Agent
http://fusioninventory.org/
GNU General Public License v2.0
254 stars 126 forks source link

Upgrade from 2.5 -> 2.5.2 is failing #798

Closed vollkommenIrrelevant closed 4 years ago

vollkommenIrrelevant commented 4 years ago

Hello,

I am getting a error if i try to upgrade (without previous unistall) the agent on win10. Looks like a problem with perl, what can I do?

fi

vollkommenIrrelevant commented 4 years ago

Nobody who is having an Idea? @g-bougard maybe?

vollkommenIrrelevant commented 4 years ago

is there anyone who is having a solution? Or maybe an Idea?

vollkommenIrrelevant commented 4 years ago

nobody?

vollkommenIrrelevant commented 4 years ago

I found out that the problem is the unistall of 2.5 before installing the 2.5.2. It seems that the perl Files are not removed completly and then the installer of 2.5.2 cant overwrite them...

grafik

grafik

grafik

g-bougard commented 4 years ago

Hi @vollkommenIrrelevant I suppose the service took time to stop and a process was probably still running while the installer tried to delete files. In that case, you may need to restart the computer before trying to install the newest version.

vollkommenIrrelevant commented 4 years ago

@g-bougard Thank you for your back. I made some experiments - removing service and unistall via cmd: grafik

grafik => Folder is still existing

After deleting the folder (with FileExplorer) the setup of 2.5.2 is working fine. => The Unistaller is having a problem with deleting the folder. For my setup I can delete the folder via script, but maybe the installer of 2.5.2 can check this?

vollkommenIrrelevant commented 4 years ago

@g-bougard Is it possible to fix this? Deleting the Folder via script is a bit difficult because I have to switch on all Computer (hands on, no wol)....

vollkommenIrrelevant commented 4 years ago

@g-bougard

If you modify the vba script like this it's working fine.

 ' stop fusioninventory-agent.exe to allow unistall
  WshShell.Run "cmd /C net stop FusionInventory-Agent", 0, True

  'uninstall old agent
  WshShell.Run "cmd /C ""C:\Program Files\FusionInventory-Agent\Uninstall.exe"" /S", 0, True

  'kill perl if running
  WshShell.Run "cmd /C taskkill /F /IM perl.exe""", 0, True

  'Delete folder to avoid left files
  DIM PathToFolderWithLeftFiles
  WshShell.Run "cmd /C rmdir /s /q ""C:\Program Files\FusionInventory-Agent\""", 0, True

  ShowMessage("Running: """ & SetupLocation & "\" & Setup & """ " & SetupOptions)
  WshShell.Run "CMD.EXE /C """ & SetupLocation & "\" & Setup & """ " & SetupOptions, 0, True
  ShowMessage("Deployment done!")`
vollkommenIrrelevant commented 4 years ago

@g-bougard

If you modify the vba script like this it's working fine.

 ' stop fusioninventory-agent.exe to allow unistall
  WshShell.Run "cmd /C net stop FusionInventory-Agent", 0, True

  'uninstall old agent
  WshShell.Run "cmd /C ""C:\Program Files\FusionInventory-Agent\Uninstall.exe"" /S", 0, True

  'kill perl if running
  WshShell.Run "cmd /C taskkill /F /IM perl.exe""", 0, True

  'Delete folder to avoid left files
  DIM PathToFolderWithLeftFiles
  WshShell.Run "cmd /C rmdir /s /q ""C:\Program Files\FusionInventory-Agent\""", 0, True

  ShowMessage("Running: """ & SetupLocation & "\" & Setup & """ " & SetupOptions)
  WshShell.Run "CMD.EXE /C """ & SetupLocation & "\" & Setup & """ " & SetupOptions, 0, True
  ShowMessage("Deployment done!")`

Unfortenately it seems it is only working if you are having admin rights... @g-bougard Can you please have a look on this? After manuall uninstall, stopping service and killng perl it's working fine....

g-bougard commented 4 years ago

Hi @vollkommenIrrelevant can you confirm a point ? As I see you seem to need killing "perl.exe" processes, the only way you should see perl.exe processes is while running agent as windows task, or you're running manually one of the provided scripts during install or another program is using perl (and maybe from another perl environment). Indeed if agent is running as a service you'll see a fusioninventory-agent.exe process running. So can you confirm you're running agent from windows task ? But I'm not sure as you also run net stop FusionInventory-Agent before uninstalling it. Eventually it could be interesting to know if you run the agent as Windows tasks in the past and as service now. Maybe an older installer created tasks we failed to remove during an upgrade. Then you may also check planned tasks for any remaining FusionInventory agent related one. This still can be a problem to have agent running as task and as service.

I can't plan to kill any perl.exe program as this can lead to kill processes related to another perl program.

vollkommenIrrelevant commented 4 years ago

I installed Fusioninventory as: fusioninventory-agent_windows-x64_2.5.exe /acceptlicense /no-ssl-check /scan-profiles /add-firewall-exception /no-start-menu /installtasks=Inventory /execmode=Service /runnow /server='URL' /S

net stop FusionInventory-Agent is not safe because there is no param to force stop the service. I found out that I must run powershell -command "Stop-Service -Name "FusionInventory-Agent" -Force" instead and then the vba-script.

It run smooth so I'm not able to check something related with this problem because I updated all clients successfull after forced stop of the service and killing perl.

g-bougard commented 4 years ago

Okay, so we can conclude installation may fail if the installer fails to stop the service. But as I told, killing perl.exe won't help as service is run with fusioninventory-agent.exe (which is a copy of perl.exe). Killing perl.exe can only help if the agent is also run from a provided script (this is the case when run from a windows task).

Can you still verify if any old fusioninventory-agent windows planned task could be defined on computers ?

vollkommenIrrelevant commented 4 years ago

That's possible because we are using Fusioninventory since around 4 years and did upgrades within the years.

g-bougard commented 4 years ago

You should anyway confirm if you still have some planned tasks that could have not been removed.

vollkommenIrrelevant commented 4 years ago

I have only one task on my. So it seems they had been removed correct.

g-bougard commented 4 years ago

Okay, thank you anyway for your feedbacks. Knowing what agent process could still be running and why is anyway very difficult to achieve without a reproducible issue. I hope newer agent versions won't be concerned. As you found a work-around, I'm closing this issue.