From 4f716cf2bf8454607ab177c5458abc322f59aaac Mon Sep 17 00:00:00 2001 From: Andreas Beckmann Date: Tue, 1 Apr 2025 08:35:38 -0400 Subject: [PATCH] MT#55283 dkms.prerm: do not act on daemon or module in a container in a container - the daemon is not started by rtpengine-kernel-dkms.postinst - do not attempt to unload a module from the host kernel Ref: https://bugs.debian.org/1101804 Change-Id: Id9b9184c52e1be82d47a6b89780bf594d4d5a5a9 --- debian/ngcp-rtpengine-kernel-dkms.prerm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/debian/ngcp-rtpengine-kernel-dkms.prerm b/debian/ngcp-rtpengine-kernel-dkms.prerm index 84b2a49d3..0326afe76 100644 --- a/debian/ngcp-rtpengine-kernel-dkms.prerm +++ b/debian/ngcp-rtpengine-kernel-dkms.prerm @@ -2,10 +2,20 @@ set -e -# make sure it's not running -if [ -x /etc/init.d/ngcp-rtpengine-daemon ] ; then - invoke-rc.d ngcp-rtpengine-daemon stop || true - rmmod "xt_RTPENGINE" 2>/dev/null || true +if [ -x "$(command -v ngcp-virt-identify)" ]; then + if ngcp-virt-identify --type container; then + VIRT="yes" + fi +fi + +if [ "$VIRT" = "yes" ]; then + echo "Container environment detected. Skip daemon" +else + # make sure it's not running + if [ -x /etc/init.d/ngcp-rtpengine-daemon ] ; then + invoke-rc.d ngcp-rtpengine-daemon stop || true + rmmod "xt_RTPENGINE" 2>/dev/null || true + fi fi #DEBHELPER#