Skip to content

[build] add a dependency on libnetsnmptrapd40 for libsnmp-dev#25370

Merged
liushilongbuaa merged 21 commits intosonic-net:masterfrom
yijingyan2:snmp-add-dependency
Mar 5, 2026
Merged

[build] add a dependency on libnetsnmptrapd40 for libsnmp-dev#25370
liushilongbuaa merged 21 commits intosonic-net:masterfrom
yijingyan2:snmp-add-dependency

Conversation

@yijingyan2
Copy link
Contributor

@yijingyan2 yijingyan2 commented Feb 5, 2026

Why I did it

  • Add a dependency on libnetsnmptrapd40 for libsnmp-dev to fix:
dpkg: warning: downgrading libsnmp-dev from 5.9.3+dfsg-2+deb12u1 to 5.9.3+dfsg-2
(Reading database ... 226713 files and directories currently installed.)
Preparing to unpack .../libsnmp-dev_5.9.3+dfsg-2_amd64.deb ...
Unpacking libsnmp-dev (5.9.3+dfsg-2) over (5.9.3+dfsg-2+deb12u1) ...
dpkg: dependency problems prevent configuration of libsnmp-dev:
 libsnmp-dev depends on libnetsnmptrapd40 (= 5.9.3+dfsg-2); however:
  Version of libnetsnmptrapd40:amd64 on system is 5.9.3+dfsg-2+deb12u1.
  • Add dependencies for snmp-dbgsym and snmpd-dbgsym to fix:
dpkg: dependency problems prevent configuration of snmp-dbgsym:
  snmp-dbgsym depends on snmp (= 5.9.3+dfsg-2); however:
   Version of snmp on system is 5.9.3+dfsg-2+deb12u1.

dpkg: error processing package snmp-dbgsym ( -- install):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of snmpd-dbgsym:
 snmpd-dbgsym depends on snmpd (= 5.9.3+dfsg-2); however:
  Version of snmpd on system is 5.9.3+dfsg-2+deb12u1.

dpkg: error processing package snmpd-dbgsym ( -- install):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.36-9+deb12u13)
Errors were encountered while processing:
 snmp-dbgsym
 snmpd-dbgsym

Signed-off-by: yijingyan2 <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: yijingyan2 <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: yijingyan2 <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: yijingyan2 <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: yijingyan2 <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: yijingyan2 <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: yijingyan2 <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Yijing Yan <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Yijing Yan <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Yijing Yan <yijingyan@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…the local build libsnmp-dev

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Copilot AI review requested due to automatic review settings February 27, 2026 03:24
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes SNMP package dependency issues during installation by adding libnetsnmptrapd40 as a dependency for libsnmp-dev and adding runtime dependencies for debug symbol packages. The PR also removes libsnmp-dev from the sonic-slave-bookworm Dockerfile since it's now built from source, and standardizes apt-get usage in build scripts.

Changes:

  • Added libnetsnmptrapd40 dependency to libsnmp-dev to resolve dpkg version mismatch errors
  • Added RDEPENDS for snmp-dbgsym and snmpd-dbgsym packages to fix dependency conflicts
  • Removed libsnmp-dev from sonic-slave-bookworm Dockerfile to avoid conflicts with source-built version

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/snmpd/Makefile Added libnetsnmptrapd40 to DERIVED_TARGETS list for package build
sonic-slave-bookworm/Dockerfile.j2 Removed libsnmp-dev from apt-get install lists (2 locations) to avoid conflicts with source build
rules/snmpd.mk Added RDEPENDS for debug packages, defined LIBNETSNMPTRAPD40 with trixie/bookworm variants, updated LIBSNMP_DEV dependencies
build_debug_docker_j2.sh Changed "apt update" to "apt-get update" and "apt" to "apt-get" for consistency
Comments suppressed due to low confidence (1)

src/snmpd/Makefile:19

  • The DERIVED_TARGETS list needs to handle the trixie build environment where packages have t64 suffixes. When building for trixie, dpkg-buildpackage will produce libsnmp40t64 and libnetsnmptrapd40t64 instead of libsnmp40 and libnetsnmptrapd40. Since line 60 moves packages listed in DERIVED_TARGETS, the build will fail for trixie if these names don't match the actual built packages.

Add conditional handling similar to the approach in rules/snmpd.mk, checking the SNMPD_VERSION to determine if t64 variants should be listed. For example, check if SNMPD_VERSION contains "5.9.4" (trixie version) and list libsnmp40t64 and libnetsnmptrapd40t64 accordingly.

DERIVED_TARGETS = snmptrapd_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  snmptrapd-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  snmp_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  snmpd_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  snmp-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  snmpd-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  libsnmp40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  libsnmp40-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  libnetsnmptrapd40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  libsnmp-dev_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  libsnmp-perl_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  libsnmp-perl-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \
		  tkmib_$(SNMPD_VERSION_FULL)_all.deb

Copy link
Contributor

@liushilongbuaa liushilongbuaa left a comment

Choose a reason for hiding this comment

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

LGTM

@liushilongbuaa liushilongbuaa merged commit 4c84167 into sonic-net:master Mar 5, 2026
29 of 30 checks passed
FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Mar 6, 2026
…et#25370)

Use local built libsnmp-dev related packages instead of debian in sonic-slave-bookworm.
It will avoid snmp related packages breaking reproducible build.

---------

Signed-off-by: Yijing Yan <yijingyan@microsoft.com>
Signed-off-by: Feng Pan <fenpan@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants