Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wazuh-Indexer SysV Init script fails to start the service #603

Closed
juliancnn opened this issue Dec 19, 2024 · 1 comment · Fixed by #623
Closed

Wazuh-Indexer SysV Init script fails to start the service #603

juliancnn opened this issue Dec 19, 2024 · 1 comment · Fixed by #623
Assignees
Labels
level/task Task issue type/bug Bug issue

Comments

@juliancnn
Copy link
Member

Related issues:

Description

On non-systemd (SysV) systems, attempting to start the Wazuh-Indexer service using service wazuh-indexer start does not actually start the process. The service reports it started but immediately shows as not running when checked with service wazuh-indexer status.

Observed Behavior:

# service wazuh-indexer status
 * wazuh-indexer is not running

# service wazuh-indexer start
 * Starting wazuh-indexer

# service wazuh-indexer status
 * wazuh-indexer is not running

# ps -aux | grep -i wazuh
(no wazuh-indexer process found)

This issue appears related to the line in the SysV init script where pidofproc -p $PID_FILE wazuh-indexer is executed. The pidofproc function returns an exit code of 3 (indicating the pid file is not exist), which prevents the $pid variable from being assigned and prematurely terminates the start sequence.

Relevant Code Snippet:

pid=`pidofproc -p $PID_FILE wazuh-indexer`
if [ -n "$pid" ] ; then

pid=`pidofproc -p $PID_FILE wazuh-indexer`

If pidofproc returns a non-zero code, the script never assigns $pid, causing the script to fail silently rather than proceeding with the start logic.

Objective

Fix the SysV init script for Wazuh-Indexer so that it properly handles the pidofproc return code, allowing the service to start and run as expected on SysV-based systems.

Acceptance Criteria

  • service wazuh-indexer start successfully launches Wazuh-Indexer on SysV init systems.
  • service wazuh-indexer status correctly reports the running status after starting.
  • service wazuh-indexer stop successfully stop Wazuh-Indexer on SysV init systems.
  • No errors or unexpected behavior occur in logs.
@juliancnn juliancnn added level/task Task issue type/bug Bug issue labels Dec 19, 2024
@juliancnn juliancnn changed the title Wazuh-Indexer SysV Init Script Fails to Start the Service Wazuh-Indexer SysV Init script fails to start the service Dec 19, 2024
@wazuhci wazuhci moved this to Triage in XDR+SIEM/Release 5.0.0 Dec 19, 2024
@wazuhci wazuhci moved this from Triage to Backlog in XDR+SIEM/Release 5.0.0 Dec 19, 2024
@wazuhci wazuhci moved this from Backlog to In progress in XDR+SIEM/Release 5.0.0 Jan 10, 2025
@QU3B1M
Copy link
Member

QU3B1M commented Jan 10, 2025

Bug fixed with the changes applied on issue #564

Start wazuh-indexer service

# service wazuh-indexer start
Starting wazuh-indexer...
wazuh-indexer started successfully

# service wazuh-indexer status
wazuh-indexer is running (PID: 2353)

Stop wazuh-indexer service

# service wazuh-indexer stop
Stopping wazuh-indexer... 
wazuh-indexer stopped successfully

# service wazuh-indexer status
wazuh-indexer is not running

Restart a running wazuh-indexer service

# sudo service wazuh-indexer restart
Stopping wazuh-indexer... 
wazuh-indexer stopped successfully
Starting wazuh-indexer...
wazuh-indexer started successfully

Restart a stopped wazuh-indexer service

# service wazuh-indexer stop
Stopping wazuh-indexer... 
wazuh-indexer stopped successfully

# service wazuh-indexer restart
Stopping wazuh-indexer... 
wazuh-indexer is not running
Starting wazuh-indexer...
wazuh-indexer started successfully

Check ps -aux

# ps -aux | grep -I wazuh
root      2640  0.0  0.0   5876   648 pts/0    S+   10:59   0:00 grep -I wazuh

@QU3B1M QU3B1M linked a pull request Jan 10, 2025 that will close this issue
3 tasks
@wazuhci wazuhci moved this from In progress to Pending review in XDR+SIEM/Release 5.0.0 Jan 10, 2025
@wazuhci wazuhci moved this from Pending review to Done in XDR+SIEM/Release 5.0.0 Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/bug Bug issue
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants