Closed Leoquicenoz closed 3 months ago
After the modifications made by running the command: ./generate_rpm_package.sh -b 4.9.0 --packages-branch 2866-add-debug-symbols-to-rpms -t manager -a x86_64
I get the following output:
Provides: wazuh-manager = 4.9.0-1 wazuh-manager(x86-64) = 4.9.0-1
Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh /usr/sbin/groupadd /usr/sbin/useradd
Requires(post): /bin/sh
Requires(preun): /bin/sh
Requires(postun): /bin/sh /usr/sbin/groupdel /usr/sbin/userdel
Requires(posttrans): /bin/sh
Conflicts: ossec-hids ossec-hids-agent wazuh-agent wazuh-local
Obsoletes: wazuh-api < 4.0.0
Checking for unpackaged file(s): /usr/local/lib/rpm/check-files /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64
Wrote: /build_wazuh/rpmbuild/SRPMS/wazuh-manager-4.9.0-1.src.rpm
Wrote: /build_wazuh/rpmbuild/RPMS/x86_64/wazuh-manager-4.9.0-1.x86_64.rpm
Executing(%clean): /bin/sh -e /usr/local/var/tmp/rpm-tmp.WL6fck
+ umask 022
+ cd /build_wazuh/rpmbuild/BUILD
+ cd wazuh-manager-4.9.0
+ rm -fr /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64
+ RPM_EC=0
++ jobs -p
+ exit 0
+ [[ no == \y\e\s ]]
+ [[ no == \y\e\s ]]
+ find /build_wazuh/rpmbuild/RPMS/x86_64 -maxdepth 3 -type f -name 'wazuh-manager-4.9.0-1*' -exec mv '{}' /var/local/wazuh ';'
+ find /build_wazuh/rpmbuild/RPMS/x86_64 -maxdepth 3 -type f -name 'wazuh-manager-4.9.0-1-debuginfo*' -exec mv '{}' /var/local/wazuh ';'
Package wazuh-manager-4.9.0-1.x86_64.rpm added to /home/leo/Desktop/debug_symbols/rpm_packages/dev_branch_49/wazuh-packages/rpms/output/.
The package with the debug symbols has not been obtained in the output
folder.
The ETA is delayed because the changes made to the code have not been sufficient to generate the package with the debug symbols as expected, some additional modifications are being made and further research is being done.
The ETA is delayed again because we still have not been able to generate the rpm packages with debug information, after a long research, we have found some references that we have used for testing and they have not been successful.
We tried to find inside the docker container that is generated in the process of building the rpm packages, the files with debuginfo
, we thought that maybe they were being generated but we could not copy it from the container to the host, but as in the code is established that once the process is finished, the container is deleted, we had to make modifications in the generate_debian_package.sh
file so that it is not deleted and then we could search in it, we found the following files:
[root@3e33e3e15891 /]# sudo find / -name '*debuginfo*'
/usr/bin/debuginfo-install
/usr/local/lib/rpm/fileattrs/debuginfo.attr
/usr/local/lib/rpm/find-debuginfo.sh
/usr/local/lib/rpm/debuginfo.prov
/usr/include/valgrind/pub_tool_debuginfo.h
/usr/lib/rpm/.find-debuginfo.sh.swo
/usr/lib/rpm/.find-debuginfo.sh.swp
/usr/lib/rpm/find-debuginfo.sh
find: '/proc/1566/task/1566/fdinfo': Permission denied
find: '/proc/1566/fdinfo': Permission denied
/build_wazuh/rpmbuild/BUILD/wazuh-manager-4.9.0/src/external/rpm/fileattrs/debuginfo.attr
[root@3e33e3e15891 /]# sudo find / -name '*wazuh-manager-4.9.0*'
/var/local/checksum/wazuh-manager-4.9.0-1.x86_64.rpm
/var/local/wazuh/wazuh-manager-4.9.0-1.x86_64.rpm
find: '/proc/3884/task/3884/fdinfo': Permission denied
find: '/proc/3884/fdinfo': Permission denied
/build_wazuh/wazuh-manager-4.9.0
/build_wazuh/rpmbuild/SRPMS/wazuh-manager-4.9.0-1.src.rpm
/build_wazuh/rpmbuild/SOURCES/wazuh-manager-4.9.0.tar.gz
/build_wazuh/rpmbuild/SPECS/wazuh-manager-4.9.0.spec
/build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64
/build_wazuh/rpmbuild/BUILD/wazuh-manager-4.9.0
Not finding the files we need with debuginfo
, we have been testing with references found on the web but these have been unsuccessful.
We think that maybe this behavior could be due to the fact that the tests we have been performing have been with the 4.9.0
branch and in this branch the binaries with the debug symbols are not obtained, the branch with which we want to run the script is set as follows: ./generate_rpm_package.sh -b 4.9.0 --dev -t manager -d
Once we try to run the script with the branch where we get the default debug symbols, the following error is displayed:
./generate_rpm_package.sh -b enhancement/9913-generate-debug-symbols --dev -t manager -d
Processing files: wazuh-manager-4.9.0-1.x86_64
error: Directory not found: /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64/var/ossec/templates
error: File not found: /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64/var/ossec/templates/vd_states_template.json
error: File not found: /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64/var/ossec/tmp/vd_1.0.0_vd_4.8.0.tar.xz
RPM build errors:
Directory not found: /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64/var/ossec/templates
File not found: /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64/var/ossec/templates/vd_states_template.json
File not found: /build_wazuh/rpmbuild/BUILDROOT/wazuh-manager-4.9.0-1.x86_64/var/ossec/tmp/vd_1.0.0_vd_4.8.0.tar.xz
The following modifications were made:
/wazuh-packages/rpms/build.sh file
, --with debug
is added when using $rpmbuild
./wazuh-packages/rpms/SPECS/wazuh-manager.spec
: %debug_package
%define debug_package %{nil}
And when I run the script ./generate_rpm_package.sh -b 4.9.0 --dev -t manager -d
I get the error
+ /usr/local/bin/rpmbuild --with debug --define '_sysconfdir /etc' --define '_topdir /build_wazuh/rpmbuild' --define '_threads 2' -- define '_release 1' --define '_localstatedir /var/ossec' --define '_debugenabled yes' --target x86_64 -ba /build_wazuh/rpmbuild/SPECS/wazuh-manager-4. 9.0.spec
Building target platforms: x86_64
Building for x86_64
error: line 891: %package debuginfo
package wazuh-manager-debuginfo already exists
So it can be deduced that if the file is generated with debuginfo
, but it does not appear in the docker container once the search is done with
sudo find / -name '*debuginfo*'
/usr/bin/debuginfo-install
/usr/local/lib/rpm/fileattrs/debuginfo.attr
/usr/local/lib/rpm/find-debuginfo.sh
/usr/local/lib/lib/rpm/debuginfo.prov
/usr/include/valgrind/pub_tool_debuginfo.h
/usr/lib/rpm/find-debuginfo.sh
ETA delayed to allow time for review
Moved ETA to allow @tdrauncieal to review
Description
Currently, the RPM and DEB packages generated do not include debug symbols, which can hinder debugging efforts when issues arise. This issue aims to implement the necessary steps to generate packages with debug symbols for both RPM and DEB packages.
Proposed Solution
RPM 1- Set
%_enable_debug_package 1
2- Add this segment to the%description
in the spec file3- Copy the dbg file with build.sh from the docker container to the host machine.
Definition of Done