-
Notifications
You must be signed in to change notification settings - Fork 27
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
[BUG] The Wazuh indexer fails to start during an upgrade if the service was active #723
Comments
I've added an [root@alma9 ~]# yum reinstall -y ./wazuh-indexer-4.11.1.x86_64.rpm
Last metadata expiration check: 1:15:46 ago on Fri Feb 28 12:55:37 2025.
Dependencies resolved.
======================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================
Reinstalling:
wazuh-indexer x86_64 4.11.1-0 @commandline 831 M
Transaction Summary
======================================================================================================================================================================================
Total size: 831 M
Installed size: 1.0 G
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 1/2
%pre stage
Stop existing wazuh-indexer.service
line 164
Reinstalling : wazuh-indexer-4.11.1-0.x86_64 1/2
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 1/2
%post stage
Restarting wazuh-indexer service...
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 2/2
%preun stage
Stop existing wazuh-indexer.service
line 232
Cleanup : wazuh-indexer-4.11.1-0.x86_64 2/2
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 2/2
Verifying : wazuh-indexer-4.11.1-0.x86_64 1/2
Verifying : wazuh-indexer-4.11.1-0.x86_64 2/2
Reinstalled:
wazuh-indexer-4.11.1-0.x86_64
Complete! |
The above is confirmed by the following source:
I found official documentation to back this up: For reference, here's the order in which scripts are executed on a single
package upgrade:
all-%pretrans
...
any-%triggerprein (%triggerprein from other packages set off by new install)
new-%triggerprein
new-%pre for new version of package being installed
... (all new files are installed)
new-%post for new version of package being installed
any-%triggerin (%triggerin from other packages set off by new install)
new-%triggerin
old-%triggerun
any-%triggerun (%triggerun from other packages set off by old uninstall)
old-%preun for old version of package being removed
... (all old files are removed)
old-%postun for old version of package being removed
old-%triggerpostun
any-%triggerpostun (%triggerpostun from other packages set off by old un
install)
...
all-%posttrans |
The I'm not sure we can make this work for upgrades until we have deployed 2 consecutive versions with the fix. In order to test this assertion, I installed $ grep -A3 '^%preun' distribution/packages/src/rpm/wazuh-indexer.rpm.spec
%preun
set -e
echo "Running a custom %preun phase" Upgrading to this custom package doesn't show my custom message[root@alma9 ~]# yum install ./wazuh-indexer-4.11.1.x86_64.rpm
Last metadata expiration check: 1:01:24 ago on Fri Feb 28 15:58:29 2025.
Dependencies resolved.
======================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================
Upgrading:
wazuh-indexer x86_64 4.11.1-0 @commandline 831 M
Transaction Summary
======================================================================================================================================================================================
Upgrade 1 Package
Total size: 831 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 1/2
Stop existing wazuh-indexer.service
Upgrading : wazuh-indexer-4.11.1-0.x86_64 1/2
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 1/2
Running scriptlet: wazuh-indexer-4.10.1-1.x86_64 2/2
Cleanup : wazuh-indexer-4.10.1-1.x86_64 2/2
Running scriptlet: wazuh-indexer-4.10.1-1.x86_64 2/2
Verifying : wazuh-indexer-4.11.1-0.x86_64 1/2
Verifying : wazuh-indexer-4.10.1-1.x86_64 2/2
Upgraded:
wazuh-indexer-4.11.1-0.x86_64
Complete! The message does in fact show when upgrading from the custom 4.11 package.[root@alma9 ~]# yum reinstall -y ./wazuh-indexer-4.11.1.x86_64.rpm
Last metadata expiration check: 2:13:08 ago on Fri Feb 28 15:58:29 2025.
Dependencies resolved.
======================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================
Reinstalling:
wazuh-indexer x86_64 4.11.1-0 @commandline 831 M
Transaction Summary
======================================================================================================================================================================================
Total size: 831 M
Installed size: 1.0 G
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 1/2
Stop existing wazuh-indexer.service
Reinstalling : wazuh-indexer-4.11.1-0.x86_64 1/2
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 1/2
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 2/2
Running a custom %preun phase
Restarting wazuh-indexer service...
Cleanup : wazuh-indexer-4.11.1-0.x86_64 2/2
Running scriptlet: wazuh-indexer-4.11.1-0.x86_64 2/2
Verifying : wazuh-indexer-4.11.1-0.x86_64 1/2
Verifying : wazuh-indexer-4.11.1-0.x86_64 2/2
Reinstalled:
wazuh-indexer-4.11.1-0.x86_64
Complete! |
We need to check whether these changes need to be ported to |
Describe the bug
The Wazuh indexer upgrade seems to try to restart the Wazuh indexer component using
systemctl
but the status after the upgrade is deadIf the service is stopped before the upgrade, the
Process
reference does not appearLooking at the SPEC file, it seems that there is a problem in the post stage https://github.com/wazuh/wazuh-indexer/blob/v4.11.0/distribution/packages/src/rpm/wazuh-indexer.rpm.spec#L208-L215 as the
restart
command should keep the service activeBased on the Debian test done in this comment, this is an unexpected behavior
To Reproduce
Steps to reproduce the behavior:
Expected behavior
If the package should keep the service active, it should be started correctly by the package like the Debian package does
Plugins
N/A
Screenshots
N/A
Host/Environment (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: