glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
252 stars 61 forks source link

Last Agent Version Windows "Service Start and stop immediately" #770

Closed psi-iflc closed 2 months ago

psi-iflc commented 2 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

on a fresh manual install, it seems the service not running. When we start it manually, it immediately stop. No logs are present on GLPI-AGENT logs...

To reproduce

Install the agent manually - typical

Expected behavior

Service running

Operating system

Windows

GLPI Agent version

v1.11

GLPI version

10.0.15

GLPIInventory plugin or other plugin version

No response

Additional context

No response

g-bougard commented 2 months ago

Hi @psi-iflc

does it run or report an error when started manually from an administrative console and from the glpi-agent installation folder ?

psi-iflc commented 2 months ago

Hi, no error appear on manually launch throught services.msc. No logs on the glpi-agent installation folder :( ..

The problem not appear on an upgrade from 1.10 to 1.11 (on an other server)

psi-iflc commented 2 months ago

OS is Windows Server 2022 on both

g-bougard commented 2 months ago

I wanted you to start glpi-agent from an administrative console to see if it reports an error on the console:

cd "C:\Program Files\GLPI-Agent"
glpi-agent
g-bougard commented 2 months ago

And you can eventually try:

glpi-agent --logger=stderr --debug --debug
psi-iflc commented 2 months ago

image

g-bougard commented 2 months ago

You are in the wrong folder and as I said run the command from the installation folder, not from the perl\bin subfolder. Here glpi-agent.exe is indeed a copy of perl.exe binary which indeed doesn't recognize this option.

psi-iflc commented 2 months ago

I'm sorry, I haven't seen the answer before, please find the result of the command below :

image

psi-iflc commented 2 months ago

And here the content of the line 194 mentioned on the execution failure log :

image

g-bougard commented 2 months ago

What do you have in registry for the HKEY_LOCAL_MACHINE\SOFTWARE\GLPI-Agent registry key ?

Actually I can only suppose you didn't configure GLPI-Agent. How did you installed it ?

psi-iflc commented 2 months ago

image RoyalTS_du8L1Jq3pi firefox_eAfEq6NlSy

I have installed it manually with the UI, choose Typical, then, specify local folder, specify Server and let "Quick install" checked

g-bougard commented 2 months ago

For some reason, your Operating system seems to reject GLPI-Agent to read its configuration from registry.

Do you have any AV or anything else which could have blocked GLPI-Agent ?

What's the windows OS version on this computer ?

Can you also share the output of the following command ?

glpi-agent --version
glpi-agent --setup

Do you have any output for the following command ? No need to share the output or just "operatingsystem" node of the JSON output.

glpi-inventory --partial=os
psi-iflc commented 2 months ago

I have already checked the Antivirus and have no warning about GLPI... The OS Version is Server 2022. Please find the output of the commands : glpi-agent --version

image

glpi-agent --setup

image

glpi-inventory --partial=os jsonoutput

Thanks for your help

g-bougard commented 2 months ago

This is really the first time I see such an error on any windows. Now I can only think something goes wrong during installation.

Can you fully uninstall glpi-agent ?

Check folder is fully removed, if not empty it. Check also the registry key is removed.

Then reinstall the agent as before and check if the problem still occurs.

psi-iflc commented 2 months ago

Hi, I have uninstalled the Agent and checked folders and registry. It appears the uninstaller had removed all folders correctly, but in the registry, it appears this key is not deleted by the uninstaller : Ordinateur\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\glpi-agent. After remove of this key, i can install the agent again and the services is running properly !

Below the content of the registry key :

image

g-bougard commented 2 months ago

Okay, thank you for your feedback.

So something goes wrong during the first install. And as far we don't know what, we can't tell if this is a bug or not.

About Ordinateur\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\glpi-agent, as far I know, keys under Ordinateur\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002 are just backups in case of crash during a reboot, so you don't have to worry about and is not related to the issue.