Как принудительно удалить загружаемый модуль из ядра

Вы можете запустить disown -a && exit, который освободит все процессы оболочки, запущенные вами из текущей оболочки, и завершит текущую оболочку. Процессы будут продолжать работать.

0
31.01.2020, 15:21
1 ответ

man rmmod:

NAME
       rmmod - Simple program to remove a module from the
       Linux Kernel

SYNOPSIS
       rmmod [-f] [-s] [-v] [modulename]

DESCRIPTION
       rmmod is a trivial program to remove a module (when
       module unloading support is provided) from the kernel.
       Most users will want to use modprobe(8) with the -r
       option instead.

OPTIONS
       -v, --verbose
           Print messages about what the program is doing.
           Usually rmmod prints messages only if something
           goes wrong.

       -f, --force
           This option can be extremely dangerous: it has no
           effect unless CONFIG_MODULE_FORCE_UNLOAD was set
           when the kernel was compiled. With this option,
           you can remove modules which are being used, or
           which are not designed to be removed, or have been
           marked as unsafe (see lsmod(8)).

Чтобы иметь возможность использовать -f, обратите внимание, что в вашем ядре должен быть установлен параметр CONFIG_MODULE_FORCE_UNLOAD. Чтобы убедиться, что он установлен, вы можете использовать:

/boot$ grep CONFIG_MODULE_FORCE_UNLOAD config-`uname -r`
CONFIG_MODULE_FORCE_UNLOAD=y

(Если ваш дистрибутив установил конфигурацию в /boot...)

Что касается подсчета использования в -1, см. ответ

1
28.04.2021, 23:24

Теги

Похожие вопросы