From 5bb0cb59998f5a5b3cd6bfd1dd48b0e7d90d8b40 Mon Sep 17 00:00:00 2001 From: Maurice Zhou Date: Fri, 29 Jan 2021 19:04:57 +0800 Subject: [PATCH] Solutions for rolling kernel releases --- .../Arch Linux/Arch Linux Root on ZFS.rst | 210 ++++++++------ .../Arch Linux/Artix Linux Root on ZFS.rst | 186 ++++++++++--- docs/Getting Started/Arch Linux/index.rst | 259 ++++++++++++++++-- 3 files changed, 504 insertions(+), 151 deletions(-) diff --git a/docs/Getting Started/Arch Linux/Arch Linux Root on ZFS.rst b/docs/Getting Started/Arch Linux/Arch Linux Root on ZFS.rst index 0370947..3040d7f 100644 --- a/docs/Getting Started/Arch Linux/Arch Linux Root on ZFS.rst +++ b/docs/Getting Started/Arch Linux/Arch Linux Root on ZFS.rst @@ -22,16 +22,6 @@ Caution will not work on 4Kn with legacy (BIOS) booting. `__ -.. note:: - - Due to the release cycle of OpenZFS and the rapid adoption of new kernels - it may happen that you won’t be able to - build DKMS packages for the most recent kernel update. - If the `latest OpenZFS release `__ - does not yet support the installed kernel, - `use an older live image `__ - before installation. - Support ~~~~~~~ @@ -86,16 +76,26 @@ or raidz topologies) are used, the data only has to be encrypted once. Preinstallation ---------------- +Download Arch Linux live image +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#. Choose a mirror + + https://archlinux.org/mirrorlist/all/ + +#. Download January 2021 build. `File a new issue and mention @ne9z + `__ if it's + no longer available. + + https://mirrors.dotsrc.org/archlinux/iso/2021.01.01/archlinux-2021.01.01-x86_64.iso + +#. Write the image to a USB drive or an optical disc. + +#. Boot the target computer from the prepared live medium. Prepare the Live Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#. Download the latest Arch Linux Live Image - `from official website `__ - and write it to a USB drive or an optical disc. - -#. Boot the target computer from the prepared live medium. - #. Connect to the internet. If the target computer aquires IP address with DHCP, no further steps need to be taken. @@ -141,6 +141,19 @@ Prepare the Live Environment Server = https://mirror.in.themindsmaze.com/archzfs/$repo/$arch EOF +#. Select mirror: + + - Kill ``reflector``:: + + killall -9 reflector + + - Edit the following files:: + + /etc/pacman.d/mirrorlist + + Uncomment and move mirrors to + the beginning of the file. + #. Install ZFS in the live environment:: pacman -Sy --noconfirm archzfs-linux --ignore=linux @@ -150,27 +163,25 @@ Prepare the Live Environment If this fails with ``unable to satisfy dependency``, install archzfs-dkms instead: - #. Check the current kernel version with:: + - Check kernel variant:: - live_kernel=$(uname -r) + LIVE_LINVAR=$(sed 's|.*linux|linux|' /proc/cmdline | awk '{ print $1 }') - #. Search and install kernel headers:: + - Check kernel version:: - curl https://america.archive.pkgbuild.com/packages/l/linux-headers/ \ - | grep ${live_kernel%%-*} \ - | grep -v sig - # + LIVE_LINVER=$(pacman -Qi ${LIVE_LINVAR} | grep Version | awk '{ print $3 }') - pacman -U \ - https://america.archive.pkgbuild.com/packages/l/linux-headers/linux-headers-5.10.3-1-x86_64.pkg.tar.zst + - Install kernel headers:: - #. Expand root filesystem:: + pacman -U https://archive.archlinux.org/packages/l/${LIVE_LINVAR}-headers/${LIVE_LINVAR}-headers-${LIVE_LINVER}-x86_64.pkg.tar.zst - mount -o remount,size=1G /run/archiso/cowspace + - Expand root filesystem:: - #. Install archzfs-dkms:: + mount -o remount,size=1G /run/archiso/cowspace - pacman -S archzfs-dkms + - Install archzfs-dkms:: + + pacman -S archzfs-dkms #. Load kernel module:: @@ -553,14 +564,24 @@ Package Installation #. Install base packages:: - pacstrap $INST_MNT base vi grub + pacstrap $INST_MNT base vi mandoc grub + +#. Check compatible kernel version:: + + INST_LINVER=$(pacman -Si zfs-${INST_LINVAR} \ + | grep 'Depends On' \ + | sed "s|.*${INST_LINVAR}=||" \ + | awk '{ print $1 }') + +#. Install kernel:: + + pacstrap -U $INST_MNT \ + https://archive.archlinux.org/packages/l/${INST_LINVAR}/${INST_LINVAR}-${INST_LINVER}-x86_64.pkg.tar.zst + +#. Install archzfs package:: + pacstrap $INST_MNT archzfs-$INST_LINVAR -#. If archzfs package failed to install with mismatched kernel version:: - - pacstrap $INST_MNT $INST_LINVAR ${INST_LINVAR}-headers - pacstrap $INST_MNT archzfs-dkms - #. If your computer has hardware that requires firmware to run:: pacstrap $INST_MNT linux-firmware @@ -569,18 +590,28 @@ Package Installation pacstrap $INST_MNT dosfstools efibootmgr +#. Microcode: + + - ``pacstrap $INST_MNT amd-ucode`` + - ``pacstrap $INST_MNT intel-ucode`` + +#. For other optional packages, + see `ArchWiki `__. + System Configuration -------------------- #. Generate list of datasets for ``zfs-mount-generator`` to mount them at boot:: - propfile=`mktemp` - - cat /etc/zfs/zed.d/history_event-zfs-list-cacher.sh \ - | sed ':a;N;$!ba;s|\\\n||g' \ - | grep PROPS | grep name > $propfile - - source $propfile + # tab-separated zfs properties + # see /etc/zfs/zed.d/history_event-zfs-list-cacher.sh + export \ + PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\ + ,readonly,setuid,nbmand,encroot,keylocation\ + ,org.openzfs.systemd:requires,org.openzfs.systemd:requires-mounts-for\ + ,org.openzfs.systemd:before,org.openzfs.systemd:after\ + ,org.openzfs.systemd:wanted-by,org.openzfs.systemd:required-by\ + ,org.openzfs.systemd:nofail,org.openzfs.systemd:ignore" mkdir -p $INST_MNT/etc/zfs/zfs-list.cache @@ -589,7 +620,6 @@ System Configuration sed -Ei "s|$INST_MNT/?|/|" $INST_MNT/etc/zfs/zfs-list.cache/* - #. Generate fstab:: echo bpool_$INST_UUID/BOOT/default /boot zfs rw,xattr,posixacl 0 0 >> $INST_MNT/etc/fstab @@ -634,11 +664,12 @@ System Configuration EOF Customize this file if the system is not a DHCP client. - + See `Network Configuration `__. #. Timezone:: ln -sf $INST_TZ $INST_MNT/etc/localtime + hwclock --systohc #. archzfs repository:: @@ -655,7 +686,7 @@ System Configuration echo "en_US.UTF-8 UTF-8" >> $INST_MNT/etc/locale.gen echo "LANG=en_US.UTF-8" >> $INST_MNT/etc/locale.conf - Other locales should be added after reboot, not here. + Other locales should be added after reboot. #. Chroot:: @@ -817,67 +848,76 @@ Finish Installation After Reboot ------------ -#. Mirror EFI system partition +Mirror EFI System Partition +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#. Format redundant EFI partitions:: - #. Format redundant EFI partitions:: + mkfs.vfat -n EFI2 /dev/disk/by-id/target_disk2-part1 + mkfs.vfat -n EFI3 /dev/disk/by-id/target_disk3-part1 - mkfs.vfat -n EFI2 /dev/disk/by-id/target_disk2-part1 - mkfs.vfat -n EFI3 /dev/disk/by-id/target_disk3-part1 +#. Create mountpoints:: - #. Create mountpoints:: + mkdir -p /boot/efis/{2,3} - mkdir -p /boot/efis/{2,3} +#. Mount redundant EFI partitions:: - #. Mount redundant EFI partitions:: + mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk2-part1 /boot/efis/2 + mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk3-part1 /boot/efis/3 - mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk2-part1 /boot/efis/2 - mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk3-part1 /boot/efis/3 +#. Add fstab entries:: - #. Add fstab entries:: + pacman -S --needed arch-install-scripts rsync - pacman -S --needed arch-install-scripts rsync + genfstab / | grep efis >> /etc/fstab - genfstab / | grep efis >> /etc/fstab +#. Sync EFI system partition contents:: - #. Sync EFI system partition contents:: + for i in /boot/efis/*; do + /usr/bin/rsync -a /boot/efi/ $i/ + done - for i in /boot/efis/*; do - /usr/bin/rsync -a /boot/efi/ $i/ - done +#. Add EFI boot entries:: - #. Add EFI boot entries:: + efibootmgr -cgd /dev/disk/by-id/target_disk2-part1 \ + -p 1 -L "arch-2" -l "\EFI\arch\grubx64.efi" + efibootmgr -cgd /dev/disk/by-id/target_disk3-part1 \ + -p 1 -L "arch-3" -l "\EFI\arch\grubx64.efi" - efibootmgr -cgd /dev/disk/by-id/target_disk2-part1 \ - -p 1 -L "arch-2" -l "\EFI\arch\grubx64.efi" - efibootmgr -cgd /dev/disk/by-id/target_disk3-part1 \ - -p 1 -L "arch-3" -l "\EFI\arch\grubx64.efi" +#. Create a service to monitor and sync EFI partitions:: - #. Create a service to monitor and sync EFI partitions:: + tee /usr/lib/systemd/system/boot/efis-sync.path << EOF + [Unit] + Description=Monitor changes in EFI system partition - tee /usr/lib/systemd/system/boot/efis-sync.path << EOF - [Unit] - Description=Monitor changes in EFI system partition + [Path] + PathModified=/boot/efi/EFI/arch/ - [Path] - PathModified=/boot/efi/EFI/arch/ + [Install] + WantedBy=multi-user.target + EOF - [Install] - WantedBy=multi-user.target - EOF + tee /usr/lib/systemd/system/boot/efis-sync.service << EOF + [Unit] + Description=Sync EFI system partition contents to backups - tee /usr/lib/systemd/system/boot/efis-sync.service << EOF - [Unit] - Description=Sync EFI system partition contents to backups + [Service] + Type=oneshot + ExecStart=/usr/bin/bash -c 'for i in /boot/efis/*; do /usr/bin/rsync -a /boot/efi/ $i/; done' + EOF - [Service] - Type=oneshot - ExecStart=/usr/bin/bash -c 'for i in /boot/efis/*; do /usr/bin/rsync -a /boot/efi/ $i/; done' - EOF + systemctl enable --now efis-sync.path - systemctl enable --now efis-sync.path +Boot Environment Manager +~~~~~~~~~~~~~~~~~~~~~~~~ +Optional: install ``rozb3-pac`` pacman hook and ``bieaz`` from AUR to +create boot environments. -#. Optional: install ``rozb3-pac`` pacman hook and ``bieaz`` from AUR to - create boot environments. +Post installation +~~~~~~~~~~~~~~~~~ +For post installation recommendations, +see `ArchWiki `__. + +Remember to create separate datasets for individual users. Recovery -------- diff --git a/docs/Getting Started/Arch Linux/Artix Linux Root on ZFS.rst b/docs/Getting Started/Arch Linux/Artix Linux Root on ZFS.rst index 8106c73..d8bb3d0 100644 --- a/docs/Getting Started/Arch Linux/Artix Linux Root on ZFS.rst +++ b/docs/Getting Started/Arch Linux/Artix Linux Root on ZFS.rst @@ -79,21 +79,32 @@ or raidz topologies) are used, the data only has to be encrypted once. Preinstallation ---------------- +Download Artix Linux live image +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +OpenRC is used throughout this guide. + +Other init systems, runit and s6, are also supported. +Change the service commands to the equivalent commands. + +#. Choose a mirror: + + https://artixlinux.org/download.php + +#. Download January 2021 build. `File a new issue and mention @ne9z + `__ if it's + no longer available. + + https://eu-mirror.artixlinux.org/iso/artix-base-openrc-20210101-x86_64.iso + +#. Write the image to a USB drive or an optical disc. + +#. Boot the target computer from the prepared live medium. + Prepare the Live Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#. Download the latest Artix Linux OpenRC Base Image - `from official website `__ - and write it to a USB drive or an optical disc. - - OpenRC is used throughout this guide. - - Other init systems, runit and s6, are also supported. - Change the service commands to the equivalent commands. - -#. Boot the target computer from the prepared live medium. - #. Connect to the internet. If the target computer aquires IP address with DHCP, no further steps need to be taken. @@ -146,16 +157,20 @@ Prepare the Live Environment Server = https://mirror.biocrafting.net/archlinux/archzfs/$repo/$arch Server = https://mirror.in.themindsmaze.com/archzfs/$repo/$arch EOF +#. Select mirror: + + - Edit the following files:: + + /etc/pacman.d/mirrorlist + /etc/pacman.d/mirrorlist-arch + + Uncomment and move mirrors to + the beginning of the file. #. Install ZFS in the live environment:: pacman -Sy --noconfirm gdisk dosfstools archzfs-dkms - Unlike Arch Live image, - Artix Live image ships with ``linux-headers``. - This makes building kernel module - possible within live environment. - #. Load kernel module:: modprobe zfs @@ -537,9 +552,75 @@ Package Installation #. Install base packages:: - basestrap $INST_MNT base vi grub connman connman-openrc openrc - basestrap $INST_MNT $INST_LINVAR ${INST_LINVAR}-headers - basestrap $INST_MNT archzfs-dkms + basestrap $INST_MNT base vi mandoc grub connman connman-openrc openrc + +#. Install kernel headers and archzfs-dkms package: + + Check kernel version:: + + pacman -Syi ${INST_LINVAR} \ + | grep 'Version' \ + | awk '{ print $3 }' + # 5.10.1.artix1-1 + + Check zfs-dkms package version:: + + DKMS_VER=$(pacman -Si zfs-dkms \ + | grep 'Version' \ + | awk '{ print $3 }' \ + | sed 's|-.*||') + + Visit OpenZFS release page:: + + curl https://github.com/openzfs/zfs/releases/zfs-${DKMS_VER} \ + | grep Linux \ + | grep compat \ + | grep kernel + # Linux: compatible with 3.10 - 5.10 kernels + + If the kernel is supported: + + - Install archzfs-dkms:: + + basestrap $INST_MNT archzfs-dkms ${INST_LINVAR} ${INST_LINVAR}-headers + + If the kernel is not yet supported, install an older kernel: + + - Check build date:: + + DKMS_DATE=$(pacman -Syi zfs-dkms \ + | grep 'Build Date' \ + | sed 's/.*: //' \ + | LC_ALL=C xargs -i{} date -d {} +%Y/%m/%d) + + - Check kernel version:: + + curl https://archive.artixlinux.org/repos/${DKMS_DATE}/system/os/x86_64/ \ + | grep \"${INST_LINVAR}-'[0-9]' \ + | grep -v sig + # + + - Set kernel version in a variable:: + + # + INST_LINVER=5.10.3.arch1-1 + + - Install kernel and headers:: + + basestrap -U $INST_MNT \ + https://archive.artixlinux.org/packages/l/${INST_LINVAR}/${INST_LINVAR}-${INST_LINVER}-x86_64.pkg.tar.zst + https://archive.artixlinux.org/packages/l/${INST_LINVAR}-headers/${INST_LINVAR}-headers-${INST_LINVER}-x86_64.pkg.tar.zst + + - Install archzfs-dkms:: + + basestrap $INST_MNT archzfs-dkms + +#. Hold kernel package from updates:: + + sed -i 's/#.*HoldPkg/HoldPkg/' $INST_MNT/etc/pacman.conf + sed -i "/^HoldPkg/ s/$/ ${INST_LINVAR} ${INST_LINVAR}-headers/" $INST_MNT/etc/pacman.conf + + Kernel must be manually updated, see kernel update section in Getting Started. #. If your computer has hardware that requires firmware to run:: @@ -552,7 +633,15 @@ Package Installation #. If a swap partition has been created:: basestrap $INST_MNT cryptsetup - basestrap $INST_MNT cryptsetup-openrc # or other init + basestrap $INST_MNT cryptsetup-openrc + +#. Microcode: + + - ``pacstrap $INST_MNT amd-ucode`` + - ``pacstrap $INST_MNT intel-ucode`` + +#. For other optional packages, + see `ArchWiki `__. System Configuration -------------------- @@ -587,6 +676,7 @@ System Configuration #. Timezone:: ln -sf $INST_TZ $INST_MNT/etc/localtime + hwclock --systohc #. archzfs repository:: @@ -603,7 +693,7 @@ System Configuration echo "en_US.UTF-8 UTF-8" >> $INST_MNT/etc/locale.gen echo "LANG=en_US.UTF-8" >> $INST_MNT/etc/locale.conf - Other locales should be added after reboot, not here. + Other locales should be added after reboot. #. Chroot:: @@ -778,44 +868,54 @@ Finish Installation After Reboot ------------ -#. Mirror EFI system partition +Mirror EFI System Partition +~~~~~~~~~~~~~~~~~~~~~~~~~~~ - #. Format redundant EFI partitions:: +#. Format redundant EFI partitions:: - mkfs.vfat -n EFI2 /dev/disk/by-id/target_disk2-part1 - mkfs.vfat -n EFI3 /dev/disk/by-id/target_disk3-part1 + mkfs.vfat -n EFI2 /dev/disk/by-id/target_disk2-part1 + mkfs.vfat -n EFI3 /dev/disk/by-id/target_disk3-part1 - #. Create mountpoints:: +#. Create mountpoints:: - mkdir -p /boot/efis/{2,3} + mkdir -p /boot/efis/{2,3} - #. Mount redundant EFI partitions:: +#. Mount redundant EFI partitions:: - mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk2-part1 /boot/efis/2 - mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk3-part1 /boot/efis/3 + mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk2-part1 /boot/efis/2 + mount -o umask=0022,fmask=0022,dmask=0022 /dev/disk/by-id/target_disk3-part1 /boot/efis/3 - #. Add fstab entries:: +#. Add fstab entries:: - pacman -S --needed artools-base rsync + pacman -S --needed artools-base rsync - fstabgen / | grep efis >> /etc/fstab + fstabgen / | grep efis >> /etc/fstab - #. Sync EFI system partition contents:: +#. Sync EFI system partition contents:: - for i in /boot/efis/*; do - /usr/bin/rsync -a /boot/efi/ $i/ - done + for i in /boot/efis/*; do + /usr/bin/rsync -a /boot/efi/ $i/ + done - #. Add EFI boot entries:: +#. Add EFI boot entries:: - efibootmgr -cgd /dev/disk/by-id/target_disk2-part1 \ - -p 1 -L "artix-2" -l "\EFI\arch\grubx64.efi" - efibootmgr -cgd /dev/disk/by-id/target_disk3-part1 \ - -p 1 -L "artix-3" -l "\EFI\arch\grubx64.efi" + efibootmgr -cgd /dev/disk/by-id/target_disk2-part1 \ + -p 1 -L "artix-2" -l "\EFI\arch\grubx64.efi" + efibootmgr -cgd /dev/disk/by-id/target_disk3-part1 \ + -p 1 -L "artix-3" -l "\EFI\arch\grubx64.efi" -#. Optional: install ``rozb3-pac`` pacman hook and ``bieaz`` from AUR to +Boot Environment Manager +~~~~~~~~~~~~~~~~~~~~~~~~ +Optional: install ``rozb3-pac`` pacman hook and ``bieaz`` from AUR to create boot environments. +Post installation +~~~~~~~~~~~~~~~~~ +For post installation recommendations, +see `ArchWiki `__. + +Remember to create separate datasets for individual users. + Recovery -------- diff --git a/docs/Getting Started/Arch Linux/index.rst b/docs/Getting Started/Arch Linux/index.rst index f2e4000..b4960ec 100644 --- a/docs/Getting Started/Arch Linux/index.rst +++ b/docs/Getting Started/Arch Linux/index.rst @@ -12,17 +12,10 @@ Installation If you want to use ZFS as your root filesystem, see the `Root on ZFS`_ links below instead. -.. note:: +Add archzfs repo +~~~~~~~~~~~~~~~~ - Due to the release cycle of OpenZFS and the rapid adoption of new kernels - it may happen that you won’t be able to - build DKMS packages for the most recent kernel update. - If the `latest OpenZFS release `__ - does not yet support the installed kernel, - `downgrade kernel `__ - before installation. - -ZFS packages are provided by the third-party +ZFS packages are provided by the third-party `archzfs repository `__. You can use it as follows. @@ -46,26 +39,246 @@ Update pacman database:: pacman -Sy -Install packages. +Prebuilt zfs package +~~~~~~~~~~~~~~~~~~~~ -* Install prebuilt zfs package. - Kernel package version must match the zfs package version. +This only applies to vanilla Arch Linux kernels. +For other kernels, use `archzfs-dkms package`_. - - archzfs-linux - - archzfs-linux-lts - - archzfs-linux-zen - - archzfs-linux-hardened +Check kernel variant:: - :: + INST_LINVAR=$(sed 's|.*linux|linux|' /proc/cmdline | awk '{ print $1 }') - pacman -S archzfs-linux +Install compatible package:: -* If kernel dependency fails, or if you use a custom kernel, - install zfs-dkms + pacman -Sy archzfs-${INST_LINVAR} - :: +If kernel dependency failed, you can either: - pacman -S archzfs-dkms +* Install `archzfs-dkms package`_, or + +* Downgrade kernel + to a compatible version: + +Downgrade to compatible kernel +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Check compatible kernel version:: + + INST_LINVER=$(pacman -Si zfs-${INST_LINVAR} \ + | grep 'Depends On' \ + | sed "s|.*${INST_LINVAR}=||" \ + | awk '{ print $1 }') + +Install compatible kernel:: + + pacman -U \ + https://archive.archlinux.org/packages/l/${INST_LINVAR}/${INST_LINVAR}-${INST_LINVER}-x86_64.pkg.tar.zst + +Install archzfs:: + + pacman -Sy archzfs-${INST_LINVAR} + +Ignore kernel update when dependency fails +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Sometimes archzfs prebuilt package might lag behind +kernel updates:: + + pacman -Syu + # error: failed to prepare transaction (could not satisfy dependencies) + # :: installing linux-lts (5.4.93-2) breaks dependency 'linux-lts=5.4.92-1' required by zfs-linux-lts + +Temporarily ignore kernel update to upgrade other packages:: + + pacman -Syu --ignore=linux=lts + +archzfs-dkms package +~~~~~~~~~~~~~~~~~~~~ + +This package will dynamically build ZFS modules for +supported kernels. Both Arch Linux and derivatives +are supported. + +Check OpenZFS compatibility +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Check kernel version:: + + uname -r + # 5.4.92-1-lts + +Check newer archzfs-dkms package version:: + + DKMS_VER=$(pacman -Si zfs-dkms \ + | grep 'Version' \ + | awk '{ print $3 }' \ + | sed 's|-.*||') + +Visit OpenZFS release page :: + + curl https://github.com/openzfs/zfs/releases/zfs-${DKMS_VER} \ + | grep Linux \ + | grep compat \ + | grep kernel + # Linux: compatible with 3.10 - 5.10 kernels + +If it's not supported, see `Install alternative kernel`_. +Otherwise, continue to next step. + +Normal installation +^^^^^^^^^^^^^^^^^^^ + +Check kernel variant:: + + INST_LINVAR=$(sed 's|.*linux|linux|' /proc/cmdline | awk '{ print $1 }') + +Check kernel version:: + + INST_LINVER=$(pacman -Qi ${INST_LINVAR} | grep Version | awk '{ print $3 }') + +Install kernel headers:: + + pacman -U https://archive.archlinux.org/packages/l/${INST_LINVAR}-headers/${INST_LINVAR}-headers-${INST_LINVER}-x86_64.pkg.tar.zst + # for artix + pacman -U https://archive.artixlinux.org/packages/l/${INST_LINVAR}-headers/${INST_LINVAR}-headers-${INST_LINVER}-x86_64.pkg.tar.zst + +Install archzfs-dkms:: + + pacman -Sy archzfs-dkms + +Hold kernel package from updates:: + + sed -i 's/#.*HoldPkg/HoldPkg/' /etc/pacman.conf + sed -i "/^HoldPkg/ s/$/ ${INST_LINVAR} ${INST_LINVAR}-headers/" /etc/pacman.conf + +Kernel must be manually updated, see `Kernel update`_. + +Install alternative kernel +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +If the kernel is not yet supported, install a supported kernel: + +Choose kernel variant. Available variants are: + +* linux +* linux-lts + +For Artix, replace ``archlinux.org`` with ``artixlinux.org``. + +:: + + INST_LINVAR=linux + +Check build date:: + + DKMS_DATE=$(pacman -Syi zfs-dkms \ + | grep 'Build Date' \ + | sed 's/.*: //' \ + | LC_ALL=C xargs -i{} date -d {} +%Y/%m/%d) + +Check kernel version:: + + curl https://archive.archlinux.org/repos/${DKMS_DATE}/core/os/x86_64/ \ + | grep \"${INST_LINVAR}-'[0-9]' \ + | grep -v sig + # + +Set kernel version in a variable:: + + # + INST_LINVER=5.10.3.arch1-1 + +Install kernel and headers:: + + pacman -U \ + https://archive.archlinux.org/packages/l/${INST_LINVAR}/${INST_LINVAR}-${INST_LINVER}-x86_64.pkg.tar.zst \ + https://archive.archlinux.org/packages/l/${INST_LINVAR}-headers/${INST_LINVAR}-headers-${INST_LINVER}-x86_64.pkg.tar.zst + +Install archzfs-dkms:: + + pacman -Sy archzfs-dkms + +Hold kernel package from updates:: + + sed -i 's/#.*HoldPkg/HoldPkg/' /etc/pacman.conf + sed -i "/^HoldPkg/ s/$/ ${INST_LINVAR} ${INST_LINVAR}-headers/" /etc/pacman.conf + +Kernel must be manually updated, see `Kernel update`_. + +Kernel update +^^^^^^^^^^^^^ + +This applies to archzfs-dkms package. + +Check kernel variant:: + + INST_LINVAR=$(sed 's|.*linux|linux|' /proc/cmdline | awk '{ print $1 }') + +Check newer kernel version:: + + pacman -Syi $INST_LINVAR \ + | grep 'Version' \ + | awk '{ print $3 }' + # 5.10.1.1-1 + +Check newer archzfs-dkms package version:: + + pacman -Si zfs-dkms \ + | grep 'Version' \ + | awk '{ print $3 }' \ + | sed 's|-.*||' + # 2.0.1 + +Visit OpenZFS release page https://github.com/openzfs/zfs/releases/zfs-2.0.1:: + + # Linux: compatible with 3.10 - 5.10 kernels + +If compatible, update kernel with:: + + pacman -S $INST_LINVAR $INST_LINVAR-headers archzfs-dkms + +Do not update if the kernel is not compatible +with OpenZFS. + +Check Live Image Compatibility +------------------------------ +#. Choose a mirror:: + + https://archlinux.org/mirrorlist/all/ + https://gitea.artixlinux.org/packagesA/artix-mirrorlist/src/branch/master/trunk/mirrorlist + +#. Check the build date of the + latest Arch Linux live image:: + + https://mirrors.dotsrc.org/archlinux/iso/latest/ + https://mirrors.dotsrc.org/artix-linux/iso/ + # archlinux-2021.01.01-x86_64.iso + +#. Check the kernel version of the live image:: + + https://archive.archlinux.org/repos/2021/01/01/core/os/x86_64 + https://archive.artixlinux.org/repos/2021/01/01/system/os/x86_64 + # linux-5.10.3.arch1-1-x86_64.pkg.tar.zst + +#. Check latest archzfs package version:: + + https://archzfs.com/archzfs/x86_64/ + # zfs-dkms-2.0.1-1-x86_64.pkg.tar.zst + # zfs-linux-2.0.1_5.10.10.arch1.1-1-x86_64.pkg.tar.zst + +#. Visit OpenZFS release page https://github.com/openzfs/zfs/releases/tag/zfs-2.0.1:: + + # Linux: compatible with 3.10 - 5.10 kernels + + - If compatible, download the latest live image:: + + https://mirrors.dotsrc.org/archlinux/iso/latest/archlinux-2021.01.01-x86_64.iso + https://mirrors.dotsrc.org/artix-linux/iso/artix-base-openrc-20210101-x86_64.iso + + - If not compatible, use an older live image and verify that it contains + a supported kernel using the above method:: + + https://mirrors.dotsrc.org/archlinux/iso/ + https://iso.artixlinux.org/archived-isos.php Root on ZFS -----------