Linux kernel module management utilities
Go to file
Jan Stancek 4b96165814 modprobe: don't attempt to remove an already removed module
commit 327c587a0bfe0c62aed05efe834de7422e480d02
Author: Jan Stancek <jstancek@redhat.com>
Date:   Tue Sep 30 10:37:21 2025 +0200

    modprobe: don't attempt to remove an already removed module

    In a scenario like following:
        # lsmod | grep -e bnx2i -e cnic
        bnx2i                  94208  0
        libiscsi               94208  1 bnx2i
        cnic                   90112  1 bnx2i
        uio                    32768  1 cnic
        scsi_transport_iscsi   196608  2 bnx2i,libiscsi

        # modprobe -v --remove --remove-holders cnic
        rmmod bnx2i
        rmmod cnic
        rmmod libiscsi
        rmmod cnic
        modprobe: ERROR: libkmod/libkmod-module.c:856 kmod_module_remove_module()
        could not remove 'cnic': No such file or directory

    modprobe attempts to remove cnic module twice and propagates that error
    to the user with a message as well as an exit code.

    Add a check to avoid attempts to remove modules that are already gone.

    Signed-off-by: Jan Stancek <jstancek@redhat.com>
    Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
    Link: https://github.com/kmod-project/kmod/pull/pull/393
    Signed-off-by: Lucas De Marchi <demarchi@kernel.org>

Resolves: RHEL-113203
Signed-off-by: Jan Stancek <jstancek@redhat.com>
2026-02-03 11:21:00 +01:00
.fmf Convert gating to restraint and tmt 2025-03-25 17:27:14 +08:00
tests Convert gating to restraint and tmt 2025-03-25 17:27:14 +08:00
.gitignore Add upstream patches to enable SHA3 support 2023-11-09 11:39:43 -05:00
0001-libkmod-avoid-undefined-behaviour-in-libkmod-builtin.patch Fix issues discovered by static analysis 2024-08-16 15:30:21 +02:00
0001-modprobe-don-t-attempt-to-remove-an-already-removed-.patch modprobe: don't attempt to remove an already removed module 2026-02-03 11:21:00 +01:00
depmod.conf.dist depmod.dist.conf: commit to git 2021-08-11 10:25:12 +03:00
gating.yaml Add RHEL gating configuration 2024-08-12 16:26:15 +02:00
kmod-tip.patch Add upstream patches to enable SHA3 support 2023-11-09 11:39:43 -05:00
kmod.spec modprobe: don't attempt to remove an already removed module 2026-02-03 11:21:00 +01:00
sources Add upstream patches to enable SHA3 support 2023-11-09 11:39:43 -05:00
weak-modules check weak-updates directory exists before using it 2025-08-19 08:42:46 +02:00