Debian:ZFS 安装错误:在目录 /lib/modules/4.19.0-14-amd64 中找不到模块 zfs

Debian:ZFS 安装错误:在目录 /lib/modules/4.19.0-14-amd64 中找不到模块 zfs

我在 Debian 上安装了 ZFS,但无法让它工作。


我尝试这样安装 zfs:

  1. 我将此添加到/etc/apt/sources.list
deb http://deb.debian.org/debian/ buster main contrib non-free
deb http://deb.debian.org/debian buster-backports main contrib
  1. apt updateapt upgrade
  2. 我安装了这些软件包:buster-backports、zfsutils-linux、zfs-dkms、dpkg-dev、linux-headers-$(uname -r)、linux-image-amd64
  3. 此时问题就出现了。

我在调用时收到这些错误modprobe

root@server /dev# modprobe zfs
modprobe: FATAL: **Module zfs not found in directory /lib/modules/4.19.0-14-amd64**

这是我的 Journalctl 中:

Feb 19 13:33:46 bytserver systemd[1]: Starting Install ZFS kernel module...
Feb 19 13:33:46 bytserver modprobe[490]: modprobe: FATAL: Module zfs not found in directory /lib/modules/4.19.0-14-amd64
Feb 19 13:33:46 bytserver systemd[1]: zfs-load-module.service: Main process exited, code=exited, status=1/FAILURE
Feb 19 13:33:46 bytserver systemd[1]: zfs-load-module.service: Failed with result 'exit-code'.
Feb 19 13:33:46 bytserver systemd[1]: Failed to start Install ZFS kernel module.
Feb 19 13:33:46 bytserver systemd[1]: Dependency failed for Import ZFS pools by cache file.
Feb 19 13:33:46 bytserver systemd[1]: zfs-import-cache.service: Job zfs-import-cache.service/start failed with result 'dependency'.
Feb 19 13:33:46 bytserver systemd[1]: Reached target ZFS pool import target.
Feb 19 13:33:46 bytserver systemd[1]: Condition check resulted in Mount ZFS filesystems being skipped.
Feb 19 13:33:46 bytserver systemd[1]: Starting Wait for ZFS Volume (zvol) links in /dev...
Feb 19 13:33:46 bytserver zvol_wait[496]: The ZFS modules are not loaded.
Feb 19 13:33:46 bytserver zvol_wait[496]: Try running '/sbin/modprobe zfs' as root to load them.
Feb 19 13:33:46 bytserver systemd[1]: Started Wait for ZFS Volume (zvol) links in /dev.
Feb 19 13:33:46 bytserver systemd[1]: Reached target ZFS volumes are ready.
Feb 19 13:33:46 bytserver systemd[1]: Starting ZFS file system shares...
Feb 19 13:33:46 bytserver zfs[567]: The ZFS modules are not loaded.
Feb 19 13:33:46 bytserver zfs[567]: Try running '/sbin/modprobe zfs' as root to load them.
Feb 19 13:33:46 bytserver systemd[1]: zfs-share.service: Main process exited, code=exited, status=1/FAILURE
Feb 19 13:33:46 bytserver systemd[1]: zfs-share.service: Failed with result 'exit-code'.
Feb 19 13:33:46 bytserver systemd[1]: Failed to start ZFS file system shares.
Feb 19 13:33:46 bytserver systemd[1]: Reached target ZFS startup target.
Feb 19 13:33:47 bytserver containerd[596]: time="2021-02-19T13:33:47.608958319+01:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.zfs\"..." type=io.containerd.snapshotter.v1
Feb 19 13:33:47 bytserver containerd[596]: time="2021-02-19T13:33:47.609214490+01:00" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.zfs\"..." error="path /var/lib/containerd/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1
Feb 19 14:27:39 bytserver sudo[1725]:     john : TTY=pts/1 ; PWD=/dev/disk/by-label ; USER=root ; COMMAND=/usr/bin/apt install zfs
Feb 19 14:27:53 bytserver sudo[2199]:     john : TTY=pts/1 ; PWD=/dev/disk/by-label ; USER=root ; COMMAND=/usr/bin/apt install zfs
Feb 19 14:30:58 bytserver sudo[2721]:     john : TTY=pts/1 ; PWD=/dev/disk/by-label ; USER=root ; COMMAND=/usr/bin/apt-get install zfs-dkms
Feb 19 14:31:21 bytserver sudo[2730]:     john : TTY=pts/1 ; PWD=/dev/disk/by-label ; USER=root ; COMMAND=/usr/sbin/modprobe zfs
Feb 19 14:31:29 bytserver sudo[2757]:     john : TTY=pts/1 ; PWD=/dev/disk/by-label ; USER=root ; COMMAND=/usr/bin/apt install zfs
Feb 19 14:34:21 bytserver sudo[2844]:     john : TTY=pts/1 ; PWD=/dev/disk/by-label ; USER=root ; COMMAND=/usr/bin/add-apt-repository ppa:zfs-native/stable
Feb 19 14:52:35 bytserver sudo[4094]:     john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/vi /etc/apt/sources.list
Feb 19 14:53:47 bytserver sudo[4117]:     john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/apt update
Feb 19 14:53:59 bytserver sudo[4562]:     john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/vi /etc/apt/sources.list
Feb 19 14:54:08 bytserver sudo[4569]:     john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/apt update
Feb 19 14:54:54 bytserver sudo[5016]:     john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/su
Feb 19 14:56:22 bytserver sudo[6783]:     root : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/apt upgrade
Feb 19 14:56:59 bytserver sudo[6821]:    john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/apt install --yes -t buster-backports --no-install-recommends zfs-dkms
Feb 19 14:57:20 bytserver sudo[6902]:     john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/apt install --yes -t buster-backports zfsutils-linux
Feb 19 14:57:39 bytserver sudo[6925]:     john : TTY=pts/1 ; PWD=/home/john/openzfs-docs ; USER=root ; COMMAND=/usr/bin/apt install --yes mdadm
Feb 19 15:03:10 bytserver sudo[7047]:     john : TTY=pts/1 ; PWD=/home/john ; USER=root ; COMMAND=/usr/bin/apt install -t buster-backports zfsutils-linux
Feb 19 15:03:23 bytserver sudo[7051]:     john : TTY=pts/1 ; PWD=/home/john ; USER=root ; COMMAND=/usr/bin/apt install -t buster-backports zfsutils-linu
Feb 19 15:03:33 bytserver sudo[7055]:     john : TTY=pts/1 ; PWD=/home/john ; USER=root ; COMMAND=/usr/bin/apt install zfs-dkms
Feb 19 15:05:36 bytserver systemd-udevd[7143]: Process '/sbin/modprobe zfs' failed with exit code 1.
Feb 19 15:07:20 bytserver systemd-udevd[7149]: Process '/sbin/modprobe zfs' failed with exit code 1.
Feb 19 15:10:51 bytserver sudo[7299]:     john : TTY=pts/1 ; PWD=/home/john ; USER=root ; COMMAND=/usr/bin/apt-get -y install zfs-dkms
Feb 19 15:11:58 bytserver sudo[7322]:     john : TTY=pts/1 ; PWD=/home/john ; USER=root ; COMMAND=/usr/bin/systemctl restart zfs-import-cache
Feb 19 15:11:58 bytserver systemd[1]: Starting Install ZFS kernel module...
Feb 19 15:11:58 bytserver modprobe[7325]: modprobe: FATAL: Module zfs not found in directory /lib/modules/4.19.0-14-amd64
Feb 19 15:11:58 bytserver systemd[1]: zfs-load-module.service: Main process exited, code=exited, status=1/FAILURE
Feb 19 15:11:58 bytserver systemd[1]: zfs-load-module.service: Failed with result 'exit-code'.
Feb 19 15:11:58 bytserver systemd[1]: Failed to start Install ZFS kernel module.
Feb 19 15:11:58 bytserver systemd[1]: Dependency failed for Import ZFS pools by cache file.
Feb 19 15:11:58 bytserver systemd[1]: zfs-import-cache.service: Job zfs-import-cache.service/start failed with result 'dependency'.
Feb 19 15:15:56 bytserver sudo[7387]:     john : TTY=pts/1 ; PWD=/home/john ; USER=root ; COMMAND=/usr/bin/apt-get install zfsutils-linux

我可以做什么来诊断和修复它?
谢谢你的帮助

答案1

您的 Debian 系统无法构建 zfs 内核模块,因为您的 Linux 内核与软件包源中附带的 zfs 版本不兼容。

你可以去https://zfsonlinux.org/,获取与您的 Linux 内核版本兼容的版本,并构建zfs内核以满足您的需求。

例如,目前 zfs 版本 2.0.7 确实支持具有 3.10 - 5.15 内核的 Linux。

zfs内核模块安装

获取 zfs 版本

wget https://github.com/openzfs/zfs/releases/download/zfs-2.0.7/zfs-2.0.7.tar.gz

构建和安装

tar -xvzf zfs-2.0.7.tar.gz
cd zfs-2.0.7
./configure
make
sudo make install

从内核添加模块

sudo modprobe -v zfs

答案2

升级内核后,我在 Ubuntu 22.04 中遇到了类似的问题。以下内容对我有用

sudo apt purge --auto-remove zfsutils-linux 
sudo apt install zfs-dkms
sudo apt install zfsutils-linux

相关内容