glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

The glpi-agent service has been deleted #607

Closed sebma closed 2 months ago

sebma commented 4 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

The glpi-agent service has been deleted after a reboot of my windows 10 PC :

C:\> sc.exe query glpi-agent
[SC] OpenService FAILED 1060:

The specified service does not exist as an installed service.

C:\>

To reproduce

Reboot windows 10 PC.

Expected behavior

The glpi-agent service exists :

C:\> sc.exe qc glpi-agent
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: glpi-agent
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : "C:\Program Files\GLPI-Agent\perl\bin\glpi-agent.exe" -I"C:\Program Files\GLPI-Agent\perl\agent" -I"C:\Program Files\GLPI-Agent\perl\site\lib" -I"C:\Program Files\GLPI-Agent\perl\vendor\lib" -I"C:\Program Files\GLPI-Agent\perl\lib" "C:\Program Files\GLPI-Agent\perl\bin\glpi-win32-service"
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : glpi-agent
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem
C:\> 

and is running :

C:\> sc.exe query glpi-agent

SERVICE_NAME: glpi-agent
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\> 

Operating system

Windows

GLPI Agent version

1.5

GLPI version

10.0.10

GLPIInventory plugin or FusionInventory for GLPI plugin version

GLPI Inventory v1.3.4

Additional context

We have checked the Trend Apex One (antivirus) logs but did not find any quarantine for that incident.

g-bougard commented 4 months ago

Hi @sebma

you're suggesting glpi-agent service can magically disappear during a reboot. But I guess you're forgetting some essential context that can explain why the service is not available.

Is this after an installation or an upgrade attempt ? Have you even try to reinstall than reboot to see if the service is removed again ?

Anyway please provide a reproducible evidence of the problem ? Actually, I can only guess you missed something.

sebma commented 4 months ago

@g-bougard You're right it didn't magically disappear for sure.

I have filtered the System eventlogs with the event ids 5141,7045,4660 but could only find the event corresponding to the creation of that service.

How can I find what process deleted the glpi-agent service from the eventlogs ?

g-bougard commented 4 months ago

Hi @sebma

you didn't answer to my other questions: we still know nothing about the context.

I don't know how to find what process could have deleted the service. I only know this can happen during upgrade if something is not done in the right way: for that there was a fix added to the vbs script. For example, if you're upgrading by running msiexec directly by yourself, you must check the msiserver service is not used.

If this is not related to an installation or upgrade, I don't think this is glpi-agent problem. And in that case, this can even be a filesystem corruption issue.

g-bougard commented 2 months ago

Hi @sebma

your problem is probably related to the fix I proposed for #584.

Current nightly build should still work as expected.

So I'm closing the issue, but feel free to re-open is you test nightly build without success.