2

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

7
  • Hello BBK, would be nice to know why you are trying to do this. There might be alternatives to what you are trying to do. Feb 6, 2015 at 11:01
  • Unfortunately zfs some times need to be restored. When Ubuntu booted with zfs module it trying to load damaged zpool so in the end it hangs. I need to load the system without zfs, only then I'm able to restore zfs. This method for recovery is working well.
    – BBK
    Feb 7, 2015 at 14:45
  • possible duplicate of Troubleshoot broken ZFS
    – Elder Geek
    Mar 2, 2015 at 23:00
  • 1
    @ElderGeek this is not a dupe. The OP wants to blacklist a specific module, not troubleshoot one.
    – terdon
    Mar 3, 2015 at 0:40
  • @terdon Vote retracted
    – Elder Geek
    Mar 3, 2015 at 16:10

2 Answers 2

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.

2
  • Is there a way to disable it from grub loader before OS boot?
    – BBK
    Mar 4, 2015 at 9:16
  • It looks like you can disable zfs from grub by removing "boot=zfs" or "boot=zfs rpool=rpool bootfs=rpool/ROOT/ubuntu" from your grub config whichever line is next to GRUB_CMDLINE_LINUX and updating grub. Source:github.com/zfsonlinux/pkg-zfs/wiki/….
    – Elder Geek
    Mar 4, 2015 at 16:42
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .