From df499b6529f6733c24964d9d41b8c6cc29ad16d0 Mon Sep 17 00:00:00 2001 From: mohan-selvaraj <54177569+mohan-selvaraj@users.noreply.github.com> Date: Mon, 22 Apr 2024 22:08:27 +0530 Subject: [PATCH] bookworm container upgrade for lldp, net-snmp (#18150) * bookworm container upgrade for lldp, net-snmp * Add patch 0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch Co-authored-by: Kalimuthu Velappan --- dockers/docker-lldp/Dockerfile.j2 | 2 +- dockers/docker-snmp/Dockerfile.j2 | 2 +- dockers/docker-snmp/supervisord.conf | 16 +++++----- rules/docker-lldp.mk | 10 +++---- rules/docker-snmp.mk | 10 +++---- rules/snmpd.mk | 13 ++++++-- ...ng-logs-with-statfs-permission-denie.patch | 25 ++++++++++++++++ ..._BUILD_ARCH_OS-in-order-to-build-ipv.patch | 25 ++++++++++++++++ ...n-Unbreak-the-enable-minimalist-buil.patch | 30 +++++++++++++++++++ ...3-enable-parallel-build-for-net-snmp.patch | 18 +++++++++++ .../cross-compile-changes.patch | 20 +++++++++++++ src/snmpd/patch-5.9.3+dfsg/series | 5 ++++ 12 files changed, 153 insertions(+), 23 deletions(-) create mode 100644 src/snmpd/patch-5.9.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch create mode 100644 src/snmpd/patch-5.9.3+dfsg/0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch create mode 100644 src/snmpd/patch-5.9.3+dfsg/0012-agent-Makefile.in-Unbreak-the-enable-minimalist-buil.patch create mode 100644 src/snmpd/patch-5.9.3+dfsg/0013-enable-parallel-build-for-net-snmp.patch create mode 100644 src/snmpd/patch-5.9.3+dfsg/cross-compile-changes.patch create mode 100644 src/snmpd/patch-5.9.3+dfsg/series diff --git a/dockers/docker-lldp/Dockerfile.j2 b/dockers/docker-lldp/Dockerfile.j2 index 9bc6418524cb..e1b8f1a32efb 100644 --- a/dockers/docker-lldp/Dockerfile.j2 +++ b/dockers/docker-lldp/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-snmp/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 index 8465e4fb94fd..174f1ae44150 100644 --- a/dockers/docker-snmp/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python3_wheels, copy_files %} -FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-snmp/supervisord.conf b/dockers/docker-snmp/supervisord.conf index 3d11cc48eafd..1f01a7c21e4b 100644 --- a/dockers/docker-snmp/supervisord.conf +++ b/dockers/docker-snmp/supervisord.conf @@ -24,8 +24,8 @@ command=/usr/sbin/rsyslogd -n -iNONE priority=1 autostart=false autorestart=unexpected -stdout_logfile=syslog -stderr_logfile=syslog +stdout_syslog=true +stderr_syslog=true dependent_startup=true [program:start] @@ -34,8 +34,8 @@ priority=1 autostart=true autorestart=false startsecs=0 -stdout_logfile=syslog -stderr_logfile=syslog +stdout_syslog=true +stderr_syslog=true dependent_startup=true dependent_startup_wait_for=rsyslogd:running @@ -44,8 +44,8 @@ command=/usr/sbin/snmpd -f -LS0-2d -u Debian-snmp -g Debian-snmp -I -smux,mteTri priority=3 autostart=false autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog +stdout_syslog=true +stderr_syslog=true dependent_startup=true dependent_startup_wait_for=start:exited @@ -54,7 +54,7 @@ command=/usr/bin/env python3 -m sonic_ax_impl priority=4 autostart=false autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog +stdout_syslog=true +stderr_syslog=true dependent_startup=true dependent_startup_wait_for=snmpd:running diff --git a/rules/docker-lldp.mk b/rules/docker-lldp.mk index ddd079c4d3e2..81cc582a3f1b 100644 --- a/rules/docker-lldp.mk +++ b/rules/docker-lldp.mk @@ -8,13 +8,13 @@ $(DOCKER_LLDP)_PATH = $(DOCKERS_PATH)/docker-lldp $(DOCKER_LLDP)_DEPENDS += $(LLDPD) $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) -$(DOCKER_LLDP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_LLDP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS) $(DOCKER_LLDP)_DBG_DEPENDS += $(LLDPD_DBG) $(LIBSWSSCOMMON_DBG) -$(DOCKER_LLDP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) +$(DOCKER_LLDP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) $(DOCKER_LLDP)_PYTHON_WHEELS += $(DBSYNCD_PY3) -$(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) +$(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) $(DOCKER_LLDP)_VERSION = 1.0.0 $(DOCKER_LLDP)_PACKAGE_NAME = lldp @@ -36,5 +36,5 @@ $(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl $(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpcli:/usr/bin/lldpcli $(DOCKER_LLDP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) -SONIC_BULLSEYE_DOCKERS += $(DOCKER_LLDP) -SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_LLDP_DBG) +SONIC_BOOKWORM_DOCKERS += $(DOCKER_LLDP) +SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_LLDP_DBG) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk index 00c20ab6cf72..3546d47787a9 100644 --- a/rules/docker-snmp.mk +++ b/rules/docker-snmp.mk @@ -9,14 +9,14 @@ $(DOCKER_SNMP)_PATH = $(DOCKERS_PATH)/docker-snmp ## TODO: remove LIBPY3_DEV if we can get pip3 directly $(DOCKER_SNMP)_DEPENDS += $(SNMP) $(SNMPD) -$(DOCKER_SNMP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_SNMP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS) $(DOCKER_SNMP)_DBG_DEPENDS += $(SNMP_DBG) $(SNMPD_DBG) $(LIBSNMP_DBG) $(DOCKER_SNMP)_DBG_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) -$(DOCKER_SNMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) +$(DOCKER_SNMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) $(DOCKER_SNMP)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_PY3) $(ASYNCSNMP_PY3) -$(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) +$(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) $(DOCKER_SNMP)_VERSION = 1.0.0 $(DOCKER_SNMP)_PACKAGE_NAME = snmp @@ -34,5 +34,5 @@ $(DOCKER_SNMP)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro $(DOCKER_SNMP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) $(DOCKER_SNMP)_BASE_IMAGE_FILES += monit_snmp:/etc/monit/conf.d -SONIC_BULLSEYE_DOCKERS += $(DOCKER_SNMP) -SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_SNMP_DBG) +SONIC_BOOKWORM_DOCKERS += $(DOCKER_SNMP) +SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_SNMP_DBG) diff --git a/rules/snmpd.mk b/rules/snmpd.mk index e9e498556c5e..c70f30a4cad3 100644 --- a/rules/snmpd.mk +++ b/rules/snmpd.mk @@ -1,6 +1,9 @@ # snmpd package -ifeq ($(BLDENV),bullseye) +ifeq ($(BLDENV),bookworm) +SNMPD_VERSION = 5.9.3+dfsg +SNMPD_VERSION_FULL = $(SNMPD_VERSION)-2 +else ifeq ($(BLDENV),bullseye) SNMPD_VERSION = 5.9+dfsg SNMPD_VERSION_FULL = $(SNMPD_VERSION)-4+deb11u1 else @@ -37,7 +40,9 @@ $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMP_DBG))) SNMPD_DBG = snmpd-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMPD_DBG))) -ifeq ($(BLDENV),bullseye) +ifeq ($(BLDENV),bookworm) +LIBSNMP = libsnmp40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb +else ifeq ($(BLDENV),bullseye) LIBSNMP = libsnmp40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb else LIBSNMP = libsnmp30_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb @@ -45,7 +50,9 @@ endif $(LIBSNMP)_RDEPENDS += $(LIBSNMP_BASE) $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP))) -ifeq ($(BLDENV),bullseye) +ifeq ($(BLDENV),bookworm) +LIBSNMP_DBG = libsnmp40-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb +else ifeq ($(BLDENV),bullseye) LIBSNMP_DBG = libsnmp40-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb else LIBSNMP_DBG = libsnmp30-dbg_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb diff --git a/src/snmpd/patch-5.9.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch b/src/snmpd/patch-5.9.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch new file mode 100644 index 000000000000..7aec7904cb1c --- /dev/null +++ b/src/snmpd/patch-5.9.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch @@ -0,0 +1,25 @@ +From 8bb8849524aba2124be3279a5197ad5fbfe166b2 Mon Sep 17 00:00:00 2001 +From: pavel-shirshov +Date: Mon, 27 Aug 2018 16:50:16 +0800 +Subject: [PATCH] [SNMP] Stop spamming logs with statfs permission denied log + +--- + agent/mibgroup/hardware/fsys/fsys_mntctl.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/agent/mibgroup/hardware/fsys/fsys_mntctl.c b/agent/mibgroup/hardware/fsys/fsys_mntctl.c +index 782c8ed..7819fe4 100644 +--- a/agent/mibgroup/hardware/fsys/fsys_mntctl.c ++++ b/agent/mibgroup/hardware/fsys/fsys_mntctl.c +@@ -167,8 +167,6 @@ netsnmp_fsys_arch_load( void ) + continue; + + if ( statfs( entry->path, &stat_buf ) < 0 ) { +- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); +- snmp_log_perror( tmpbuf ); + continue; + } + entry->units = stat_buf.f_bsize; +-- +2.18.0 + diff --git a/src/snmpd/patch-5.9.3+dfsg/0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch b/src/snmpd/patch-5.9.3+dfsg/0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch new file mode 100644 index 000000000000..5a277bb9a5b5 --- /dev/null +++ b/src/snmpd/patch-5.9.3+dfsg/0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch @@ -0,0 +1,25 @@ +From bd7d6d79217da6b5a2eb3a3ee1d409c175a61e41 Mon Sep 17 00:00:00 2001 +From: Qi Luo +Date: Fri, 20 Sep 2019 00:42:19 +0000 +Subject: [PATCH] Enable macro DEB_BUILD_ARCH_OS in order to build ipv6 feature + +--- + debian/rules | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/debian/rules b/debian/rules +index 34d8509..496be59 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -4,6 +4,8 @@ + export DEB_BUILD_MAINT_OPTIONS := hardening=+all + include /usr/share/dpkg/architecture.mk + include /usr/share/dpkg/buildtools.mk ++DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ++DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) + + LIB_VERSION = 40 + +-- +2.18.0 + diff --git a/src/snmpd/patch-5.9.3+dfsg/0012-agent-Makefile.in-Unbreak-the-enable-minimalist-buil.patch b/src/snmpd/patch-5.9.3+dfsg/0012-agent-Makefile.in-Unbreak-the-enable-minimalist-buil.patch new file mode 100644 index 000000000000..ba2283cc5c4f --- /dev/null +++ b/src/snmpd/patch-5.9.3+dfsg/0012-agent-Makefile.in-Unbreak-the-enable-minimalist-buil.patch @@ -0,0 +1,30 @@ +From 0d3e33ff197d1d15c0036b69cca5198e54781efe Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Sun, 24 Jul 2022 16:45:05 -0700 +Subject: [PATCH] agent/Makefile.in: Unbreak the --enable-minimalist build + +Build the features rules in the mibgroup directory before building the +features rules in the helpers directory. + +Fixes: 51128ad09507 ("agent/Makefile.in: Build the MIB module code once") +Fixes: https://github.com/net-snmp/net-snmp/issues/438 +--- + agent/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/agent/Makefile.in b/agent/Makefile.in +index 047d880..44f8818 100644 +--- a/agent/Makefile.in ++++ b/agent/Makefile.in +@@ -16,7 +16,7 @@ mysubdir=agent + # what to install + # + SUBDIRS=helpers +-FTSUBDIRS=helpers ++FTSUBDIRS=mibgroup helpers + + INSTALLSBINPROGS= @SNMPD@ + INSTALLLIBS = libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION) +-- +2.18.0 + diff --git a/src/snmpd/patch-5.9.3+dfsg/0013-enable-parallel-build-for-net-snmp.patch b/src/snmpd/patch-5.9.3+dfsg/0013-enable-parallel-build-for-net-snmp.patch new file mode 100644 index 000000000000..aec800c031fd --- /dev/null +++ b/src/snmpd/patch-5.9.3+dfsg/0013-enable-parallel-build-for-net-snmp.patch @@ -0,0 +1,18 @@ +diff --git a/debian/rules b/debian/rules +index 496be59..939e1a4 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -37,10 +37,6 @@ endif + %: + dh $@ + +-# The net-snmp Makefiles cannot handle parallel builds +-override_dh_auto_build: +- dh_auto_build --no-parallel +- + override_dh_auto_configure: + dh_auto_configure -- --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man \ + --with-persistent-directory=/var/lib/snmp \ +-- +2.18.0 + diff --git a/src/snmpd/patch-5.9.3+dfsg/cross-compile-changes.patch b/src/snmpd/patch-5.9.3+dfsg/cross-compile-changes.patch new file mode 100644 index 000000000000..f6fc80e9c560 --- /dev/null +++ b/src/snmpd/patch-5.9.3+dfsg/cross-compile-changes.patch @@ -0,0 +1,20 @@ +diff --git a/debian/rules b/debian/rules +index 939e1a4..efd323e 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -7,6 +7,12 @@ include /usr/share/dpkg/buildtools.mk + DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) + ++DEB_BUILD_MULTIARCH ?= $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH) ++ ++ifneq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH)) ++export PERL5OPT := -I/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config ++endif ++ + LIB_VERSION = 40 + + MIB_MODULES = smux ucd-snmp/dlmod mibII/mta_sendmail disman/event-mib +-- +2.18.0 + diff --git a/src/snmpd/patch-5.9.3+dfsg/series b/src/snmpd/patch-5.9.3+dfsg/series new file mode 100644 index 000000000000..77d1b0898844 --- /dev/null +++ b/src/snmpd/patch-5.9.3+dfsg/series @@ -0,0 +1,5 @@ +0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch +0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch +0012-agent-Makefile.in-Unbreak-the-enable-minimalist-buil.patch +0013-enable-parallel-build-for-net-snmp.patch +cross-compile-changes.patch