Last active
March 13, 2025 06:51
-
-
Save ReSearchITEng/cd559fcc0ec6932c6d8ffe1fb4845d9b to your computer and use it in GitHub Desktop.
build latest zfs kernel module from source code on raspberrypi2 arm 32bit debian pios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## FOR AMD64 ubuntu try to find repo: https://launchpad.net/ubuntu/+ppas?name_filter=zfs : | |
# export DEBIAN_FRONTEND=noninteractive | |
# sudo add-apt-repository -y ppa:arter97/zfs | |
# sudo apt purge -y dkms zfs-dkms zfs-zed zfsutils-linux || true | |
# sudo apt purge -y dkms libnvpair3linux libuutil3linux libzfs6linux libzpool6linux || true | |
# sudo apt install -y zfs-dkms zfsutils-linux | |
# sudo reboot | |
# for ARM, continue with: | |
sed -r -i'.BAK' 's/^deb(.*)$/deb\1 contrib/g' /etc/apt/sources.list | |
# MUST REMOVE zfs-dkms zfs-zed , so modules will not conflict: | |
sudo apt purge -y zfs-dkms zfs-zed zfsutils-linux | |
sudo apt purge -y zfsutils-linux zfs-zed | |
sudo apt purge -y libzfs2linux || true | |
sudo apt autoremove -y | |
sudo apt update -y | |
sudo apt upgrade -y | |
echo "NOW REBOOT, to both: fully remove zfs-dkms&zfs-zed AND take eventually latest kernel, you are now $(uname -r)" | |
sleep 100 | |
#reboot # to take latest uname -r | |
#sudo apt install linux-generic -y | |
apt depends linux-image-generic # THIS ALWAYS POINTS TO LATEST installed | |
apt list --installed | grep linux-image-$(uname -r) || sudo apt install linux-image-$(uname -r) -y # --reinstall | |
apt list --installed | grep linux-modules-$(uname -r) || sudo apt install linux-modules-$(uname -r) -y # --reinstall | |
apt list --installed | grep linux-modules-extra-$(uname -r) || sudo apt install linux-modules-extra-$(uname -r) -y # --reinstall | |
#sudo apt --autoremove --yes purge linux-generic linux-image-generic linux-headers-generic | |
apt list --installed | grep linux-headers || sudo apt install -y linux-headers | |
sudo apt install libncurses5-dev libffi-dev libtool -y #suggested by gemini | |
#sudo apt install build-essential autoconf automake libtool gawk alien fakeroot dkms libblkid-dev uuid-dev libudev-dev libssl-dev zlib1g-dev libaio-dev libattr1-dev libelf-dev linux-headers-generic python3 python3-dev python3-setuptools python3-cffi libffi-dev python3-packaging git libcurl4-openssl-dev debhelper-compat dh-python po-debconf python3-all-dev python3-sphinx parallel | |
# | |
sudo apt install -y build-essential autoconf automake libtool gawk alien fakeroot dkms libblkid-dev uuid-dev libudev-dev libssl-dev zlib1g-dev libaio-dev libattr1-dev libelf-dev python3 python3-dev python3-setuptools python3-cffi libffi-dev python3-packaging git libcurl4-openssl-dev debhelper-compat dh-python po-debconf python3-all-dev parallel | |
#python3-sphinx samba | |
sudo apt install -y ksh bc bzip2 fio acl sysstat mdadm lsscsi parted attr dbench nfs-kernel-server rng-tools pax linux-perf selinux-utils quota | |
git clone --depth 1 --branch zfs-2.2.4 https://github.com/openzfs/zfs.git | |
#git checkout zfs-2.2.4 | |
cd zfs | |
sh autogen.sh | |
./configure | |
make -s -j$(nproc) | |
## BEFORE INSTALL: | |
## OLD: | |
#lsmod | grep zfs | |
#zfs 3411968 3 | |
#zunicode 331776 1 zfs | |
#zavl 16384 1 zfs | |
#icp 253952 1 zfs | |
#zcommon 69632 1 zfs | |
#znvpair 77824 2 zfs,zcommon | |
#spl 106496 4 zfs,icp,znvpair,zcommon | |
## BACKUP: | |
sudo cp -rPp /lib/modules/$(uname -r) /lib/modules/$(uname -r).original | |
sudo cp -rPp /usr/src/linux-headers-$(uname -r) /usr/src/linux-headers-$(uname -r).original | |
## disable and remove old: | |
sudo systemctl disable --now zfs-zed || true | |
sudo rmmod zfs zunicode zavl icp zcommon znvpair spl | |
sudo modprobe -rv zfs | |
### INSTALL | |
sudo make install; sudo ldconfig; sudo depmod | |
ls -la /lib/modules/$(uname -r)/extra/ | |
##before make install, remove extra from search of: /etc/depmod.d/ubuntu.conf | |
## usually sudo depmod -a ; sudo modprobe zfs , so do: | |
cd scripts | |
sudo ./zfs.sh -vr | |
#instead of: | |
sudo modprobe zfs | |
## if install did not make new module automatically at reboot, do: | |
#add extra in search of: /etc/depmod.d/ubuntu.conf | |
#and sudo depmod -a ; sudo modprobe zfs | |
### https://openzfs.github.io/openzfs-docs/Developer%20Resources/Building%20ZFS.html#github-repositories | |
sudo make -C module/ install | |
sudo make -C modules/ install || true #??? | |
echo "some kernel cleanup" | |
apt purge linux-headers-$(uname -r)-v6 linux-headers-$(uname -r)-v6* linux-image-$(uname -r)-v6* linux-headers-rpi-v6* linux-image-rpi-v6* -y | |
apt purge linux-headers-$(uname -r)-v8* linux-headers-$(uname -r)-v8* linux-image-$(uname -r)-v8* linux-headers-rpi-v8* linux-image-rpi-v8* -y | |
apt purge linux-headers-$(uname -r)-v7l* linux-headers-$(uname -r)-v7l* linux-image-$(uname -r)-v7l* linux-headers-rpi-v7l* linux-image-rpi-v7l* -y | |
sudo systemctl enable --now zfs-zed.service | |
sudo systemctl enable --now zfs-mount.service | |
cat <EOF | |
#list of systemd services: | |
zfs-import-cache.service | |
zfs-import-scan.service | |
zfs-mount.service | |
[email protected] | |
[email protected] | |
zfs-share.service | |
zfs-volume-wait.service | |
zfs-zed.service | |
EOF | |
### SYNC | |
for snap in $(zfs list -H -o name -t snapshot -r z4/z); do holds=$(zfs holds -H $snap); if [ -n "$holds" ]; then echo $holds; fi; done | |
for snap in $(zfs list -H -o name -t snapshot -r z8/z); do holds=$(zfs holds -H $snap); if [ -n "$holds" ]; then echo $holds; sudo zfs release syncoid_d01 $snap; fi; done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment