While running the script for armhf architecture on my Ubuntu x86_64, I get an error.
I follow this instruction https://github.com/wazuh/wazuh-agent/tree/master/packages
root@ubuntu:/home/symeon/Desktop/wazuh-agent/packages# ./generate_package.sh -t agent -a armhf -s ~/Files/STM32MP1/compiled_agent/
+++ dirname ./generate_package.sh
++ cd .
++ pwd -P
+ CURRENT_PATH=/home/symeon/Desktop/wazuh-agent/packages
++ cd /home/symeon/Desktop/wazuh-agent/packages/..
++ pwd -P
+ WAZUH_PATH=/home/symeon/Desktop/wazuh-agent
+ ARCHITECTURE=amd64
+ SYSTEM=deb
+ OUTDIR=/home/symeon/Desktop/wazuh-agent/packages/output/
+ BRANCH=
+ REVISION=0
+ TARGET=agent
+ JOBS=2
+ DEBUG=no
+ SRC=no
+ BUILD_DOCKER=yes
+ DOCKER_TAG=latest
+ INSTALLATION_PATH=/var/ossec
+ CHECKSUM=no
+ FUTURE=no
+ LEGACY=no
+ IS_STAGE=no
+ trap ctrl_c INT
+ main -t agent -a armhf -s /root/Files/STM32MP1/compiled_agent/
+ '[' -n -t ']'
+ case "$1" in
+ '[' -n agent ']'
+ TARGET=agent
+ shift 2
+ '[' -n -a ']'
+ case "$1" in
+ '[' -n armhf ']'
+ ARCHITECTURE=armhf
+ shift 2
+ '[' -n -s ']'
+ case "$1" in
+ '[' -n /root/Files/STM32MP1/compiled_agent/ ']'
+ OUTDIR=/root/Files/STM32MP1/compiled_agent/
+ shift 2
+ '[' -n '' ']'
+ '[' -z '' ']'
+ CUSTOM_CODE_VOL='-v /home/symeon/Desktop/wazuh-agent:/wazuh-local-src:Z'
+ build
+ build_pkg
+ '[' no = yes ']'
+ CONTAINER_NAME=pkg_deb_agent_builder_armhf
+ '[' armhf = arm64 ']'
+ '[' armhf = ppc64le ']'
+ DOCKERFILE_PATH=/home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
+ cp /home/symeon/Desktop/wazuh-agent/packages/build.sh /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
+ cp /home/symeon/Desktop/wazuh-agent/packages/debs/utils/gen_permissions.sh /home/symeon/Desktop/wazuh-agent/packages/debs/utils/helper_function.sh /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
+ [[ yes == \y\e\s ]]
+ docker build -t pkg_deb_agent_builder_armhf:latest /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
[+] Building 0.7s (15/15) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.40kB 0.0s
=> [internal] load metadata for docker.io/arm32v7/debian:stretch 0.7s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [ 1/10] FROM docker.io/arm32v7/debian:stretch@sha256:f0d0ca7b1c94bfa3fd5e0aaff7acec45d9067cf57170ab248e7087388353ea4f 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 7.71kB 0.0s
=> CACHED [ 2/10] RUN echo "deb http://archive.debian.org/debian stretch contrib main non-free" > /etc/apt/sources.list && echo "deb http://archive.debian.org/debian-security str 0.0s
=> CACHED [ 3/10] RUN apt-get build-dep python3.5 -y --allow-change-held-packages 0.0s
=> CACHED [ 4/10] RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y --allow-change-held-packages nodejs 0.0s
=> CACHED [ 5/10] RUN curl -OL http://packages.wazuh.com/utils/gcc/gcc-9.4.0.tar.gz && tar xzf gcc-9.4.0.tar.gz && cd gcc-9.4.0/ && linux32 ./contrib/download_prerequisites 0.0s
=> CACHED [ 6/10] RUN curl -OL http://packages.wazuh.com/utils/cmake/cmake-3.18.3.tar.gz && tar -zxvf cmake-3.18.3.tar.gz && cd cmake-3.18.3 && linux32 ./bootstrap --no-syste 0.0s
=> CACHED [ 7/10] ADD build.sh /usr/local/bin/build_package 0.0s
=> CACHED [ 8/10] RUN chmod +x /usr/local/bin/build_package 0.0s
=> CACHED [ 9/10] ADD helper_function.sh /usr/local/bin/helper_function.sh 0.0s
=> CACHED [10/10] ADD gen_permissions.sh /tmp/gen_permissions.sh 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:a94cd5b94c853403f6c4f395070d0cda2970dec8fa7513d6d01cbd80d1b3a249 0.0s
=> => naming to docker.io/library/pkg_deb_agent_builder_armhf:latest 0.0s
+ docker run -t --rm -v /root/Files/STM32MP1/compiled_agent/:/var/local/wazuh:Z -e SYSTEM=deb -e BUILD_TARGET=agent -e ARCHITECTURE_TARGET=armhf -e INSTALLATION_PATH=/var/ossec -e IS_STAGE=no -e WAZUH_BRANCH= -v /home/symeon/Desktop/wazuh-agent:/wazuh-local-src:Z pkg_deb_agent_builder_armhf:latest 0 2 no no no no no
WARNING: The requested image's platform (linux/arm/v7) does not match the detected host platform (linux/amd64/v4) and no specific platform was requested
+ '[' '!' -d /wazuh-local-src ']'
+ '[' no = no ']'
++ cd /wazuh-local-src
++ git rev-parse --short HEAD
+ short_commit_hash=fb573131e
++ build_directories /build_wazuh/agent 'wazuh*' no
++ local build_folder=/build_wazuh/agent
++ local 'wazuh_dir=wazuh*'
++ local future=no
++ mkdir -p /build_wazuh/agent
+++ cut -d v -f 2
+++ cat 'wazuh*/src/VERSION'
/bin/cat: 'wazuh*/src/VERSION': No such file or directory
++ wazuh_version=
++ [[ no == \y\e\s ]]
++ package_name=wazuh-agent-
++ source_dir=/build_wazuh/agent/wazuh-agent-
++ cp -R wazuh-local-src /build_wazuh/agent/wazuh-agent-
++ echo /build_wazuh/agent/wazuh-agent-
+ source_dir=/build_wazuh/agent/wazuh-agent-
++ cut -d v -f 2
++ cat /build_wazuh/agent/wazuh-agent-/src/VERSION
/bin/cat: /build_wazuh/agent/wazuh-agent-/src/VERSION: No such file or directory
+ wazuh_version=
+ package_name=wazuh-agent-
++ find /build_wazuh/agent/wazuh-agent- -name SPECS
++ grep deb
+ specs_path=/build_wazuh/agent/wazuh-agent-/packages/debs/SPECS
+ setup_build /build_wazuh/agent/wazuh-agent- /build_wazuh/agent/wazuh-agent-/packages/debs/SPECS /build_wazuh wazuh-agent- no
+ sources_dir=/build_wazuh/agent/wazuh-agent-
+ specs_path=/build_wazuh/agent/wazuh-agent-/packages/debs/SPECS
+ build_dir=/build_wazuh
+ package_name=wazuh-agent-
+ debug=no
+ cp -pr /build_wazuh/agent/wazuh-agent-/packages/debs/SPECS/wazuh-agent/debian /build_wazuh/agent/wazuh-agent-/debian
/bin/cp: cannot stat '/build_wazuh/agent/wazuh-agent-/packages/debs/SPECS/wazuh-agent/debian': No such file or directory
+ return 1
+ return 1
+ clean 1
+ exit_code=1
+ find /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent '(' -name '*.sh' -o -name '*.tar.gz' -o -name 'wazuh-*' ')' '!' -name docker_builder.sh -exec rm -rf '{}' +
+ exit 1
`root@ubuntu:/home/symeon/Desktop/wazuh-agent/packages# ``
The builder script can't find some files. Can anyone help? Thank you in advance.
*UPDATE I downloaded and built from https://github.com/wazuh/wazuh/tree/master/packages repository and encountered the following error.
# Build the binaries
make -C src deps TARGET=agent
make[2]: Entering directory '/build_wazuh/agent/wazuh-agent-5.0.0/src'
curl -so external/cJSON.tar.gz https://packages.wazuh.com/deps/30/libraries/linux/arm32/cJSON.tar.gz || true
cd external && test -e cJSON.tar.gz && gunzip cJSON.tar.gz || true
/bin/sh: 1: cd: can't cd to external
cd external && test -e cJSON.tar && tar -xf cJSON.tar || true
/bin/sh: 1: cd: can't cd to external
test -e external/cJSON.tar && rm external/cJSON.tar || true
test -d external/cJSON ||\
(curl -so external/cJSON.tar.gz https://packages.wazuh.com/deps/30/libraries/sources/cJSON.tar.gz &&\
cd external && gunzip cJSON.tar.gz && tar -xf cJSON.tar && rm cJSON.tar)
Makefile:952: recipe for target 'external/cJSON.tar.gz' failed
make[2]: *** [external/cJSON.tar.gz] Error 23
make[2]: Leaving directory '/build_wazuh/agent/wazuh-agent-5.0.0/src'
debian/rules:40: recipe for target 'override_dh_install' failed
make[1]: *** [override_dh_install] Error 2
make[1]: Leaving directory '/build_wazuh/agent/wazuh-agent-5.0.0'
debian/rules:30: recipe for target 'binary' failed
make: *** [binary] Error 2
dpkg-buildpackage: error: sudo debian/rules binary gave error exit status 2
debuild: fatal error at line 1116:
dpkg-buildpackage -rsudo -us -uc -b -nc failed
+ return 1
+ return 1
+ clean 1
+ exit_code=1
+ find /home/user/Desktop/STM32/wazuh/packages/debs/armhf/agent '(' -name '*.sh' -o -name '*.tar.gz' -o -name 'wazuh-*' ')' '!' -name docker_builder.sh -exec rm -rf '{}' +
+ exit 1
The behavior you report is expected
In the first case, you are using the wazuh-agent
repository, which is currently under development and may not be functional, as indicated by the README
file.
Work in progress: This project is currently under development. It is not functional and is not compatible with the official release version of the Wazuh manager.
This development is targeted for 5.0.0
, it is expected to migrate the wazuh/wazuh
repository partially, so that the wazuh/wazuh
repository will be dedicated to the Wazuh manager, while the wazuh-agent
repository will be dedicated to the Wazuh agent.
In the second case, the repository is almost correct, but you are using the master
branch, which currently corresponds to 5.0.0
(which will be partially migrated) and as also indicated by the README
file of the repository. it may contain errors.
master branch contains the latest code, be aware of possible bugs on this branch.
The current production version at this moment is v4.9.2
, and I recommend that if you want to create a package you follow the official documentation since it refers to the correct versions, branches/tags, and repositories.
If you want to build a Wazuh agent package you can refer to the Wazuh packages generation guide
https://documentation.wazuh.com/current/development/packaging/index.html