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

Terminal freezes on deb upgrade #316

Merged
merged 4 commits into from
Sep 19, 2024

Conversation

Tostti
Copy link
Member

@Tostti Tostti commented Sep 18, 2024

Description

This PR fixes a problem that caused upgrades in deb environments to freeze the terminal until the user presses enter. The problem was also in rpm packages, but it didn't cause any terminal issues.

Issues Resolved

#301

Test

RPM

  • Install a previous wazuh version
yum install libcap
rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH
echo -e '[wazuh]\ngpgcheck=1\ngpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH\nenabled=1\nname=EL-$releasever - Wazuh\nbaseurl=https://packages.wazuh.com/4.x/yum/\nprotect=1' | tee /etc/yum.repos.d/wazuh.repo
yum -y install wazuh-dashboard
  • Install the new package on top of it. Verify that the installation ends successfully, the terminal doesn't freeze and no errors are shown.
yum localinstall <package>

DEB

  • Install a previous wazuh version
apt-get update
apt-get install debhelper tar curl libcap2-bin #debhelper version 9 or later
apt-get install gnupg apt-transport-https
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import && chmod 644 /usr/share/keyrings/wazuh.gpg
echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" | tee -a /etc/apt/sources.list.d/wazuh.list
apt-get update
apt-get -y install wazuh-dashboard
  • Install the new package on top of it. Verify that the installation ends successfully, the terminal doesn't freeze and no errors are shown.
dpkg -i <package>

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@Tostti Tostti self-assigned this Sep 18, 2024
@Tostti Tostti linked an issue Sep 18, 2024 that may be closed by this pull request
@asteriscos
Copy link
Member

asteriscos commented Sep 19, 2024

Test Deb 🟢

The upgrade to 4.9.1 from 4.8.2 didn't freeze the terminal.

root@ubuntu-jammy:/etc/wazuh-dashboard# dpkg -i /vagrant/packages/wazuh-dashboard_4.9.1-1_amd64_1f08cd29c4.deb 
(Reading database ... 178533 files and directories currently installed.)
Preparing to unpack .../wazuh-dashboard_4.9.1-1_amd64_1f08cd29c4.deb ...
Unpacking wazuh-dashboard (4.9.1-1) over (4.8.2-1) ...
Setting up wazuh-dashboard (4.9.1-1) ...
Installing new version of config file /etc/systemd/system/wazuh-dashboard ...
Installing new version of config file /etc/wazuh-dashboard/node.options ...

Configuration file '/etc/wazuh-dashboard/opensearch_dashboards.yml'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** opensearch_dashboards.yml (Y/I/N/O/D/Z) [default=N] ? 

Check keystore

root@ubuntu-jammy:/home/vagrant# ls -la /etc/wazuh-dashboard/
certs/                               opensearch_dashboards.keystore       opensearch_dashboards.yml.dpkg-dist
node.options                         opensearch_dashboards.yml 

Test RPM 🟢

The upgrade to 4.9.1 from 4.8.2 didn't freeze the terminal.

[root@localhost vagrant]# yum localinstall /vagrant/packages/wazuh-dashboard_4.9.1-1_x86_64_398a9479ed.rpm 
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream                                                                             21 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                                                                58 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Extras                                                                                23 kB/s | 1.5 kB     00:00    
Dependencies resolved.
======================================================================================================================================
 Package                             Architecture               Version                        Repository                        Size
======================================================================================================================================
Upgrading:
 wazuh-dashboard                     x86_64                     4.9.1-1                        @commandline                     253 M

Transaction Summary
======================================================================================================================================
Upgrade  1 Package

Total size: 253 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-dashboard-4.9.1-1.x86_64                                                                               1/1 
  Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64                                                                               1/2 
  Upgrading        : wazuh-dashboard-4.9.1-1.x86_64                                                                               1/2 
warning: /etc/wazuh-dashboard/opensearch_dashboards.yml created as /etc/wazuh-dashboard/opensearch_dashboards.yml.rpmnew

  Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64                                                                               1/2 
  Running scriptlet: wazuh-dashboard-4.8.2-1.x86_64                                                                               2/2 
  Cleanup          : wazuh-dashboard-4.8.2-1.x86_64                                                                               2/2 
  Running scriptlet: wazuh-dashboard-4.8.2-1.x86_64                                                                               2/2 
  Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64                                                                               2/2 
  Running scriptlet: wazuh-dashboard-4.8.2-1.x86_64                                                                               2/2 
  Verifying        : wazuh-dashboard-4.9.1-1.x86_64                                                                               1/2 
  Verifying        : wazuh-dashboard-4.8.2-1.x86_64                                                                               2/2 

Upgraded:
  wazuh-dashboard-4.9.1-1.x86_64                                                                                                      

Complete!

Check keystore

[root@localhost vagrant]# ls -la /etc/wazuh-dashboard/
certs/                            opensearch_dashboards.keystore    opensearch_dashboards.yml.rpmnew
node.options                      opensearch_dashboards.yml

asteriscos
asteriscos previously approved these changes Sep 19, 2024
@JuanGarriuz
Copy link
Member

JuanGarriuz commented Sep 19, 2024

Test

RPM🟢

[root@fedora37 vagrant]# yum install /vagrant/wazuh-dashboard_4.9.1-1_x86_64_398a9479ed.rpm
Last metadata expiration check: 0:02:55 ago on Thu 19 Sep 2024 10:52:50 AM UTC.
Dependencies resolved.
======================================================================================================
 Package                     Architecture       Version                Repository                Size
======================================================================================================
Upgrading:
 wazuh-dashboard             x86_64             4.9.1-1                @commandline             253 M

Transaction Summary
======================================================================================================
Upgrade  1 Package

Total size: 253 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-dashboard-4.9.1-1.x86_64                                               1/2
  Upgrading        : wazuh-dashboard-4.9.1-1.x86_64                                               1/2
  Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64                                               1/2
  Running scriptlet: wazuh-dashboard-4.9.0-2.x86_64                                               2/2
  Cleanup          : wazuh-dashboard-4.9.0-2.x86_64                                               2/2
  Running scriptlet: wazuh-dashboard-4.9.0-2.x86_64                                               2/2
  Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64                                               2/2
  Running scriptlet: wazuh-dashboard-4.9.0-2.x86_64                                               2/2
  Verifying        : wazuh-dashboard-4.9.1-1.x86_64                                               1/2
  Verifying        : wazuh-dashboard-4.9.0-2.x86_64                                               2/2

Upgraded:
  wazuh-dashboard-4.9.1-1.x86_64

Complete!

DEB 🟢


root@ubuntu2204:/vagrant# dpkg -i wazuh-dashboard_4.9.1-1_amd64_1f08cd29c4.deb
(Reading database ... 178049 files and directories currently installed.)
Preparing to unpack wazuh-dashboard_4.9.1-1_amd64_1f08cd29c4.deb ...
Unpacking wazuh-dashboard (4.9.1-1) over (4.9.0-2) ...
Setting up wazuh-dashboard (4.9.1-1) ...
root@ubuntu2204:/vagrant#

Copy link
Member

@JuanGarriuz JuanGarriuz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@asteriscos asteriscos merged commit e5fd956 into 4.9.1 Sep 19, 2024
57 of 61 checks passed
@asteriscos asteriscos deleted the fix/301-terminal-freezes-on-upgrade branch September 19, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wazuh dashboard installation freezes terminal
3 participants