使用archzfs软件仓库在arch linux上部署ZFS¶
由于ZFS代码的CDDL license和Linux内核GPL不兼容,所以ZFS开发不能被Linux内核支持。
这导致以下情况:
ZFSonLinux项目必须紧跟Linux内核版本,当ZFSonLinux发布稳定版本,Arch ZFS维护者就发布
这种情况有时会通过不满足的依赖关系锁定正常的滚动更新过程,因为更新提出的新内核版本不受 ZFSonLinux 的支持。
安装¶
在Arch Linux上安装有两种方式:
使用 archzfs repo
下载源代码编译安装
通过软件仓库二进制安装包¶
采用比较简单的方式,即直接使用 archzfs repo 安装
导入 archzfs 仓库key:
curl -L https://archzfs.com/archzfs.gpg | pacman-key -a -
pacman-key --lsign-key $(curl -L https://git.io/JsfVS)
curl -L https://git.io/Jsfw2 > /etc/pacman.d/mirrorlist-archzfs
添加 archzfs 软件仓库,并更新 Pacman 仓库:
tee -a /etc/pacman.conf <<- 'EOF'
#[archzfs-testing]
#Include = /etc/pacman.d/mirrorlist-archzfs
[archzfs]
Include = /etc/pacman.d/mirrorlist-archzfs
EOF
# 更新pacman仓库
pacman -Sy
archzfs 软件仓库提供了多种安装包组合,执行安装:
# pacman -S zfs
:: There are 16 providers available for zfs:
:: Repository archzfs
1) zfs-archiso-linux 2) zfs-dkms 3) zfs-dkms-git 4) zfs-dkms-rc 5) zfs-linux 6) zfs-linux-git 7) zfs-linux-hardened 8) zfs-linux-hardened-git
9) zfs-linux-lts 10) zfs-linux-lts-git 11) zfs-linux-lts-rc 12) zfs-linux-rc 13) zfs-linux-vfio 14) zfs-linux-vfio-git 15) zfs-linux-zen
16) zfs-linux-zen-git
Enter a number (default=1): 5
resolving dependencies...
looking for conflicting packages...
Packages (2) zfs-utils-2.1.7-1 zfs-linux-2.1.7_6.1.6.arch1.1-1
Total Download Size: 30.47 MiB
Total Installed Size: 41.92 MiB
:: Proceed with installation? [Y/n]
我选择 5 ( zfs-linux
)安装
archzfs的限制¶
archzfs 安装的zfs和内核严密绑定,所以如果 archzfs 提供对应内核版本之前, Arch Linux 无法升级内核,会提示类似如下错误:
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
archzfs is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing linux (6.1.8.arch1-1) breaks dependency 'linux=6.1.6.arch1-3' required by zfs-linux
如果要紧跟内核升级,那么需要采用 使用zfs-dkms在arch linux编译安装ZFS ;但是如果已经采用了 archzfs
,这样的阻塞导致整个系统无法更新升级也不是办法,所以可以在 Pacman 的配置文件 /etc/pacman.conf
中配置:
IgnorePkg = linux linux-headers
这样升级会保持当前内核版本不升级,而如果 archzfs
有版本升级,则会提示依赖内核版本冲突,到时候再去除这个配置进行 archzfs
和内核同步升级即可。
ARM架构下无法使用archzfs¶
我在 Asahi Linux 平台(ARM架构的 Apple ARM架构芯片M1 Pro MacBook Pro 16”)更新pacman仓库遇到以下报错:
pacman -Sy
这里我遇到报错:
archzfs.db failed to download
error: failed retrieving file 'archzfs.db' from archzfs.com : The requested URL returned error: 404
error: failed retrieving file 'archzfs.db' from mirror.sum7.eu : The requested URL returned error: 404
error: failed retrieving file 'archzfs.db' from mirror.biocrafting.net : The requested URL returned error: 404
error: failed retrieving file 'archzfs.db' from mirror.in.themindsmaze.com : The requested URL returned error: 404
error: failed retrieving file 'archzfs.db' from zxcvfdsa.com : The requested URL returned error: 404
error: failed to synchronize all databases (failed to retrieve some files)
难道是不能提供aarch64架构?
果然,我检查了 https://mirror.sum7.eu/archlinux/archzfs/archzfs/ 果然在目录下只有 x86_64
,放弃…
通过 Arch Linux AUR 编译安装¶
通过 Arch Linux AUR 有多个软件发行包: arch linux: zfs General 提供不同版本信息,以下几个版本可能值得关注尝试:
zfs-linux 稳定版本
zfs-linux-lts 针对LTS内核的稳定版本
zfs-dkms 用于支持动态内核模块的版本
安装(在 Asahi Linux 上不满足条件,但可以在x86的 Arch Linux 上实践):
yay -S zfs-linux
这里安装会检测内核版本,分别对应不同的 zfs-linux
软件包,例如:
zfs-linux
要求 linux=6.0.2
zfs-linux-lts
要求 linux-lts=5.15.74-1
比较尴尬,由于是Apple Silicon M1系列处理器,使用的是 Asahi Linux 发行版,当前采用的内核是 5.19.0-asahi-5-1-ARCH