wazuh / wazuh-packages

Wazuh - Tools for packages creation
https://wazuh.com
GNU General Public License v2.0
103 stars 94 forks source link

Increase the Wazuh installation assistant timeout and add the logic to yum too #1493

Closed alberpilot closed 10 months ago

alberpilot commented 2 years ago

The following code shows how the Wazuh installation assistant manages a situation where another process is running apt, locking it and not allowing to use it to Wazuh installation assistant:

https://github.com/wazuh/wazuh-packages/blob/c875a1986c1bc30bfb079f10d024ece160c9a74a/unattended_installer/install_functions/installCommon.sh#L71-L92

Tasks

okynos commented 2 years ago

The rest of the unchecked points will be approached in a next iteration.

davidcr01 commented 10 months ago

Update Report

Reproducing the error

With this, it is necessary to create an installCommon_yumInstall function, similar to the installCommon_aptInstall function, and make the necessary changes.

davidcr01 commented 10 months ago

Update Report

Workaround

I encountered a problem in fetching the lock message of the yum command. When yum is locked, the yum install command generates the message but the script is blocked in that command because yum is not finished yet. I tried to redirect the output and/or send the process to the background but they do not work properly.

Another possible workaround was to set a timeout to the yum install command, but this alternative was discarded because large installation packages would be interrupted and slow internet connections would not allow Wazuh to install due to this timeout.

I changed the workaround for the issue. In the case of RPM, the yum lock is created in the /var/run/yum.pid file, so checking the existence of this file avoids fetching the lock message generated in the yum install command.

Development

Is necessary to:

I notice that, when yum is locked, the yum list installed command used in the yumInstallList function is blocked because of the lock, so it is necessary to adapt the mentioned function too and check if this behavior is reproduced in DEB systems.

[root@centos7 vagrant]# yum list installed
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 4421.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 104 M RSS (429 MB VSZ)
    Started: Tue Oct 31 14:01:04 2023 - 00:07 ago
    State  : Running, pid: 4421
davidcr01 commented 10 months ago

Update Report

RPM changes

The YUM change has been made and validated:

:green_circle: Installing several packages ```console [root@centos7 vagrant]# bash wazuh-install.sh -g -v 31/10/2023 12:57:14 DEBUG: Checking root permissions. 31/10/2023 12:57:14 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 31/10/2023 12:57:14 INFO: Verbose logging redirected to /var/log/wazuh-install.log 31/10/2023 12:57:14 DEBUG: YUM package manager will be used. 31/10/2023 12:57:14 DEBUG: Installing check dependencies. 31/10/2023 12:57:21 INFO: --- Dependencies --- 31/10/2023 12:57:21 INFO: Installing lsof. Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile config.yml logfile.log prueba.sh wazuh-install.sh base: ftp.cica.es config.yml logfile.log prueba.sh wazuh-install.sh extras: ftp.cica.es config.yml logfile.log prueba.sh wazuh-install.sh updates: ftp.cica.es Resolving Dependencies There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). --> Running transaction check ---> Package lsof.x86_64 0:4.87-6.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: lsof x86_64 4.87-6.el7 base 331 k Transaction Summary ================================================================================ Install 1 Package Total download size: 331 k Installed size: 927 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : lsof-4.87-6.el7.x86_64 1/1 Verifying : lsof-4.87-6.el7.x86_64 1/1 Installed: lsof.x86_64 0:4.87-6.el7 Complete! 31/10/2023 12:57:26 INFO: Installing openssl. Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile config.yml logfile.log prueba.sh wazuh-install.sh base: ftp.cica.es config.yml logfile.log prueba.sh wazuh-install.sh extras: ftp.cica.es config.yml logfile.log prueba.sh wazuh-install.sh updates: ftp.cica.es Resolving Dependencies There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). --> Running transaction check ---> Package openssl.x86_64 1:1.0.2k-26.el7_9 will be installed --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-26.el7_9 for package: 1:openssl-1.0.2k-26.el7_9.x86_64 --> Running transaction check ---> Package openssl-libs.x86_64 1:1.0.2k-19.el7 will be updated ---> Package openssl-libs.x86_64 1:1.0.2k-26.el7_9 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: openssl x86_64 1:1.0.2k-26.el7_9 updates 494 k Updating for dependencies: openssl-libs x86_64 1:1.0.2k-26.el7_9 updates 1.2 M Transaction Summary ================================================================================ Install 1 Package Upgrade ( 1 Dependent package) Total size: 1.7 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : 1:openssl-libs-1.0.2k-26.el7_9.x86_64 1/3 Installing : 1:openssl-1.0.2k-26.el7_9.x86_64 2/3 Cleanup : 1:openssl-libs-1.0.2k-19.el7.x86_64 3/3 Verifying : 1:openssl-libs-1.0.2k-26.el7_9.x86_64 1/3 Verifying : 1:openssl-1.0.2k-26.el7_9.x86_64 2/3 Verifying : 1:openssl-libs-1.0.2k-19.el7.x86_64 3/3 Installed: openssl.x86_64 1:1.0.2k-26.el7_9 Dependency Updated: openssl-libs.x86_64 1:1.0.2k-26.el7_9 Complete! 31/10/2023 12:57:31 DEBUG: Checking system distribution. 31/10/2023 12:57:31 DEBUG: Detected distribution name: centos 31/10/2023 12:57:31 DEBUG: Detected distribution version: 7 31/10/2023 12:57:31 DEBUG: Checking Wazuh installation. 31/10/2023 12:57:34 DEBUG: Installing check dependencies. 31/10/2023 12:57:40 DEBUG: Checking system architecture. 31/10/2023 12:57:40 INFO: Verifying that your system meets the recommended minimum hardware requirements. 31/10/2023 12:57:40 DEBUG: CPU cores detected: 2 31/10/2023 12:57:40 DEBUG: Free RAM memory detected: 1837 31/10/2023 12:57:40 INFO: --- Configuration files --- 31/10/2023 12:57:40 INFO: Generating configuration files. 31/10/2023 12:57:40 DEBUG: Checking if OpenSSL is installed. 31/10/2023 12:57:40 DEBUG: Creating Wazuh certificates. 31/10/2023 12:57:40 DEBUG: Reading configuration file. 31/10/2023 12:57:41 DEBUG: Checking if 127.0.0.1 is private. 31/10/2023 12:57:41 DEBUG: Checking if 127.0.0.1 is private. 31/10/2023 12:57:41 DEBUG: Checking if 127.0.0.1 is private. 31/10/2023 12:57:41 DEBUG: Creating the root certificate. Generating a 2048 bit RSA private key ...........+++ .........+++ writing new private key to '/tmp/wazuh-certificates//root-ca.key' ----- 31/10/2023 12:57:41 DEBUG: Generating Admin certificates. Generating RSA private key, 2048 bit long modulus ..........................+++ ..+++ e is 65537 (0x10001) Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=admin Getting CA Private Key 31/10/2023 12:57:41 DEBUG: Generating Wazuh indexer certificates. 31/10/2023 12:57:41 DEBUG: Creating the Wazuh indexer certificates. 31/10/2023 12:57:41 DEBUG: Generating certificate configuration. Generating a 2048 bit RSA private key .........................+++ ......+++ writing new private key to '/tmp/wazuh-certificates//node-1-key.pem' ----- Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=node-1 Getting CA Private Key 31/10/2023 12:57:41 DEBUG: Generating Filebeat certificates. 31/10/2023 12:57:41 DEBUG: Creating the Wazuh server certificates. 31/10/2023 12:57:41 DEBUG: Generating certificate configuration. Generating a 2048 bit RSA private key .................+++ .....................................+++ writing new private key to '/tmp/wazuh-certificates//wazuh-1-key.pem' ----- Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=wazuh-1 Getting CA Private Key 31/10/2023 12:57:41 DEBUG: Generating Wazuh dashboard certificates. 31/10/2023 12:57:41 DEBUG: Creating the Wazuh dashboard certificates. 31/10/2023 12:57:41 DEBUG: Generating certificate configuration. Generating a 2048 bit RSA private key ...........................................................................+++ .......+++ writing new private key to '/tmp/wazuh-certificates//dashboard-key.pem' ----- Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=dashboard Getting CA Private Key 31/10/2023 12:57:41 DEBUG: Cleaning certificate files. 31/10/2023 12:57:41 DEBUG: Generating password file. 31/10/2023 12:57:41 DEBUG: Generating random passwords. 31/10/2023 12:57:41 INFO: Created wazuh-install-files.tar. It contains the Wazuh cluster key, certificates, and passwords necessary for installation. [root@centos7 vagrant]# ```
:green_circle: Forcing a yum error ```console [root@centos7 vagrant]# bash wazuh-install.sh -g -v 31/10/2023 12:59:06 DEBUG: Checking root permissions. 31/10/2023 12:59:06 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 31/10/2023 12:59:06 INFO: Verbose logging redirected to /var/log/wazuh-install.log 31/10/2023 12:59:06 DEBUG: YUM package manager will be used. 31/10/2023 12:59:06 DEBUG: Installing check dependencies. 31/10/2023 12:59:13 INFO: --- Dependencies --- 31/10/2023 12:59:13 INFO: Installing nonexistingpackage. Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile config.yml logfile.log prueba.sh wazuh-install.sh base: ftp.cica.es config.yml logfile.log prueba.sh wazuh-install.sh extras: ftp.cica.es config.yml logfile.log prueba.sh wazuh-install.sh updates: ftp.cica.es No package nonexistingpackage available. Error: Nothing to do 31/10/2023 12:59:14 ERROR: Cannot install dependency: nonexistingpackage. [root@centos7 vagrant]# ```
:green_circle: Yum lock and unlock Behavior when yum is locked and then, unlocked. ```console [root@centos7 vagrant]# bash wazuh-install.sh -g -v 31/10/2023 15:14:00 DEBUG: Checking root permissions. 31/10/2023 15:14:00 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 31/10/2023 15:14:00 INFO: Verbose logging redirected to /var/log/wazuh-install.log 31/10/2023 15:14:00 DEBUG: YUM package manager will be used. 31/10/2023 15:14:00 DEBUG: Installing check dependencies. 31/10/2023 15:14:00 INFO: Another process is using YUM. Waiting for it to release the lock. Next retry in 30 seconds (1/10) 31/10/2023 15:14:30 INFO: Another process is using YUM. Waiting for it to release the lock. Next retry in 30 seconds (2/10) 31/10/2023 15:15:06 DEBUG: Checking system distribution. 31/10/2023 15:15:06 DEBUG: Detected distribution name: centos 31/10/2023 15:15:06 DEBUG: Detected distribution version: 7 31/10/2023 15:15:06 DEBUG: Checking Wazuh installation. 31/10/2023 15:15:09 DEBUG: Installing check dependencies. 31/10/2023 15:15:14 DEBUG: Checking system architecture. 31/10/2023 15:15:14 INFO: Verifying that your system meets the recommended minimum hardware requirements. 31/10/2023 15:15:14 DEBUG: CPU cores detected: 2 31/10/2023 15:15:14 DEBUG: Free RAM memory detected: 1837 31/10/2023 15:15:14 INFO: --- Configuration files --- 31/10/2023 15:15:14 INFO: Generating configuration files. 31/10/2023 15:15:14 DEBUG: Checking if OpenSSL is installed. 31/10/2023 15:15:14 DEBUG: Creating Wazuh certificates. 31/10/2023 15:15:14 DEBUG: Reading configuration file. 31/10/2023 15:15:14 DEBUG: Checking if 127.0.0.1 is private. 31/10/2023 15:15:14 DEBUG: Checking if 127.0.0.1 is private. 31/10/2023 15:15:14 DEBUG: Checking if 127.0.0.1 is private. 31/10/2023 15:15:14 DEBUG: Creating the root certificate. Generating a 2048 bit RSA private key ...................................................................................................................................................................................+++ ....................................................................................+++ writing new private key to '/tmp/wazuh-certificates//root-ca.key' ----- 31/10/2023 15:15:15 DEBUG: Generating Admin certificates. Generating RSA private key, 2048 bit long modulus .......................................................................+++ ..............................+++ e is 65537 (0x10001) Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=admin Getting CA Private Key 31/10/2023 15:15:15 DEBUG: Generating Wazuh indexer certificates. 31/10/2023 15:15:15 DEBUG: Creating the Wazuh indexer certificates. 31/10/2023 15:15:15 DEBUG: Generating certificate configuration. Generating a 2048 bit RSA private key .....................+++ .................................................................+++ writing new private key to '/tmp/wazuh-certificates//node-1-key.pem' ----- Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=node-1 Getting CA Private Key 31/10/2023 15:15:15 DEBUG: Generating Filebeat certificates. 31/10/2023 15:15:15 DEBUG: Creating the Wazuh server certificates. 31/10/2023 15:15:15 DEBUG: Generating certificate configuration. Generating a 2048 bit RSA private key ..............+++ ...........+++ writing new private key to '/tmp/wazuh-certificates//wazuh-1-key.pem' ----- Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=wazuh-1 Getting CA Private Key 31/10/2023 15:15:15 DEBUG: Generating Wazuh dashboard certificates. 31/10/2023 15:15:15 DEBUG: Creating the Wazuh dashboard certificates. 31/10/2023 15:15:15 DEBUG: Generating certificate configuration. Generating a 2048 bit RSA private key .......................................................................+++ .............................+++ writing new private key to '/tmp/wazuh-certificates//dashboard-key.pem' ----- Signature ok subject=/C=US/L=California/O=Wazuh/OU=Wazuh/CN=dashboard Getting CA Private Key 31/10/2023 15:15:15 DEBUG: Cleaning certificate files. 31/10/2023 15:15:15 DEBgreUG: Generating password file. 31/10/2023 15:15:15 DEBUG: Generating random passwords. 31/10/2023 15:15:16 INFO: Created wazuh-install-files.tar. It contains the Wazuh cluster key, certificates, and passwords necessary for installation. ```
:green_circle: Uninstalling Wazuh indexer with YUM lock and unlock ```console [root@centos7 vagrant]# bash wazuh-install.sh -u -v 31/10/2023 15:52:43 DEBUG: Checking root permissions. 31/10/2023 15:52:43 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 31/10/2023 15:52:43 INFO: Verbose logging redirected to /var/log/wazuh-install.log 31/10/2023 15:52:43 DEBUG: YUM package manager will be used. 31/10/2023 15:52:43 DEBUG: Checking system distribution. 31/10/2023 15:52:43 DEBUG: Detected distribution name: centos 31/10/2023 15:52:43 DEBUG: Detected distribution version: 7 31/10/2023 15:52:43 DEBUG: Checking Wazuh installation. 31/10/2023 15:52:43 INFO: Another process is using YUM. Waiting for it to release the lock. Next retry in 30 seconds (1/10) 31/10/2023 15:53:14 DEBUG: There are Wazuh indexer remaining files. 31/10/2023 15:53:15 INFO: Wazuh manager not found in the system so it was not uninstalled. 31/10/2023 15:53:15 INFO: Filebeat not found in the system so it was not uninstalled. 31/10/2023 15:53:15 INFO: Wazuh dashboard not found in the system so it was not uninstalled. 31/10/2023 15:53:15 INFO: Removing Wazuh indexer. Loaded plugins: fastestmirror Resolving Dependencies There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). --> Running transaction check ---> Package wazuh-indexer.x86_64 0:4.6.0-40600 will be erased --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Removing: wazuh-indexer x86_64 4.6.0-40600 @wazuh 930 M Transaction Summary ================================================================================ Remove 1 Package Installed size: 930 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Stopping wazuh-indexer service... OK Erasing : wazuh-indexer-4.6.0-40600.x86_64 1/1 warning: /etc/wazuh-indexer/opensearch.yml saved as /etc/wazuh-indexer/opensearch.yml.rpmsave warning: /etc/wazuh-indexer/jvm.options saved as /etc/wazuh-indexer/jvm.options.rpmsave Verifying : wazuh-indexer-4.6.0-40600.x86_64 1/1 Removed: wazuh-indexer.x86_64 0:4.6.0-40600 Complete! 31/10/2023 15:53:20 INFO: Wazuh indexer removed. 31/10/2023 15:53:20 DEBUG: Removing GPG key from system. [root@centos7 vagrant]# ```
davidcr01 commented 10 months ago

Update Report

APT workaround

I have tested that, when installing a packaging and removing another one, the lock error message is generated:

In one terminal:

The following packages will be upgraded:
  libx11-6
1 upgraded, 107 newly installed, 0 to remove and 147 not upgraded.
Need to get 21.9 MB of archives.
After this operation, 89.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

And then, in another

root@ubuntu22:/home/vagrant# apt-get remove zip
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 2318 (apt-get)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

With this, it is tested that when removing a Wazuh installation and using the APT package manager in another process, the lock error is generated, so it is necessary to handle it. However, the apt list --installed does not show this lock message when another process is using APT, so it is not necessary to change this. I found a bug in the Installation Assistant related to this: it seems that the Wazuh components are uninstalled successfully, but the lock error is being generated (false green). An issue has been reported here.

root@ubuntu22:/home/vagrant# bash wazuh-install.sh -u
02/11/2023 10:12:00 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0
02/11/2023 10:12:00 INFO: Verbose logging redirected to /var/log/wazuh-install.log
02/11/2023 10:12:02 INFO: Wazuh manager not found in the system so it was not uninstalled.
02/11/2023 10:12:02 INFO: Filebeat not found in the system so it was not uninstalled.
02/11/2023 10:12:02 INFO: Wazuh dashboard not found in the system so it was not uninstalled.
02/11/2023 10:12:02 INFO: Removing Wazuh indexer.
02/11/2023 10:12:02 INFO: Wazuh indexer removed.

root@ubuntu22:/home/vagrant# apt list --installed | grep wazuh
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
wazuh-indexer/now 4.8.0-40800 amd64 [installed,local]

root@ubuntu22:/home/vagrant# cat /var/log/wazuh-install.log
02/11/2023 10:15:16 DEBUG: Checking root permissions.
02/11/2023 10:15:16 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0
02/11/2023 10:15:16 INFO: Verbose logging redirected to /var/log/wazuh-install.log
02/11/2023 10:15:16 DEBUG: APT package manager will be used.
02/11/2023 10:15:16 DEBUG: Checking system distribution.
02/11/2023 10:15:16 DEBUG: Detected distribution name: ubuntu
02/11/2023 10:15:16 DEBUG: Detected distribution version: 22
02/11/2023 10:15:16 DEBUG: Checking Wazuh installation.
02/11/2023 10:15:17 INFO: Wazuh manager not found in the system so it was not uninstalled.
02/11/2023 10:15:17 INFO: Filebeat not found in the system so it was not uninstalled.
02/11/2023 10:15:17 INFO: Wazuh dashboard not found in the system so it was not uninstalled.
02/11/2023 10:15:17 INFO: Removing Wazuh indexer.
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 8230 (apt-get)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
02/11/2023 10:15:17 INFO: Wazuh indexer removed.
02/11/2023 10:15:17 DEBUG: Removing GPG key from system.
02/11/2023 10:15:17 INFO: Wazuh GPG key not found in the system
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 8230 (apt-get)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

To solve this, it is necessary to split the aptInstall function into two functions, one that installs the packages, and the other to check the APT lock. This last function will be also used in the installCommon_rollBack function.

This function will use the fuser /var/lib/dpkg/lock command. This command verifies if the lock file of APT is being used for another process.

davidcr01 commented 10 months ago

Update Report

Testing

:green_circle: Installing several packages ```console root@ubuntu22:/home/vagrant# bash wazuh-install.sh -g 02/11/2023 11:30:45 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 02/11/2023 11:30:45 INFO: Verbose logging redirected to /var/log/wazuh-install.log 02/11/2023 11:30:51 INFO: --- Dependencies ---- 02/11/2023 11:30:51 INFO: Installing lsof. 02/11/2023 11:30:53 INFO: Installing openssl. 02/11/2023 11:31:04 INFO: Verifying that your system meets the recommended minimum hardware requirements. 02/11/2023 11:31:04 INFO: --- Configuration files --- 02/11/2023 11:31:04 INFO: Generating configuration files. 02/11/2023 11:31:05 INFO: Created wazuh-install-files.tar. It contains the Wazuh cluster key, certificates, and passwords necessary for installation. root@ubuntu22:/home/vagrant# ```
:green_circle: Forcing an apt error ```console root@ubuntu22:/home/vagrant# bash wazuh-install.sh -g 02/11/2023 11:28:48 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 02/11/2023 11:28:48 INFO: Verbose logging redirected to /var/log/wazuh-install.log 02/11/2023 11:28:54 INFO: --- Dependencies ---- 02/11/2023 11:28:54 INFO: Installing lsof. 02/11/2023 11:28:54 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (1/10) 02/11/2023 11:28:55 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (2/10) 02/11/2023 11:28:56 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (3/10) 02/11/2023 11:28:57 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (4/10) 02/11/2023 11:28:58 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (5/10) 02/11/2023 11:28:59 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (6/10) 02/11/2023 11:29:00 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (7/10) 02/11/2023 11:29:01 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (8/10) 02/11/2023 11:29:02 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (9/10) 02/11/2023 11:29:03 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (10/10) 02/11/2023 11:29:04 ERROR: Cannot install dependency: lsof. ```
:green_circle: Apt lock and unlock Behavior when apt is locked and then, unlocked. ```console root@ubuntu22:/home/vagrant# bash wazuh-install.sh -g 02/11/2023 11:27:24 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 02/11/2023 11:27:24 INFO: Verbose logging redirected to /var/log/wazuh-install.log 02/11/2023 11:27:32 INFO: --- Dependencies ---- 02/11/2023 11:27:32 INFO: Installing lsof. 02/11/2023 11:27:32 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (1/10) 02/11/2023 11:27:33 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (2/10) 02/11/2023 11:27:34 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (3/10) 02/11/2023 11:27:35 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 1 seconds (4/10) 02/11/2023 11:27:45 INFO: Verifying that your system meets the recommended minimum hardware requirements. 02/11/2023 11:27:45 INFO: --- Configuration files --- 02/11/2023 11:27:45 INFO: Generating configuration files. 02/11/2023 11:27:48 INFO: Created wazuh-install-files.tar. It contains the Wazuh cluster key, certificates, and passwords necessary for installation. ```
:green_circle: Uninstalling Wazuh indexer with APT lock and unlock ```console root@ubuntu22:/home/vagrant# bash wazuh-install.sh -u 02/11/2023 11:43:29 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0 02/11/2023 11:43:29 INFO: Verbose logging redirected to /var/log/wazuh-install.log 02/11/2023 11:43:34 INFO: Wazuh manager not found in the system so it was not uninstalled. 02/11/2023 11:43:34 INFO: Filebeat not found in the system so it was not uninstalled. 02/11/2023 11:43:34 INFO: Wazuh dashboard not found in the system so it was not uninstalled. 02/11/2023 11:43:34 INFO: Removing Wazuh indexer. 02/11/2023 11:43:34 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 30 seconds (1/10) 02/11/2023 11:44:04 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 30 seconds (2/10) 02/11/2023 11:44:34 INFO: Another process is using APT. Waiting for it to release the lock. Next retry in 30 seconds (3/10) 02/11/2023 11:45:08 INFO: Wazuh indexer removed. 02/11/2023 11:45:08 INFO: Wazuh GPG key not found in the system root@ubuntu22:/home/vagrant# apt list --installed | grep wazuh ```