3

How to disable ZFS kernel-module before boot in grub?

It is mentioned that some modules can be disabled through grub command line in similar question. Unfortunately this method is not working with zfs:

module_to_blacklist.blacklist=yes

With next message: unknown parameter 'blacklist' ignored

BBK
  • 2,119

2 Answers2

1

I'm running into this issue because I want to boot a recent Ubuntu Live CD such that the kernel is not tainted. However the ZFS modules taint the kernel.

TLDR; Booting with the kernel parameter systemd.mask=zfs.target allowed booting without loading the zfs modules automatically.

In investigating this I found 3 places where the zfs module could get loaded.

  1. Initrd
    • The file /scripts/zfs tries to load the module in load_module_initrd, but this only gets called if there is a kernel parameter boot=zfs
  2. init.d
    • The script /etc/init.d/zfs-import will load the module when started, but this init script is by default only started at run levels S (single user mode), so not normally.
  3. systemd
    • The target zfs.target, which is started by the multi-user.target, will load the modules via the zfs-load-module.service. This can be disabled with the kernel boot parameter systemd.mask=zfs.target
crass
  • 495
1

If I'm correct that you installed ZFS via dkms then it looks like you need to remove it via the same tool.

dkms remove [module/module-version] [-k kernel/arch] [--all]

       Removes a module/version or module/version/kernel/arch  combination
       from  the  tree.   If  the  module is currently installed, it first
       uninstalls  it  and  if  applicable,  will  replace  it  with   its
       original_module.   Use  the  --all  option  in  order to remove all
       instances for every kernel at once.

Source: http://manpages.ubuntu.com/manpages/trusty/man8/dkms.8.html

Note: You might wish to avoid using the --all option until you are certain that you have obtained the desired results.

Elder Geek
  • 36,752