Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing contrib/debian/control when building deb dkms package on Ubuntu 23.10 #15586

Open
FL140 opened this issue Nov 27, 2023 · 54 comments
Open
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@FL140
Copy link

FL140 commented Nov 27, 2023

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version 23.10
Kernel Version 6.5.0-10-generic
Architecture x86_64/amd64
OpenZFS Version 2.2.1

Describe the problem you're observing

I am trying to build a deb zfs dkms package for Ubuntu 23.10 from the release 2.2.1 tar package from GitHub according to the recommendation given in #15529 (comment) if followed the instructions given in https://openzfs.github.io/openzfs-docs/Developer%20Resources/Custom%20Packages.html .

I am trying this because of the block clone bug and the following fixes introduced with 2.2.1, unfortunately there is still no package for Ubuntu available and I need to fix the systems I am responsible for ASAP.

Unfortunately it seems as the instructions and release package have issues.

The following issues were found:

  • The file contrib/debian/control is missing in the release tar package.
  • The download location given in the instructions does not exist. =>
    Get the tar package directly from GitHub.
#wget http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-${OPENZFS_VERSION}.tar.gz
wget https://github.com/openzfs/zfs/releases/download/zfs-${OPENZFS_VERSION}/zfs-${OPENZFS_VERSION}.tar.gz
  • The unpacked tar package can be found in directory zfs-${OPENZFS_VERSION} not zfs
  • The alien package (and others?) should no longer be needed since 2.2.0 (if I understand the instructions correctly). (Note: The control file not found error pops up with and without package alien installed.)

Only the first issue needs solving, I already solved the other issues (except that the documentation needs an update).

Describe how to reproduce the problem

I wrote an installation script:

#!/bin/bash
# Ubuntu OpenZFS DKMS Kernel Module Install Script

typeset -r OPENZFS_VERSION=${1:-2.2.1}
typeset -r TMP_DIR="/tmp"

# Installed required packages (Debian, Ubuntu)
# Note:
# TBD: hmm, I don't think we need alien and related packages any longer for versions >= v2.2.
sudo apt-get install -y build-essential autoconf automake libtool gawk \
        fakeroot 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 debhelper-compat dh-python po-debconf \
        python3-all-dev python3-sphinx \
        dkms dh-dkms

# Create working directory
[ -d "${TMP_DIR}/zfs-${OPENZFS_VERSION}" ] && { rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"; }    # !! use a fixed sting in rm -rf!
install -d -m 0770 -o root -g root "${TMP_DIR}/zfs-${OPENZFS_VERSION}"
pushd "${TMP_DIR}/zfs-${OPENZFS_VERSION}" > /dev/null || { echo "Error while pushd directory \"${TMP_DIR}/zfs-${OPENZFS_VERSION}\"!"; exit 2; }

# Get Source Code Released Tarball
# Note:
# The download location given in the instructions does not exist, get the tar package directly from GitHub.
#wget http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-${OPENZFS_VERSION}.tar.gz
wget https://github.com/openzfs/zfs/releases/download/zfs-${OPENZFS_VERSION}/zfs-${OPENZFS_VERSION}.tar.gz
wget https://github.com/openzfs/zfs/releases/download/zfs-${OPENZFS_VERSION}/zfs-${OPENZFS_VERSION}.sha256.asc
sha256sum --check zfs-${OPENZFS_VERSION}.sha256.asc || { echo "Error checksum(s) for zfs-${OPENZFS_VERSION} does not match!"; exit 3; }
gpg --verify zfs-${OPENZFS_VERSION}.sha256.asc zfs-${OPENZFS_VERSION}.tar.gz    # TBD add error handling

# Build and install OpenZFS DKMS deb package
# Note:
# Starting from openzfs-2.2 release, native deb-based DKMS and user packages can be built.
# => We are compiling for => v2.2.1 so this is the way to go.
tar -xzf zfs-${OPENZFS_VERSION}.tar.gz
cd zfs-${OPENZFS_VERSION}
./configure || { echo "Error while configuring zfs-${OPENZFS_VERSION} package build!"; exit 4; }
make native-deb-utils || { echo "Error while making native-deb-utils for zfs-${OPENZFS_VERSION}!"; exit 5; }
sudo apt-get install --fix-missing ../*.deb

# Clean Up
popd > /dev/null || { echo "Error while popd directory!"; exit 2; }
rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"    # !! use a fixed sting in rm -rf!
exit 0

The command make native-deb-utils triggers the error:

cp -r contrib/debian debian; chmod +x debian/rules;
cp contrib/debian/control debian/control; \
dpkg-buildpackage -b -rfakeroot -us -uc;
cp: cannot stat 'contrib/debian/control': No such file or directory
dpkg-buildpackage: error: cannot read debian/control: No such file or directory
make: *** [Makefile:14365: native-deb-utils] Error 255
$

Include any warning/errors/backtraces from the system logs

Script output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'debhelper' instead of 'debhelper-compat'
build-essential is already the newest version (12.10ubuntu1).
autoconf is already the newest version (2.71-3).
automake is already the newest version (1:1.16.5-1.3).
libtool is already the newest version (2.4.7-7).
gawk is already the newest version (1:5.2.1-2).
fakeroot is already the newest version (1.32.1-1).
libblkid-dev is already the newest version (2.39.1-4ubuntu2).
uuid-dev is already the newest version (2.39.1-4ubuntu2).
libudev-dev is already the newest version (253.5-1ubuntu6.1).
libssl-dev is already the newest version (3.0.10-1ubuntu2.1).
zlib1g-dev is already the newest version (1:1.2.13.dfsg-1ubuntu5).
libaio-dev is already the newest version (0.3.113-5).
libattr1-dev is already the newest version (1:2.5.1-4).
libelf-dev is already the newest version (0.189-4).
linux-headers-generic is already the newest version (6.5.0.13.15).
python3 is already the newest version (3.11.4-5).
python3-dev is already the newest version (3.11.4-5).
python3-setuptools is already the newest version (68.1.2-2).
python3-cffi is already the newest version (1.15.1-5build1).
libffi-dev is already the newest version (3.4.4-1).
python3-packaging is already the newest version (23.1-1).
debhelper is already the newest version (13.11.6ubuntu1).
dh-python is already the newest version (6.20230825).
po-debconf is already the newest version (1.0.21+nmu1).
python3-all-dev is already the newest version (3.11.4-5).
python3-sphinx is already the newest version (5.3.0-7).
dkms is already the newest version (3.0.11-1ubuntu10).
dh-dkms is already the newest version (3.0.11-1ubuntu10).
0 upgraded, 0 newly installed, 0 to remove and 56 not upgraded.
--2023-11-27 02:52:04--  https://github.com/openzfs/zfs/releases/download/zfs-2.2.1/zfs-2.2.1.tar.gz
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/437011/37f69214-9581-4db2-8e6c-7a26979ac46f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231127T015205Z&X-Amz-Expires=300&X-Amz-Signature=791d267aece7050ab752adce49df04a77434f694ee904325e7c48ab3b87ddf52&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=437011&response-content-disposition=attachment%3B%20filename%3Dzfs-2.2.1.tar.gz&response-content-type=application%2Foctet-stream [following]
--2023-11-27 02:52:05--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/437011/37f69214-9581-4db2-8e6c-7a26979ac46f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231127T015205Z&X-Amz-Expires=300&X-Amz-Signature=791d267aece7050ab752adce49df04a77434f694ee904325e7c48ab3b87ddf52&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=437011&response-content-disposition=attachment%3B%20filename%3Dzfs-2.2.1.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.109.133, 185.199.108.133, 185.199.111.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 33814243 (32M) [application/octet-stream]
Saving to: ‘zfs-2.2.1.tar.gz’

zfs-2.2.1.tar.gz             100%[==============================================>]  32.25M  2.61MB/s    in 13s     

2023-11-27 02:52:18 (2.42 MB/s) - ‘zfs-2.2.1.tar.gz’ saved [33814243/33814243]

--2023-11-27 02:52:18--  https://github.com/openzfs/zfs/releases/download/zfs-2.2.1/zfs-2.2.1.sha256.asc
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/437011/1d6d831e-d287-4a71-ad8f-d70dc13f0a30?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231127T015219Z&X-Amz-Expires=300&X-Amz-Signature=637a0d74af6ee34e8ec53b45885f2417a3b2dc97240167ef90c0030c56978cf6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=437011&response-content-disposition=attachment%3B%20filename%3Dzfs-2.2.1.sha256.asc&response-content-type=application%2Foctet-stream [following]
--2023-11-27 02:52:19--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/437011/1d6d831e-d287-4a71-ad8f-d70dc13f0a30?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231127T015219Z&X-Amz-Expires=300&X-Amz-Signature=637a0d74af6ee34e8ec53b45885f2417a3b2dc97240167ef90c0030c56978cf6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=437011&response-content-disposition=attachment%3B%20filename%3Dzfs-2.2.1.sha256.asc&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 968 [application/octet-stream]
Saving to: ‘zfs-2.2.1.sha256.asc’

zfs-2.2.1.sha256.asc         100%[==============================================>]     968  --.-KB/s    in 0s      

2023-11-27 02:52:20 (38.0 MB/s) - ‘zfs-2.2.1.sha256.asc’ saved [968/968]

zfs-2.2.1.tar.gz: OK
sha256sum: WARNING: 18 lines are improperly formatted
gpg: not a detached signature
checking for gawk... gawk
checking metadata... META file
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking whether make sets $(MAKE)... yes
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking whether ln -s works... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking dependency style of gcc... gcc3
checking whether to build with code coverage support... no
checking how to create a pax tar archive... gnutar
checking zfs author... OpenZFS
checking zfs license... CDDL
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for ld... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking for shared library run path origin... done
checking 32-bit host C ABI... no
checking for the common suffixes of directories in the library search path... lib,lib
checking zfs config... all
checking the number of available CPUs... 16
checking whether gcc supports -Wno-clobbered... yes
checking whether gcc supports -Winfinite-recursion... yes
checking whether  supports -Winfinite-recursion... yes
checking whether gcc supports -Wimplicit-fallthrough... yes
checking whether gcc supports -Wframe-larger-than=<size>... yes
checking whether gcc supports -Wno-format-truncation... yes
checking whether gcc supports -Wno-format-zero-length... yes
checking whether gcc supports -Wformat-overflow... yes
checking whether gcc supports -fno-omit-frame-pointer... yes
checking whether gcc supports -fno-ipa-sra... yes
checking whether  supports -fno-ipa-sra... yes
checking whether to build with -fsanitize=address support... no
checking whether to build with -fsanitize=undefined support... no
checking whether host toolchain supports SSE... yes
checking whether host toolchain supports SSE2... yes
checking whether host toolchain supports SSE3... yes
checking whether host toolchain supports SSSE3... yes
checking whether host toolchain supports SSE4.1... yes
checking whether host toolchain supports SSE4.2... yes
checking whether host toolchain supports AVX... yes
checking whether host toolchain supports AVX2... yes
checking whether host toolchain supports AVX512F... yes
checking whether host toolchain supports AVX512CD... yes
checking whether host toolchain supports AVX512DQ... yes
checking whether host toolchain supports AVX512BW... yes
checking whether host toolchain supports AVX512IFMA... yes
checking whether host toolchain supports AVX512VBMI... yes
checking whether host toolchain supports AVX512PF... yes
checking whether host toolchain supports AVX512ER... yes
checking whether host toolchain supports AVX512VL... yes
checking whether host toolchain supports AES... yes
checking whether host toolchain supports PCLMULQDQ... yes
checking whether host toolchain supports MOVBE... yes
checking whether host toolchain supports XSAVE... yes
checking whether host toolchain supports XSAVEOPT... yes
checking whether host toolchain supports XSAVES... yes
checking for system type (linux-gnu)... Linux
checking for python3... python3
checking for python version... 3.11
checking for python platform... linux
checking for GNU default python prefix... ${prefix}
checking for GNU default python exec_prefix... ${exec_prefix}
checking for python script directory (pythondir)... ${PYTHON_PREFIX}/local/lib/python3.11/dist-packages
checking for python extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/local/lib/python3.11/dist-packages
checking for python3 module: packaging... yes
checking for python3.11... /usr/bin/python3.11
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python >= '3.6.0'... yes
checking for Python include path... -I/usr/include/python3.11
checking for Python library path... -L/usr/lib/x86_64-linux-gnu -lpython3.11
checking for Python site-packages path... /usr/lib/python3/dist-packages
checking python extra libraries... -ldl -lm
checking python extra linking flags... -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
checking consistency of all components of python development environment... yes
checking for python3.11 module: setuptools... yes
checking for python3.11 module: cffi... yes
checking whether to enable pyzfs: ... yes
checking for sed --in-place... --in-place
checking for cppcheck... no
checking for shellcheck... yes
checking for checkbashisms... no
checking for parallel... no
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for CFLocaleCopyPreferredLanguages... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking for dracut directory... /usr/lib/dracut
checking for zlib... yes
checking for zlib.h... yes
checking for compress2 in -lz... yes
checking for uncompress in -lz... yes
checking for crc32 in -lz... yes
checking for udev directories... /lib/udev;/lib/udev/rules.d
checking for systemd support... yes
checking for libudev... yes
checking for libudev.h... yes
checking for main in -ludev... yes
checking for udev_device_get_is_initialized... yes
checking for uuid... yes
checking for uuid/uuid.h... yes
checking for uuid_generate in -luuid... yes
checking for uuid_is_null in -luuid... yes
checking for blkid... yes
checking for blkid/blkid.h... yes
checking for main in -lblkid... yes
checking for library containing xdrmem_create... no
checking for libtirpc... yes
checking for rpc/xdr.h... yes
checking for xdrmem_create in -ltirpc... yes
checking for libcrypto... yes
checking for openssl/evp.h... yes
checking for PKCS5_PBKDF2_HMAC_SHA1 in -lcrypto... yes
checking for libaio.h... yes
checking for main in -laio... yes
checking whether -latomic is required... no
checking for libfetch... none
checking for aio.h... yes
checking for lio_listio in -lrt... yes
checking for clock_gettime... yes
checking for security/pam_modules.h... no
checking makedev() is declared in sys/sysmacros.h... yes
checking makedev() is declared in sys/mkdev.h... no
checking for issetugid... no
checking for mlockall... yes
checking for strlcat... yes
checking for strlcpy... yes
checking kernel source and build directories... done
checking kernel source directory... /usr/src/linux-headers-6.5.0-10-generic
checking kernel build directory... /usr/src/linux-headers-6.5.0-10-generic
checking kernel source version... 6.5.0-10-generic
checking for kernel config option compatibility... done
checking whether CONFIG_MODULES is defined... yes
checking whether CONFIG_BLOCK is defined... yes
checking whether mutex_lock() is GPL-only... no
checking whether CONFIG_TRIM_UNUSED_KSYM is disabled... yes
checking whether CONFIG_ZLIB_DEFLATE is defined... yes
checking whether CONFIG_ZLIB_INFLATE is defined... yes
checking kernel file name for module symbols... Module.symvers
checking whether fpu headers are available... asm/fpu/api.h
checking whether objtool header is available... linux/objtool.h
checking whether wait_queue_entry_t exists... yes
checking whether /dev/zfs minor is available... 249
checking whether DECLARE_EVENT_CLASS() is available... no
checking for available kernel interfaces... done
checking whether access_ok() has 'type' parameter... no
checking whether global_node_page_state() exists... yes
checking whether global_zone_page_state() exists... yes
checking whether enum node_stat_item contains NR_FILE_PAGES... yes
checking whether enum node_stat_item contains NR_INACTIVE_ANON... yes
checking whether enum node_stat_item contains NR_INACTIVE_FILE... yes
checking whether enum zone_stat_item contains NR_FILE_PAGES... no
checking whether enum zone_stat_item contains NR_INACTIVE_ANON... no
checking whether enum zone_stat_item contains NR_INACTIVE_FILE... no
checking whether global_page_state enums are sane... yes
checking whether compile-time stack validation (objtool) is available... yes
checking whether STACK_FRAME_NON_STANDARD is defined... yes
checking whether pde_data() is lowercase... yes
checking whether fops->fallocate() exists... yes
checking whether FALLOC_FL_ZERO_RANGE exists... yes
checking whether fops->fadvise() exists... yes
checking whether generic_fadvise() is available... yes
checking whether zlib_deflate_workspacesize() wants 2 args... yes
checking whether struct rw_semaphore has member activity... no
checking whether struct rw_semaphore has atomic_long_t member count... yes
checking whether header linux/sched/rt.h exists... yes
checking whether header linux/sched/signal.h exists... yes
checking whether io_schedule_timeout() is available... yes
checking whether usleep_range() is available... yes
checking whether kmem_cache_create_usercopy() exists... yes
checking whether kvmalloc(ptr, flags) is available... yes
checking whether __vmalloc(ptr, flags, pageflags) is available... no
checking whether wait_on_bit() takes an action... no
checking whether wq_head->head and wq_entry->entry exist... yes
checking whether timestamp_truncate() exists... yes
checking whether inode->i_*time's are timespec64... yes
checking whether inode_get_ctime() exists... no
checking whether inode_set_ctime_to_ts() exists... no
checking whether inode_lock_shared() exists... yes
checking whether group_info->gid exists... yes
checking whether kernel_write() takes loff_t pointer... yes
checking whether kernel_read() takes loff_t pointer... yes
checking whether timer_setup() is available... yes
checking whether timer function expects timer_list... yes
checking whether struct timer_list has flags... yes
checking whether super_block->s_user_ns exists... yes
checking whether proc_ops structure exists... yes
checking whether bops->check_events() exists... yes
checking whether bops->release() is void and takes 2 args... no
checking whether bops->release() is void and takes 1 arg... yes
checking whether bops->revalidate_disk() exists... no
checking whether REQ_FAILFAST_MASK is defined... yes
checking whether REQ_DISCARD is defined... no
checking whether REQ_FLUSH is defined... no
checking whether REQ_PREFLUSH is defined... yes
checking whether REQ_OP_DISCARD is defined... yes
checking whether REQ_OP_SECURE_ERASE is defined... yes
checking whether REQ_OP_FLUSH is defined... yes
checking whether bio->bi_opf is defined... yes
checking whether bio_set_op_attrs is available... no
checking whether bio_set_dev() is available... yes
checking whether bio_set_dev() is GPL-only... yes
checking whether bio_set_dev() is a macro... no
checking whether bio_end_io_t wants 1 arg... yes
checking whether bio->bi_status exists... yes
checking whether bio has bi_iter... yes
checking whether submit_bio() wants 1 arg... yes
checking whether current->bio_list exists... yes
checking whether blkg_tryget() is available... no
checking whether bio->bi_bdev->bd_disk exists... yes
checking whether block_device_operations->submit_bio() returns void... yes
checking whether linux/blk-cgroup.h exists... yes
checking whether bio_alloc() wants 4 args... yes
checking whether blkdev_get_by_path() exists and takes 3 args... no
checking whether blkdev_get_by_path() exists and takes 4 args... yes
checking whether blkdev_put() exists... checking whether blkdev_put() accepts void* as arg 2... yes
checking whether blkdev_reread_part() exists... no
checking whether invalidate_bdev() exists... yes
checking whether lookup_bdev() wants dev_t arg... yes
checking whether bdev_logical_block_size() is available... yes
checking whether bdev_physical_block_size() is available... yes
checking whether check_disk_change() exists... no
checking whether bdev_check_media_change() exists... no
checking whether bdev_whole() is available... yes
checking whether bdevname() exists... no
checking whether blkdev_get_by_path() handles ERESTARTSYS... no
checking whether blkdev_issue_secure_erase() is available... yes
checking whether bdev_kobj() exists... yes
checking whether part_to_dev() exists... no
checking whether disk_check_media_change() exists... yes
checking whether BLK_STS_RESV_CONFLICT is defined... yes
checking whether blk_mode_t is defined... yes
checking whether struct blk_plug is available... yes
checking whether blk_queue bdi is dynamic... no
checking whether blk_queue_update_readahead() exists... no
checking whether disk_update_readahead() exists... yes
checking whether bdev_max_discard_sectors() is available... yes
checking whether bdev_max_secure_erase_sectors() is available... yes
checking whether blk_queue_flag_set() exists... yes
checking whether blk_queue_flag_clear() exists... yes
checking whether blk_queue_flush() is available... no
checking whether blk_queue_write_cache() exists... yes
checking whether blk_queue_write_cache() is GPL-only... yes
checking whether blk_queue_max_hw_sectors() is available... yes
checking whether blk_queue_max_segments() is available... yes
checking whether block multiqueue with blk_status_t is available... yes
checking whether GENHD_FL_EXT_DEVT flag is available... no
checking whether GENHD_FL_NO_PART flag is available... yes
checking whether revalidate_disk_size() is available... no
checking whether revalidate_disk() is available... no
checking whether get_disk_ro() is available... yes
checking whether generic_readlink is global... no
checking whether ql->discard_granularity is available... yes
checking whether inode_owner_or_capable() exists... no
checking whether inode_owner_or_capable() takes user_ns... no
checking whether inode_owner_or_capable() takes mnt_idmap... yes
checking whether super_block uses const struct xattr_handler... yes
checking whether xattr_handler has name... yes
checking whether xattr_handler->get() wants dentry and inode... yes
checking whether xattr_handler->set() wants dentry, inode, and mnt_idmap... yes
checking whether xattr_handler->list() wants simple... yes
checking whether posix_acl_from_xattr() needs user_ns... yes
checking whether generic_setxattr() exists... no
checking whether posix_acl_release() is available... yes
checking whether posix_acl_release() is GPL-only... yes
checking whether set_cached_acl() is usable... yes
checking whether __posix_acl_chmod exists... yes
checking whether posix_acl_equiv_mode() wants umode_t... yes
checking whether posix_acl_valid() wants user namespace... yes
checking whether iops->get_acl() exists... yes
checking whether iops->set_acl() exists... yes
checking whether uncached_acl_sentinel() exists... yes
checking whether posix_acl has refcount_t... yes
checking whether iops->setattr() takes mnt_idmap... yes
checking whether iops->getattr() takes mnt_idmap... yes
checking whether inode_set_flags() exists... yes
checking whether inode_set_iversion() exists... yes
checking whether sops->show_options() wants dentry... yes
checking whether file_inode() is available... yes
checking whether file_dentry() is available... yes
checking whether fops->fsync() wants no dentry... no
checking whether fops->fsync() wants range... range
checking whether fops->aio_fsync() exists... no
checking whether sops->evict_inode() exists... yes
checking whether sops->dirty_inode() wants flags... yes
checking whether super_block has s_shrink... yes
checking whether shrink_control has nid... yes
checking whether new var-arg register_shrinker() exists... yes
checking whether struct shrink_control exists... yes
checking whether iops->mkdir() takes struct mnt_idmap*... yes
checking whether iops->lookup() passes flags... yes
checking whether iops->create() takes struct mnt_idmap*... yes
checking whether iops->permission() takes struct mnt_idmap*... yes
checking whether iops->get_link() passes delayed... yes
checking whether i_op->tmpfile() exists... yes
checking whether dops->d_automount() exists... yes
checking whether eops->encode_fh() wants inode... yes
checking whether eops->commit_metadata() exists... yes
checking whether clear_inode() is available... yes
checking whether setattr_prepare() is available and accepts struct mnt_idmap*... yes
checking whether insert_inode_locked() is available... yes
checking whether d_make_root() is available... yes
checking whether d_obtain_alias() is available... yes
checking whether d_prune_aliases() is available... yes
checking whether d_set_d_op() is available... yes
checking whether dops->d_revalidate() takes struct nameidata... no
checking whether dentry uses const struct dentry_operations... yes
checking whether super_block has s_d_op... yes
checking whether dentry aliases are in d_u member... yes
checking whether truncate_setsize() is available... yes
checking whether security_inode_init_security wants callback... yes
checking whether fst->mount() exists... yes
checking whether super_setup_bdi_name() exists... yes
checking whether set_nlink() is available... yes
checking whether sget() wants 5 args... yes
checking whether lseek_execute() is available... no
checking whether filemap_dirty_folio exists... yes
checking whether read_folio exists... yes
checking whether vfs_getattr() wants 4 args... yes
checking whether vfs_getattr() wants 2 args... no
checking whether vfs_getattr() wants 3 args... no
checking whether vfs_fsync() wants 2 args... yes
checking whether fops->iterate_shared() is available... yes
checking whether aops->direct_IO() uses iov_iter... yes
checking whether aops->readpages exists... no
checking whether __set_page_dirty_nobuffers exists... no
checking whether fops->read/write_iter() are available... yes
checking whether new_sync_read/write() are available... no
checking whether generic_write_checks() takes kiocb... yes
checking whether iov_iter types are available... yes
checking whether iov_iter_advance() is available... yes
checking whether iov_iter_revert() is available... yes
checking whether iov_iter_fault_in_readable() is available... no
checking whether fault_in_iov_iter_readable() is available... yes
checking whether iov_iter_count() is available... yes
checking whether copy_to_iter() is available... yes
checking whether copy_from_iter() is available... yes
checking whether iov_iter_type() is available... yes
checking whether iter_iov() is available... yes
checking whether fops->copy_file_range() is available... yes
checking whether generic_copy_file_range() is available... yes
checking whether fops->remap_file_range() is available... yes
checking whether fops->clone_file_range() is available... no
checking whether fops->dedupe_file_range() is available... no
checking whether file_operations_extend takes .copy_file_range() and .clone_file_range()... no
checking whether kmap_atomic wants 1 args... yes
checking whether follow_down_one() is available... yes
checking whether submit_bio is member of struct block_device_operations... yes
checking whether blk_alloc_disk() exists... yes
checking whether blk_cleanup_disk() exists... no
checking whether 6.3+ bdev_*_io_acct() are available... yes
checking whether kernel fpu is available... internal
checking whether kernel defines fmode_t... yes
checking whether kuid_t/kgid_t is available... yes
checking whether i_(uid|gid)_(read|write) exist... yes
checking whether iops->rename() takes struct mnt_idmap*... yes
checking whether current_time() exists... yes
checking whether ns_capable exists... yes
checking whether has_capability() is available... yes
checking whether cred_t->user_ns exists... yes
checking whether kuid_has_mapping/kgid_has_mapping exist... yes
checking whether in_compat_syscall() is available... yes
checking whether ktime_get_coarse_real_ts64() exists... yes
checking whether ktime_get_raw_ts64() exists... yes
checking whether totalram_pages() exists... yes
checking whether totalhigh_pages() exists... yes
checking whether kstrtoul() exists... yes
checking whether percpu_counter_init() wants gfp_t... yes
checking whether percpu_counter_add_batch() is defined... yes
checking whether is inside percpu_ref.data... yes
checking whether CPU hotplug APIs exist... yes
checking whether generic_fillattr requires struct mnt_idmap* and request_mask... checking whether generic_fillattr requires struct mnt_idmap*... yes
checking whether iops->mknod() takes struct mnt_idmap*... yes
checking whether iops->symlink() takes struct mnt_idmap*... yes
checking whether bio_max_segs() exists... yes
checking whether signal_stop() exists... yes
checking whether kernel_siginfo_t tyepedef exists... yes
checking whether struct kobj_type.default_groups exists... yes
checking whether set_special_state() exists... yes
checking whether standalone <linux/stdarg.h> exists... yes
checking whether folio_wait_bit() exists... yes
checking whether add_disk() returns int... yes
checking whether kthread_complete_and_exit() is available... yes
checking whether dequeue_signal() takes 4 arguments... yes
checking whether ZERO_PAGE() is GPL-only... no
checking whether __copy_from_user_inatomic is available... yes
checking whether user_namespace->ns.inum exists... yes
checking whether APIs for idmapped mount are present... yes
checking whether iattr->ia_vfsuid and iattr->ia_vfsgid exist... yes
checking whether filemap_range_has_page() is available... no
checking whether int (*writepage_t)() takes struct folio*... yes
checking whether struct reclaim_state has reclaimed field... yes
checking whether register_sysctl_table exists... no
checking whether copy_splice_read() exists... yes
checking whether fsync_bdev() exists... yes
checking os distribution... ubuntu
checking default package type... deb
checking default init directory... ${prefix}/etc/init.d
checking default shell... /bin/sh
checking default nfs server init script... nfs
checking default init config directory... /etc/default
checking whether initramfs-tools is available... yes
checking default bash completion directory... /usr/share/bash-completion/completions
checking whether rpm is available... yes (4.18.0)
checking whether rpmbuild is available... yes (4.18.0)
checking whether spec files are available... yes (rpm/generic/*.spec.in)
checking whether dpkg is available... yes (1.22.0)
checking whether dpkg-buildpackage is available... yes (1.22.0.)
checking whether alien is available... yes (8.95.6)
checking whether assertion support will be enabled... no
checking whether debuginfo support will be forced... no
checking whether basic kmem accounting is enabled... no
checking whether detailed kmem tracking is enabled... no
checking whether FreeBSD kernel INVARIANTS checks are enabled... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating contrib/debian/rules
config.status: creating contrib/debian/changelog
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating lib/libzfs/libzfs.pc
config.status: creating lib/libzfs_core/libzfs_core.pc
config.status: creating lib/libzfsbootenv/libzfsbootenv.pc
config.status: creating module/Kbuild
config.status: creating module/Makefile
config.status: creating rpm/generic/zfs-dkms.spec
config.status: creating rpm/generic/zfs-kmod.spec
config.status: creating rpm/generic/zfs.spec
config.status: creating rpm/redhat/zfs-dkms.spec
config.status: creating rpm/redhat/zfs-kmod.spec
config.status: creating rpm/redhat/zfs.spec
config.status: creating tests/zfs-tests/tests/Makefile
config.status: creating zfs.release
config.status: creating zfs_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
cp -r contrib/debian debian; chmod +x debian/rules;
cp contrib/debian/control debian/control; \
dpkg-buildpackage -b -rfakeroot -us -uc;
cp: cannot stat 'contrib/debian/control': No such file or directory
dpkg-buildpackage: error: cannot read debian/control: No such file or directory
make: *** [Makefile:14365: native-deb-utils] Error 255
Error while making native-deb-utils for zfs-2.2.1!
@FL140 FL140 added the Type: Defect Incorrect behavior (e.g. crash, hang) label Nov 27, 2023
@FL140
Copy link
Author

FL140 commented Nov 27, 2023

Small Update:
The same error occurs for v2.2.0.
In addition the file https://github.com/openzfs/zfs/releases/download/zfs-2.2.0/zfs-2.2.0.sha256.asc does not exist (is missing?).

@rincebrain
Copy link
Contributor

@tonyhutter seems to have not yet read the bug reports since 2.2.0 came out that his process for generating release tarballs is producing things that will never work on FreeBSD and fail to build the debs on Linux.

Cloning the git repo it should work better.

@luckylinux
Copy link

I managed to compile 2.2.1 a few days ago on one system (Tarball downloaded yesterday 2023-11-26 at 06h27 GMT).

Now I am running into the same issue as @FL140 with make native-deb-utils.

Tested on two separate Rock 5B SBC (same Software Versions though). They both fail today.

Attached is the buildinfo of the successfull build of yesterday, in case it could help somebody. Arch is AARCH64/ARM64 on Rock 5B SBC.

openzfs-linux_2.2.1-1_arm64.buildinfo.txt

I am not sure if in the meantime some of my toolchain/system tools got updated though. If you want a diff / apt show packages etc I can provide that as well. Just let me know.

@luckylinux
Copy link

That being said the tarball from yesterday seemed to uncompress to zfs-zfs-2.2.1 (weird !), while the one from today seemed to uncompress to zfs-2.2.1.

Seems like the tarball on the Release page got changed ...

@luckylinux
Copy link

luckylinux commented Nov 27, 2023

@FL140 : I just noticed when I installed yesterday I used
wget https://github.com/openzfs/zfs/archive/refs/tags/zfs-$version.tar.gz -O zfs-$version.tar.gz

While today I was using
wget https://github.com/openzfs/zfs/releases/download/zfs-$version/zfs-$version.tar.gz -O zfs-$version.tar.gz

Note that today still the first uncompresses to zfs-2.2.1 while the second uncompresses to zfs-zfs-2.2.1.

@rincebrain
Copy link
Contributor

https://github.com/openzfs/zfs/releases/download/zfs-2.2.1/zfs-2.2.1.tar.gz seems to untar to zfs-2.2.1/*, for me, while the first one produces zfs-zfs-2.2.1, I assume because it's projectname-tagname dynamically generated.

@luckylinux
Copy link

And in one case you need to run ./autogen.sh while in the other you don't. But even if you run autogen.sh it seems it's not creating the necessary configuration for Debian. ./configure works, make does as well, but buildpkg fails.

@luckylinux
Copy link

In case somebody wants to replicate, I'm trying with this right now.
You might not need to setup the requirements if you already have ...

#!/bin/bash
# Install Requirements
sudo apt --no-install-recommends install dkms
sudo apt install dh-dkms
sudo apt install aptitude libcurl4-openssl-dev libpam0g-dev lsb-release build-essential autoconf automake libtool 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 python3-sphinx
sudo apt install build-essential autoconf automake libtool gawk fakeroot 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 python3-sphinx

# Define Desired Version
version="2.2.1"

cd /usr/src
mkdir -p zfs
cd zfs
wget https://github.com/openzfs/zfs/archive/refs/tags/zfs-$version.tar.gz -O zfs-$version.tar.gz
#wget https://github.com/openzfs/zfs/releases/download/zfs-$version/zfs-$version.tar.gz -O zfs-$version.tar.gz
mkdir -p zfs-$version
#tar xvf zfs-$version.tar.gz
tar xvf zfs-$version.tar.gz -C zfs-$version --strip-components 1
cd zfs-$version

# Apply Patch in order to disable SIMD and Enable successfully ZFS Compile
wget https://raw.githubusercontent.com/chimera-linux/cports/master/main/zfs/patches/aarch64-disable-neon.patch -O aarch64-disable-neon.patch
patch -p1 < aarch64-disable-neon.patch

sh autogen.sh
./configure
make -s -j$(nproc)
make native-deb
make native-deb-utils native-deb-dkms

# Select Subset of Packages to prevent installation of default linux-image and linux-headers
cd ..
mkdir -p selected-packages
mkdir -p selected-packages/$version
cd selected-packages/$version/
mv ../../openzfs-libnvpair3_$version*.deb ./
mv ../../openzfs-libpam-zfs_$version*.deb ./
mv ../../openzfs-libuutil3_$version*.deb ./
mv ../../openzfs-libzfs4_$version*.deb ./
mv ../../openzfs-libzpool5_$version*.deb ./
mv ../../openzfs-zfs-dkms_$version*.deb ./
mv ../../openzfs-zfs-initramfs_$version*.deb ./
mv ../../openzfs-zfs-modules-*_$version*.deb ./
mv ../../openzfs-zfs-zed_$version*.deb ./
mv ../../openzfs-zfsutils_$version*.deb ./


sudo apt install --fix-missing ./*.deb

@rincebrain
Copy link
Contributor

Trying to make both native deb packages at once breaks, would be my guess about what's breaking for you there.

@luckylinux
Copy link

luckylinux commented Nov 27, 2023

Yeah keep in mind I was playing around a lot, so I kinda wrote them inside a script. But it doesn't meant it 100% works. It's more to remember what I did

native-deb-dkms I don't think it's valid anymore either

@luckylinux
Copy link

luckylinux commented Nov 27, 2023

I managed to compile on one of the systems, the other one failed without very clear message.

On the system where it compiled successfully one warning was generated though

debconf: Unknown template field '_description', in stanza #1 of /var/lib/dpkg/info/openzfs-zfs-dkms.templates

debconf: Unknown template field '_description', in stanza #2 of /var/lib/dpkg/info/openzfs-zfs-dkms.templates

debconf: Unknown template field '_description', in stanza #3 of /var/lib/dpkg/info/openzfs-zfs-dkms.templates

The exact commands used were (just to make sure I didn't update anything since last time)

#!/bin/bash
# Install Requirements
sudo apt --no-install-recommends install dkms
sudo apt install dh-dkms
sudo apt install aptitude libcurl4-openssl-dev libpam0g-dev lsb-release build-essential autoconf automake libtool 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 python3-sphinx
sudo apt install build-essential autoconf automake libtool gawk fakeroot 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 python3-sphinx

# Define Desired Version
version="2.2.1"

cd /usr/src
mkdir -p zfs
cd zfs
wget https://github.com/openzfs/zfs/archive/refs/tags/zfs-$version.tar.gz -O zfs-$version.tar.gz
#wget https://github.com/openzfs/zfs/releases/download/zfs-$version/zfs-$version.tar.gz -O zfs-$version.tar.gz
mkdir -p zfs-$version
#tar xvf zfs-$version.tar.gz
tar xvf zfs-$version.tar.gz -C zfs-$version --strip-components 1
cd zfs-$version

# Apply Patch in order to disable SIMD and Enable successfully ZFS Compile
wget https://raw.githubusercontent.com/chimera-linux/cports/master/main/zfs/patches/aarch64-disable-neon.patch -O aarch64-disable-neon.patch
patch -p1 < aarch64-disable-neon.patch

sh autogen.sh
./configure
make -s -j$(nproc)
make native-deb
make native-deb-utils native-deb-dkms

# Select Subset of Packages to prevent installation of default linux-image and linux-headers
cd ..
mkdir -p selected-packages
mkdir -p selected-packages/$version
cd selected-packages/$version/
mv ../../openzfs-libnvpair3_$version*.deb ./
mv ../../openzfs-libpam-zfs_$version*.deb ./
mv ../../openzfs-libuutil3_$version*.deb ./
mv ../../openzfs-libzfs4_$version*.deb ./
mv ../../openzfs-libzpool5_$version*.deb ./
mv ../../openzfs-zfs-dkms_$version*.deb ./
mv ../../openzfs-zfs-initramfs_$version*.deb ./
#mv ../../openzfs-zfs-modules-*_$version*.deb ./
mv ../../openzfs-zfs-zed_$version*.deb ./
mv ../../openzfs-zfsutils_$version*.deb ./


sudo apt install --fix-missing ./*.deb

@luckylinux
Copy link

On another note, is it possible to omit the "openzfs" prefix when building deb packages ? So that the name would be the same as the "standard" e.g. zfs-dkms package as in APT Repository ?

I had a brief look at autogen.sh, configure & Makefile files, but didn't see any obvious "prefix" directive.

@rincebrain
Copy link
Contributor

The entire point is to make them separate so that you can clearly say "you cannot mix and match these" and not have to worry about people's version numbers overlapping.

@luckylinux
Copy link

So it's a "feature" not a "bug", alright, I guess I can live with that

@FL140
Copy link
Author

FL140 commented Nov 27, 2023

After a bit of sleep and reinvestigating again it turns out the source of the problem is exact the same as in #15404

But marking it as a pure duplicate is probably not the best thing as the the two scripts provided here will provide a way to compile the package for Ubuntu 22.10 (hopefully). I will merge the new information from the issue above and provide an update.

@FL140
Copy link
Author

FL140 commented Nov 27, 2023

@luckylinux I will try to merge our scripts to make it more generic.

And I think we should switch over to the git clone approach instead of the release tar.gz since those are broken (at least for 2.2.0 and 2.2.1) and no one needs them in this state.

Just a small hint, you should prefere apt-get over apt in scripts as per recommendation.

@luckylinux
Copy link

@FL140 actually I thought that apt-get like apt-cache was getting deprecated in favor of simply apt.

I many script (besides this one) I actually use aptitude.

I just saw today that apt is not really recommended in scripts. Duh.

Also sometimes apt and aptitude yield different dependencoes resolution...

@FL140
Copy link
Author

FL140 commented Nov 27, 2023

@FL140 actually I thought that apt-get like apt-cache was getting deprecated in favor of simply apt.

I many script (besides this one) I actually use aptitude.

I just saw today that apt is not really recommended in scripts. Duh.

Also sometimes apt and aptitude yield different dependencoes resolution...

I also got recently bite by that, that's why I wrote the comment here in the first place. I also prefer aptitude for daily work, but it is not the default package manager, apt (in the apt-get variant) is and therefor the reference to use in scripts over aptitude, apt and aptitude AKAIK don't work on the same database, I ran into this when I set holds for some packages with apt which got removed when running aptitude the next time. Apart from that problem the recommendation was to use apt-get (which uses the apt database AFAIK) because it "has a stable user interface made for scripting compared to apt".

@AllKind AllKind mentioned this issue Nov 29, 2023
13 tasks
@FL140
Copy link
Author

FL140 commented Dec 1, 2023

The following script builds an Ubuntu package for 2.2.2 from tonyhutter and will be updated to the official branch after the official 2.2.2 release.

Note: currently the script exits prior the deb package installation because either dracut or initramfs is used, act according to your setup.

#!/bin/bash
# Ubuntu OpenZFS DKMS Kernel Module Install Script

typeset -r OPENZFS_VERSION=${1:-2.2.2}
typeset -r TMP_DIR="/tmp"
typeset -r BUILD_JOBS=$(( $(nproc) / 2 ))   # use half of what we have for building

# Installed required packages (Debian, Ubuntu)
# Note:
# TBD: hmm, I don't think we need package(s) alien and related packages any longer for versions >= v2.2.
sudo apt-get install -y build-essential autoconf automake libtool gawk \
        fakeroot 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 debhelper-compat dh-python po-debconf \
        python3-all-dev python3-sphinx \
        git libcurl4-openssl-dev libpam0g-dev \
        dkms dh-dkms

# Create working directory
[ -d "${TMP_DIR}/zfs-${OPENZFS_VERSION}" ] && { rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"; }    # !! use a fixed sting in rm -rf!
install -d -m 0770 -o root -g root "${TMP_DIR}/zfs-${OPENZFS_VERSION}"
pushd "${TMP_DIR}/zfs-${OPENZFS_VERSION}" > /dev/null || { echo "Error while pushd directory \"${TMP_DIR}/zfs-${OPENZFS_VERSION}\"!"; exit 2; }

## Get Source Code (Released Tarball)  # deprecated, .tar.gz release file is broken
## Note:
## The download location given in the instructions does not exist, get the tar package directly from GitHub.
##wget http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-${OPENZFS_VERSION}.tar.gz
#wget https://github.com/openzfs/zfs/releases/download/zfs-${OPENZFS_VERSION}/zfs-${OPENZFS_VERSION}.tar.gz
#wget https://github.com/openzfs/zfs/releases/download/zfs-${OPENZFS_VERSION}/zfs-${OPENZFS_VERSION}.sha256.asc
#sha256sum --check zfs-${OPENZFS_VERSION}.sha256.asc || { echo "Error checksum(s) for zfs-${OPENZFS_VERSION} does not match!"; exit 3; }
#gpg --verify zfs-${OPENZFS_VERSION}.sha256.asc zfs-${OPENZFS_VERSION}.tar.gz    # TBD add error handling
#tar -xzf zfs-${OPENZFS_VERSION}.tar.gz

# Get Source Code (GitHub)
# TBD FIXME git clone --branch zfs-${OPENZFS_VERSION} https://github.com/openzfs/zfs zfs-${OPENZFS_VERSION} || { echo "Error cloning zfs-${OPENZFS_VERSION} from GitHub!"; exit 3; }
git clone --branch zfs-${OPENZFS_VERSION}-hutter https://github.com/tonyhutter/zfs zfs-${OPENZFS_VERSION} || { echo "Error cloning zfs-${OPENZFS_VERSION} from GitHub!"; exit 3; }
cd zfs-${OPENZFS_VERSION}

# Get Patches (optional)
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/OpenZFS%20Patches.html#openzfs-patches
#
# The following and 5 other patches, but all of those are finally added to the 
# zfs-2.2.2 branch of tonyhutter waiting to be merged into openzfs/zfs-2.2.2
# as of 01.12.2023
# => so we use tonyhutter/zfs-2.2.2 branch for now
#
# Notes:
# * If commented out, the following commits are already included into 2.2.2.

## Revert "Tune zio buffer caches and their alignments"
## https://github.com/openzfs/zfs/commit/89fcb8c6f969cbfa237849d9b33610124d361186
## fixes: CKSUM and WRITE errors with 2.2.1 stable, when vdevs are atop LUKS #15533
## https://github.com/openzfs/zfs/issues/15533
# git cherry-pick 89fcb8c6f969cbfa237849d9b33610124d361186

## dnode_is_dirty: check dnode and its data for dirtiness #15571
## https://github.com/openzfs/zfs/commit/9b9b09f452a469458451c221debfbab944e7f081 
## fixes: some copied files are corrupted (chunks replaced by zeros) #15526
# git cherry-pick 9b9b09f452a469458451c221debfbab944e7f081

## brt: lift internal definitions into _impl header 
## https://github.com/openzfs/zfs/commit/803a9c12c911b240f1bb20ac9b542349d49bea3b
#git cherry-pick 803a9c12c911b240f1bb20ac9b542349d49bea3b

## zdb: show BRT statistics and dump its contents
## https://github.com/openzfs/zfs/commit/213d6829673ce28095f7c15b8fb65e1ade91d20a
#git cherry-pick 213d6829673ce28095f7c15b8fb65e1ade91d20a

## dmu_buf_will_clone: fix race in transition back to NOFILL
## https://github.com/openzfs/zfs/commit/2a953e0ac928563166ad7caa89e48b8d257724d4 
## closes: dmu_buf_will_clone: fix race in transition back to NOFILL #15566 
## closes: some copied files are corrupted (chunks replaced by zeros) #15526 
#git cherry-pick 2a953e0ac928563166ad7caa89e48b8d257724d4

## openzfs/zfs: zfs-dkms: fix shell-init error message 
## https://github.com/openzfs/zfs/commit/95b68eb693ba5b4785b260d592d8b5094f4c9576
#git cherry-pick 95b68eb693ba5b4785b260d592d8b5094f4c9576

## ZTS: Fix zfs_load-key failures on F39
## https://github.com/openzfs/zfs/commit/3551a32e5ed6c79cad192f66f5faf3d4aae8c682
#git cherry-pick 3551a32e5ed6c79cad192f66f5faf3d4aae8c682

# Build OpenZFS native deb packages
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/Building%20ZFS.html
#
# Notes:
# * Starting from openzfs-2.2 release, native deb-based DKMS and user packages can be built.
#   => We are compiling for => v2.2.1 so this is the way to go.
# * make native-deb builds native-deb-kmod and native-deb-utils.
# * Native Debian packages build with pre-configured paths for Debian and Ubuntu. 
#   It’s best not to override the paths during configure.
# * KVERS, KSRC and KOBJ environment variables can be exported 
#   to specify the kernel installed in non-default location.
./autogen.sh || { echo "Error during autgen.sh for zfs-${OPENZFS_VERSION} package build!"; exit 4; }
./configure || { echo "Error while configuring zfs-${OPENZFS_VERSION} package build!"; exit 5; }
make -s -j${BUILD_JOBS}
# Build the userland utilities and the DKMS package 
# Note:
# If kernel modules are to be installed via DKMS package, this target should be sufficient. 
make native-deb-utils || { echo "Error while making native-deb-utils for zfs-${OPENZFS_VERSION}!"; exit 6; }
# Build the kernel modules and package the binaries
# TBD FIXME hmm, KVERS is not enough, what to set for KSRC and KOBJ!?
#export KVERS=6.5.0-13-generic
#export KSRC=/usr/src/linux-headers-6.5.0-13-generic    # hmm, looks like that doesn't work or is not enough
#export KOBJ=TBD what to set here?
# => Let's skip kmod generation for now and use dkms.
#make native-deb-kmod || { echo "Error while making native-deb-kmod for zfs-${OPENZFS_VERSION}!"; exit 7; }

# Install OpenZFS native deb packages
# TBD FIXME, hmm, installing everything doesn't make any sense at all
# * Install either openzfs-zfs-initramfs or openzfs-zfs-dracut
# * Install either openzfs-zfs-dkms or openzfs-zfs-modules-* 
exit 99
sudo apt-get install --fix-missing ../*.deb

# Clean Up
popd > /dev/null || { echo "Error while popd directory!"; exit 2; }
rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"    # !! use a fixed sting in rm -rf!
exit 0

@luckylinux
Copy link

Apparently 2.2.2 is released, but if I got (using my script) using git clone approach

# Use git and clone zfs-$version tag
git clone https://github.com/openzfs/zfs.git --depth 1 --tag zfs-$version

Then it compiles to 2.2.99 for some reason

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

@luckylinux please be careful with 2.2.2 and/or the above script for now! I ran into a bad pool crash and currently can't say where it comes from! see:
#15602 (comment)

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

Apparently 2.2.2 is released, but if I got (using my script) using git clone approach

# Use git and clone zfs-$version tag
git clone https://github.com/openzfs/zfs.git --depth 1 --tag zfs-$version

Then it compiles to 2.2.99 for some reason

Well you can try my script from above, it is mostly comments to keep track of what has been changed and why. You only need to comment out the git clone command cloning from tonyhutter and enable the line above from the official repo.

The script currently exits prior the actual deb package install because the packages depend on if you use dracut or initramfs. Just move the one you don't need out of the way.
The kmod package is not built currently in favor of dkms because I was not able to set the correct parameters for KVERS and friends as you can see from the comments in the script. And dkms also works on kernel updates from Ubuntu without regenerating a kernel module package.

Apart from a few _Description errors during install, which just seem to be the leading _ as a problem, the packages build and install fine.

@luckylinux
Copy link

Well with my script & initramfs it just finished installing the packages - at which point I saw your comment about the pool crash -_-.

@luckylinux
Copy link

My updated script for ZFS 2.2.2 and AMD64 with apt-get instead of apt (thanks again !)

#!/bin/bash
# Install Requirements
sudo apt-get --no-install-recommends install dkms
sudo apt-get install dh-dkms
sudo apt-get install aptitude libcurl4-openssl-dev libpam0g-dev lsb-release build-essential autoconf automake libtool 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 python3-sphinx
sudo apt-get install build-essential autoconf automake libtool gawk fakeroot 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 python3-sphinx
sudo apt-get install linux-headers-generic

# Define Desired Version
version="2.2.2"

cd /usr/src
mkdir -p zfs
cd zfs

# Save basedir
basedir=$(pwd)

# Use git and clone zfs-$version tag
#git clone https://github.com/openzfs/zfs.git --depth 1 --tag zfs-$version
#
# Use tar (working)
wget https://github.com/openzfs/zfs/archive/refs/tags/zfs-$version.tar.gz -O zfs-$version.tar.gz
mkdir -p zfs-$version
tar xvf zfs-$version.tar.gz -C zfs-$version --strip-components 1
#
# Use tar (currently broken archive)
#wget https://github.com/openzfs/zfs/releases/download/zfs-$version/zfs-$version.tar.gz -O zfs-$version.tar.gz
#tar xvf zfs-$version.tar.gz

# Change working direectory
cd zfs-$version

# Apply Patch in order to disable SIMD and Enable successfully ZFS Compile
#wget https://raw.githubusercontent.com/chimera-linux/cports/master/main/zfs/patches/aarch64-disable-neon.patch -O aarch64-disable-neon.patch
#patch -p1 < aarch64-disable-neon.patch

sh autogen.sh
./configure
make -s -j$(nproc)
make native-deb
make native-deb-utils native-deb-dkms

# Select Subset of Packages to prevent installation of default linux-image and linux-headers
cd $basedir
mkdir -p selected-packages
mkdir -p selected-packages/$version
cd selected-packages/$version/
mv ../../openzfs-libnvpair3_$version*.deb ./
mv ../../openzfs-libpam-zfs_$version*.deb ./
mv ../../openzfs-libuutil3_$version*.deb ./
mv ../../openzfs-libzfs4_$version*.deb ./
mv ../../openzfs-libzpool5_$version*.deb ./
mv ../../openzfs-zfs-dkms_$version*.deb ./
mv ../../openzfs-zfs-initramfs_$version*.deb ./
mv ../../openzfs-zfs-zed_$version*.deb ./
mv ../../openzfs-zfsutils_$version*.deb ./


sudo apt-get install --fix-missing ./*.deb

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

Well with my script & initramfs it just finished installing the packages - at which point I saw your comment about the pool crash -_-.

Sorry, we are writing in parallel and I am currently very tired and therefor, slow.... ;-(

BUT the panic occured during running of the block clone info script.

I booted again and I am running on 2.2.2 here since that (1-2h) without any complaints AFAIK.

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

OK, so apart from a few debug error messages I can't recall from the tonyhutter branch

dddc79cd349d97015a876ecf521da792b8ee7b51
c235ba91328ae18f2793b6b07e5d4cf17cce50f5
0629eb8462b7c8b74df095afd9fc326a34f27302
f5ece938dc6a5ed57904c7857c257d22038c0c3a
debugedit: debian/openzfs-libzfs4/lib/x86_64-linux-gnu/libzfs.so.4.1.0: Unknown DWARF DW_FORM_0x1f21
21ed593e6a37824ba0d07cc409a1a1d39d5554f5
94ba0342db297363d3ec91bf13f6cb85ec88677b
debugedit: debian/openzfs-zfsutils/usr/lib/zfs-linux/zpool_influxdb: Unknown DWARF DW_FORM_0x1f21
dc1b0725c000418a218591240f8b2d301f122750
debugedit: debian/openzfs-zfs-test/usr/share/zfs/zfs-tests/bin/zfs_diff-socket: Unknown DWARF DW_FORM_0x1f20
debugedit: debian/openzfs-zfsutils/sbin/zpool: Unknown DWARF DW_FORM_0x1f21
9da6e608a68ca0e87462a985635bbae9a4a8856f
6e2efaea2933723ece6405b7edb3369c701af1b7
04b1b99f5ef0d9551d14b0ad049f163bf16d6735
...

The building of the deb packages went just fine.
Installing and rebootin now...

@luckylinux
Copy link

I'm also tempted to try with the newly built ZFS 2.2.2 - wish me luck :D

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

I already built ZFS 2.2.2 and it installed without complaints. Re-generated DKMS modules and re-generated initramfs.

Same here official 2.2.2 compiles and installed fine (using dracut with a custom EFI setup and NOT the official GRUB / initramfs combo).

Reboot was uneventful and system is up and running so far, I just don't dare to run the block clone info script for now. ;-)

@luckylinux
Copy link

Well that's promising. But I'm starting to get more and more disappointed that a file system that proud itself for preventing data corruption now (and not for the first time) is causing data corruption after an update.

Bugs seems to cause more data corruption than bad ram / disks / cables it seems

@rincebrain
Copy link
Contributor

I'm not really sure where you're getting the idea that the update is causing more corruption, and not that the existing issue on disk is causing a panic when you try to read it later. It's hard to guess without the actual crash message, but that would be my bet.

Also, zdb doesn't touch the running kernel, so if something is causing the running kernel to panic, it's not directly zdb. It might be that the script is walking the filesystem and hitting metadata that's munged, or something, but zdb itself can't mangle your bits.

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

Well that's promising. But I'm starting to get more and more disappointed that a file system that proud itself for preventing data corruption now (and not for the first time) is causing data corruption after an update.

Bugs seems to cause more data corruption than bad ram / disks / cables it seems

Well TBH I also had to hold my temper over the last two weeks sometimes, but at the end everyone is just trying to get over with the damage done. To be fair the underlying bug is time critical and those are very hard to find if you don't know what you are looking for. Over the last decades of unsing file systems I ran into a bunch of very unpleasant things with different file systems (ntfs, xfs, extN,...) so nothing is perfect. But I have to admit the amount of bugs that manifested over the last two weeks where a lot and I wonder if more in depth (heavy parallel load!) testing would have saved us from what we are all in now.
My problem is that everyday when I think now we have all that data corruption crap fixed another thing pops up and ruins the day. I really hope this has an end soon and I will be able to fix my effected pools.

@0x5c
Copy link

0x5c commented Dec 1, 2023

It might be that the script is walking the filesystem and hitting metadata that's munged, or something, but zdb itself can't mangle your bits.

Yeah, seeing the output in the other issue it's either crashing when walking the filesystem or when trying to find the path/filename of a specific object.

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

I'm not really sure where you're getting the idea that the update is causing more corruption, and not that the existing issue on disk is causing a panic when you try to read it later. It's hard to guess without the actual crash message, but that would be my bet.

Also, zdb doesn't touch the running kernel, so if something is causing the running kernel to panic, it's not directly zdb. It might be that the script is walking the filesystem and hitting metadata that's munged, or something, but zdb itself can't mangle your bits.

I also think, the pool panic came from the data that got corrupted between 2.2.0 and 2.2.1 but I need to investigate as already written. The "panic" was related to the pool not the kernel. So while the machine crashed, I expect that happened because the root pool was put in panic mode. And not due to a kernel crash, but I also have to investigate that further. But after 16h into this I need a break.

@luckylinux
Copy link

Well that's promising. But I'm starting to get more and more disappointed that a file system that proud itself for preventing data corruption now (and not for the first time) is causing data corruption after an update.
Bugs seems to cause more data corruption than bad ram / disks / cables it seems

Well TBH I also had to hold my temper over the last two weeks sometimes, but at the end everyone is just trying to get over with the damage done. To be fair the underlying bug is time critical and those are very hard to find if you don't know what you are looking for. Over the last decades of unsing file systems I ran into a bunch of very unpleasant things with different file systems (ntfs, xfs, extN,...) so nothing is perfect. But I have to admit the amount of bugs that manifested over the last two weeks where a lot and I wonder if more in depth (heavy parallel load!) testing would have saved us from what we are all in now. My problem is that everyday when I think now we have all that data corruption crap fixed another thing pops up and ruins the day. I really hope this has an end soon and I will be able to fix my effected pools.

I am thankful I wasn't hit yet (knock on wood)...
But if we cannot trust zfs copy on write mechanism, we cannot trust our backups to be made in and with zfs and sent over to a remove host (zfs snapshot, zfs send/receive), I am not sure what we can trust.

Yesterday I once again got stuck with podman / docker because of ACLs permission working weirdly with zfs. Then programs left hanging and only solution is to reboot once every 10 minutes.

I don't know... It just feels like everything keep breaking.

You should always update for security and vulnerabilities reasons, but if every time stuff breaks 🙄

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

I am thankful I wasn't hit yet (knock on wood)... But if we cannot trust zfs copy on write mechanism, we cannot trust our backups to be made in and with zfs and sent over to a remove host (zfs snapshot, zfs send/receive), I am not sure what we can trust.

Well that is my biggest taking after the last two weeks that all my remote backups are also in danger, which is the worst case scenario. /* paranoid mode on / So in the future I think I will additionally make backups with and rsync script (as prior zfs) to a remote site with having the backup on a different filesystem. Just in case everything blows up at once. / paranoid mode off */

@rincebrain
Copy link
Contributor

You should always update for security and vulnerabilities reasons, but if every time stuff breaks 🙄

No, you should wait a little while and see what breaks, unless it fixes something that you need in your environment, and either way, test it somewhere less important before updating the important things.

I'm not saying people don't try to make things reliable to the best of their ability, but there are reasons I advise people to not install the latest and greatest immediately on things where any breakage could be bad. By definition, any amount of testing is going to be less than "everyone running it on all their varied systems" for anything popular enough, and no matter how well you test it, your tests are only as good as how varied the places you run them are.

If it's not broke, don't fix it.

(None of the above is specific to ZFS in any way - just, you know, the lower your tolerance for risk, the more cautious you need to be.)

@luckylinux
Copy link

You should always update for security and vulnerabilities reasons, but if every time stuff breaks 🙄

No, you should wait a little while and see what breaks, unless it fixes something that you need in your environment, and either way, test it somewhere less important before updating the important things.

I'm not saying people don't try to make things reliable to the best of their ability, but there are reasons I advise people to not install the latest and greatest immediately on things where any breakage could be bad. By definition, any amount of testing is going to be less than "everyone running it on all their varied systems" for anything popular enough, and no matter how well you test it, your tests are only as good as how varied the places you run them are.

If it's not broke, don't fix it.

(None of the above is specific to ZFS in any way - just, you know, the lower your tolerance for risk, the more cautious you need to be.)

I agree to some extent to the "if it isn't broken, don't fix it" approach.

I am usually not that scared of updating Debian for instance. Track record is good so far (knock on wood).

Ever since Ubuntu managed to self-uninstall of system tools during a distro upgrade I have become vary and skeptical of it.

But ZFS I used to have more confidence.

Sometimes upgrade is required. But then you have to upgrade kernel. But zfs is not supported natively. Then you need to manually compile zfs. And so on and so forth. Then I have to upgrade podman, but I also need all of the other tools etc.

I am usually quite happy with the distro shipped version of zfs. Except this buggy one on Ubuntu which is still a development version nonetheless 🙄.

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

I am usually quite happy with the distro shipped version of zfs. Except this buggy one on Ubuntu which is still a development version nonetheless 🙄.

That is exactly the problem for users of Ubuntu. And what is really unacceptable IMHO is how all of the last two weeks is just ignored by Ubuntu. The know of it because 2.2.1 is there for nobel, but still no hotfix 2.2.1 for mantic. I am not even starting to talk about 2.2.2.

So while the testing with the 2.2.2 patches suggest that the "block cloning" bug is very rare in real life for everything prior 2.2.1 and fixed in 2.2.2. I at least can confirm serious problems (pool panic) with a real world notebook, non heavy used and Ubuntu 23.10 after Upgrade to 23.10 (2.2.0 rc3? IIRC, as shipped with Mantic).

It is still too early to tell what really is the exact problem, but 2.2.0 was the cause for 99% (the pool gets regular scrubs at least once a month and the pool panic is caused by accessing BRT information with resulting system freeze) and since "we just don't know yet" and need to look further into this, just ignoring those Updates, is not a smart move, to put it mildly, by Ubuntu.

So since I have hard evidence now, I am going to fill a bug report with Ubuntu, but I just can hope this one gets taken more seriously finally by Ubuntu.

@0x5c
Copy link

0x5c commented Dec 1, 2023

and the pool panic is caused by accessing BRT information with resulting system freeze

It is not, since the crash you're seeing happens in a different command that dumps the list of all blocks* without any BRT-related information

*rather, it dumps the whole list of all objects which includes all blocks but none of the information from the BRT

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

and the pool panic is caused by accessing BRT information with resulting system freeze

It is not, since the crash you're seeing happens in a different command that dumps the list of all blocks* without any BRT-related information

*rather, it dumps the whole list of all objects which includes all blocks but none of the information from the BRT

@0x5c Sorry looks like I am not so deep into this to see that on first glance, but fact is that this simple script triggers a pool panic and a following system freeze. All on a notebook running stock Ubuntu 23.10 (fast installed 2.2.1 and now with 2.2.2) which was scrubed on a regular base without prior errors. For sure this was OK prior updrade from 23.04 to 23.10. This is good enough for me to take that all very seriously.

So any help on nailing this down is highly appreciated!

@luckylinux
Copy link

@0x5c if you can help me getting the script to work with my system, I can try to see if I can replicate @FL140 before I reboot. I'm kinda afraid of rebooting as it is now given what @FL140 experienced.

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

@0x5c if you can help me getting the script to work with my system, I can try to see if I can replicate @FL140 before I reboot. I'm kinda afraid of rebooting as it is now given what @FL140 experienced.

@luckylinux after having some sleep and having I deeper look into the zdb man page I should be now up dot date. So what is your problem and with what do you need help?

@FL140
Copy link
Author

FL140 commented Dec 1, 2023

Cleaned up script for building the deb packages:

#!/bin/bash
# Ubuntu OpenZFS DKMS Kernel Module Install Script

typeset -r OPENZFS_VERSION=${1:-2.2.2}
typeset -r BOOT_TOOL=${2:-"initramfs"}  # initramfs is the default on Ubuntu
#typeset    BOOT_TOOL=${2:-"dracut"}
typeset -r TMP_DIR="/tmp"
typeset -r BUILD_JOBS=$(( $(nproc) / 2 ))   # use half of what we have for building

if [[ ! "${BOOT_TOOL}" =~ ^initramfs|dracut$ ]]; then
    echo "Invalid boot tool \"${BOOT_TOOL}\" [initramfs|dracut] parameter!"
    exit 1
fi

# Installed required packages (Debian, Ubuntu)
# Note:
# TBD: hmm, I don't think we need package(s) alien and related packages any longer for versions >= v2.2.
sudo apt-get install -y build-essential autoconf automake libtool gawk \
        fakeroot 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 debhelper-compat dh-python po-debconf \
        python3-all-dev python3-sphinx \
        git libcurl4-openssl-dev libpam0g-dev \
        dkms dh-dkms

# Create working directory
[ -d "${TMP_DIR}/zfs-${OPENZFS_VERSION}" ] && { rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"; }    # !! use a fixed sting in rm -rf!
install -d -m 0770 -o root -g root "${TMP_DIR}/zfs-${OPENZFS_VERSION}"
pushd "${TMP_DIR}/zfs-${OPENZFS_VERSION}" > /dev/null || { echo "Error while pushd directory \"${TMP_DIR}/zfs-${OPENZFS_VERSION}\"!"; exit 2; }

# Get Source Code (GitHub)
git clone --branch zfs-${OPENZFS_VERSION} https://github.com/openzfs/zfs zfs-${OPENZFS_VERSION} || { echo "Error cloning zfs-${OPENZFS_VERSION} from GitHub!"; exit 3; }
cd zfs-${OPENZFS_VERSION}

# Get Patches (optional)
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/OpenZFS%20Patches.html#openzfs-patches
#
# Official zfs-2.2.2 just (01.12.2023) released use it, no new patches yet.
#
# Notes:
# * If commented out, the following commits are already included into 2.2.2.

## dnode_is_dirty: check dnode and its data for dirtiness #15571
## https://github.com/openzfs/zfs/commit/9b9b09f452a469458451c221debfbab944e7f081 
## fixes: some copied files are corrupted (chunks replaced by zeros) #15526
# git cherry-pick 9b9b09f452a469458451c221debfbab944e7f081

# Build OpenZFS native deb packages
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/Building%20ZFS.html
#
# Notes:
# * Starting from openzfs-2.2 release, native deb-based DKMS and user packages can be built.
#   => We are compiling for => v2.2.1 so this is the way to go.
# * make native-deb builds native-deb-kmod and native-deb-utils.
# * Native Debian packages build with pre-configured paths for Debian and Ubuntu. 
#   It’s best not to override the paths during configure.
# * KVERS, KSRC and KOBJ environment variables can be exported 
#   to specify the kernel installed in non-default location.
./autogen.sh || { echo "Error during autgen.sh for zfs-${OPENZFS_VERSION} package build!"; exit 4; }
./configure || { echo "Error while configuring zfs-${OPENZFS_VERSION} package build!"; exit 5; }
make -s -j${BUILD_JOBS}
# Build the userland utilities and the DKMS package 
# Note:
# If kernel modules are to be installed via DKMS package, this target should be sufficient. 
make native-deb-utils || { echo "Error while making native-deb-utils for zfs-${OPENZFS_VERSION}!"; exit 6; }
popd > /dev/null || { echo "Error while popd directory!"; exit 2; }

# Install OpenZFS native deb packages
# Note:
# * Install either openzfs-zfs-initramfs or openzfs-zfs-dracut
# * Install either openzfs-zfs-dkms or openzfs-zfs-modules-*
#   => dkms is more flexible so use it as default.
sudo apt-get install --fix-missing -y \
./openzfs-lib*_${OPENZFS_VERSION}*.deb \
./openzfs-py*_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-dkms_${OPENZFS_VERSION}*.deb \
./openzfs-zfsutils_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-zed_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-test_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-${BOOT_TOOL}_${OPENZFS_VERSION}*.deb

# Clean Up
rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"    # !! use a fixed sting in rm -rf!
exit 0

The script builds 2.2.2 with initramfs in default mode. But you can provide the version to build and the build tool (either initramfs or dracut).

The script was tested sucessfully on Ubuntu 23.10 running a personalized dracut based boot process using UKI. (Which shouldn't matter for you, initramfs is just not tested.)

@luckylinux
Copy link

@0x5c if you can help me getting the script to work with my system, I can try to see if I can replicate @FL140 before I reboot. I'm kinda afraid of rebooting as it is now given what @FL140 experienced.

@luckylinux after having some sleep and having I deeper look into the zdb man page I should be now up dot date. So what is your problem and with what do you need help?

I described it in the other thread actually #15404 (comment)

But TLDR is I cannot get the zdb script to work and list the corrupted blocks (if any).

@luckylinux
Copy link

Cleaned up script for building the deb packages:

#!/bin/bash
# Ubuntu OpenZFS DKMS Kernel Module Install Script

typeset -r OPENZFS_VERSION=${1:-2.2.2}
typeset -r BOOT_TOOL=${2:-"initramfs"}  # initramfs is the default on Ubuntu
#typeset    BOOT_TOOL=${2:-"dracut"}
typeset -r TMP_DIR="/tmp"
typeset -r BUILD_JOBS=$(( $(nproc) / 2 ))   # use half of what we have for building

if [[ ! "${BOOT_TOOL}" =~ ^initramfs|dracut$ ]]; then
    echo "Invalid boot tool \"${BOOT_TOOL}\" [initramfs|dracut] parameter!"
    exit 1
fi

# Installed required packages (Debian, Ubuntu)
# Note:
# TBD: hmm, I don't think we need package(s) alien and related packages any longer for versions >= v2.2.
sudo apt-get install -y build-essential autoconf automake libtool gawk \
        fakeroot 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 debhelper-compat dh-python po-debconf \
        python3-all-dev python3-sphinx \
        git libcurl4-openssl-dev libpam0g-dev \
        dkms dh-dkms

# Create working directory
[ -d "${TMP_DIR}/zfs-${OPENZFS_VERSION}" ] && { rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"; }    # !! use a fixed sting in rm -rf!
install -d -m 0770 -o root -g root "${TMP_DIR}/zfs-${OPENZFS_VERSION}"
pushd "${TMP_DIR}/zfs-${OPENZFS_VERSION}" > /dev/null || { echo "Error while pushd directory \"${TMP_DIR}/zfs-${OPENZFS_VERSION}\"!"; exit 2; }

# Get Source Code (GitHub)
git clone --branch zfs-${OPENZFS_VERSION} https://github.com/openzfs/zfs zfs-${OPENZFS_VERSION} || { echo "Error cloning zfs-${OPENZFS_VERSION} from GitHub!"; exit 3; }
cd zfs-${OPENZFS_VERSION}

# Get Patches (optional)
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/OpenZFS%20Patches.html#openzfs-patches
#
# Official zfs-2.2.2 just (01.12.2023) released use it, no new patches yet.
#
# Notes:
# * If commented out, the following commits are already included into 2.2.2.

## dnode_is_dirty: check dnode and its data for dirtiness #15571
## https://github.com/openzfs/zfs/commit/9b9b09f452a469458451c221debfbab944e7f081 
## fixes: some copied files are corrupted (chunks replaced by zeros) #15526
# git cherry-pick 9b9b09f452a469458451c221debfbab944e7f081

# Build OpenZFS native deb packages
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/Building%20ZFS.html
#
# Notes:
# * Starting from openzfs-2.2 release, native deb-based DKMS and user packages can be built.
#   => We are compiling for => v2.2.1 so this is the way to go.
# * make native-deb builds native-deb-kmod and native-deb-utils.
# * Native Debian packages build with pre-configured paths for Debian and Ubuntu. 
#   It’s best not to override the paths during configure.
# * KVERS, KSRC and KOBJ environment variables can be exported 
#   to specify the kernel installed in non-default location.
./autogen.sh || { echo "Error during autgen.sh for zfs-${OPENZFS_VERSION} package build!"; exit 4; }
./configure || { echo "Error while configuring zfs-${OPENZFS_VERSION} package build!"; exit 5; }
make -s -j${BUILD_JOBS}
# Build the userland utilities and the DKMS package 
# Note:
# If kernel modules are to be installed via DKMS package, this target should be sufficient. 
make native-deb-utils || { echo "Error while making native-deb-utils for zfs-${OPENZFS_VERSION}!"; exit 6; }
popd > /dev/null || { echo "Error while popd directory!"; exit 2; }

# Install OpenZFS native deb packages
# Note:
# * Install either openzfs-zfs-initramfs or openzfs-zfs-dracut
# * Install either openzfs-zfs-dkms or openzfs-zfs-modules-*
#   => dkms is more flexible so use it as default.
sudo apt-get install --fix-missing -y \
./openzfs-lib*_${OPENZFS_VERSION}*.deb \
./openzfs-py*_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-dkms_${OPENZFS_VERSION}*.deb \
./openzfs-zfsutils_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-zed_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-test_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-${BOOT_TOOL}_${OPENZFS_VERSION}*.deb

# Clean Up
rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"    # !! use a fixed sting in rm -rf!
exit 0

The script builds 2.2.2 with initramfs in default mode. But you can provide the version to build and the build tool (either initramfs or dracut).

The script was tested sucessfully on Ubuntu 23.10 running a personalized dracut based boot process using UKI. (Which shouldn't matter for you, initramfs is just not tested.)

Well actually, besides a few debugging differences (my script is just "open-loop" command after command, yours actually handles some of the errors which might occur) we should be getting the same result. I'm not that advanced in bash 😉.

I can also test yours. Only question is does it build 2.2.2 when checked out from git with the tag? It built 2.2.99 for me, that's why I fell back on the tar tarball which is working (if you download the correct one).

@luckylinux
Copy link

Cleaned up script for building the deb packages:

#!/bin/bash
# Ubuntu OpenZFS DKMS Kernel Module Install Script

typeset -r OPENZFS_VERSION=${1:-2.2.2}
typeset -r BOOT_TOOL=${2:-"initramfs"}  # initramfs is the default on Ubuntu
#typeset    BOOT_TOOL=${2:-"dracut"}
typeset -r TMP_DIR="/tmp"
typeset -r BUILD_JOBS=$(( $(nproc) / 2 ))   # use half of what we have for building

if [[ ! "${BOOT_TOOL}" =~ ^initramfs|dracut$ ]]; then
    echo "Invalid boot tool \"${BOOT_TOOL}\" [initramfs|dracut] parameter!"
    exit 1
fi

# Installed required packages (Debian, Ubuntu)
# Note:
# TBD: hmm, I don't think we need package(s) alien and related packages any longer for versions >= v2.2.
sudo apt-get install -y build-essential autoconf automake libtool gawk \
        fakeroot 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 debhelper-compat dh-python po-debconf \
        python3-all-dev python3-sphinx \
        git libcurl4-openssl-dev libpam0g-dev \
        dkms dh-dkms

# Create working directory
[ -d "${TMP_DIR}/zfs-${OPENZFS_VERSION}" ] && { rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"; }    # !! use a fixed sting in rm -rf!
install -d -m 0770 -o root -g root "${TMP_DIR}/zfs-${OPENZFS_VERSION}"
pushd "${TMP_DIR}/zfs-${OPENZFS_VERSION}" > /dev/null || { echo "Error while pushd directory \"${TMP_DIR}/zfs-${OPENZFS_VERSION}\"!"; exit 2; }

# Get Source Code (GitHub)
git clone --branch zfs-${OPENZFS_VERSION} https://github.com/openzfs/zfs zfs-${OPENZFS_VERSION} || { echo "Error cloning zfs-${OPENZFS_VERSION} from GitHub!"; exit 3; }
cd zfs-${OPENZFS_VERSION}

# Get Patches (optional)
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/OpenZFS%20Patches.html#openzfs-patches
#
# Official zfs-2.2.2 just (01.12.2023) released use it, no new patches yet.
#
# Notes:
# * If commented out, the following commits are already included into 2.2.2.

## dnode_is_dirty: check dnode and its data for dirtiness #15571
## https://github.com/openzfs/zfs/commit/9b9b09f452a469458451c221debfbab944e7f081 
## fixes: some copied files are corrupted (chunks replaced by zeros) #15526
# git cherry-pick 9b9b09f452a469458451c221debfbab944e7f081

# Build OpenZFS native deb packages
# see: https://openzfs.github.io/openzfs-docs/Developer%20Resources/Building%20ZFS.html
#
# Notes:
# * Starting from openzfs-2.2 release, native deb-based DKMS and user packages can be built.
#   => We are compiling for => v2.2.1 so this is the way to go.
# * make native-deb builds native-deb-kmod and native-deb-utils.
# * Native Debian packages build with pre-configured paths for Debian and Ubuntu. 
#   It’s best not to override the paths during configure.
# * KVERS, KSRC and KOBJ environment variables can be exported 
#   to specify the kernel installed in non-default location.
./autogen.sh || { echo "Error during autgen.sh for zfs-${OPENZFS_VERSION} package build!"; exit 4; }
./configure || { echo "Error while configuring zfs-${OPENZFS_VERSION} package build!"; exit 5; }
make -s -j${BUILD_JOBS}
# Build the userland utilities and the DKMS package 
# Note:
# If kernel modules are to be installed via DKMS package, this target should be sufficient. 
make native-deb-utils || { echo "Error while making native-deb-utils for zfs-${OPENZFS_VERSION}!"; exit 6; }
popd > /dev/null || { echo "Error while popd directory!"; exit 2; }

# Install OpenZFS native deb packages
# Note:
# * Install either openzfs-zfs-initramfs or openzfs-zfs-dracut
# * Install either openzfs-zfs-dkms or openzfs-zfs-modules-*
#   => dkms is more flexible so use it as default.
sudo apt-get install --fix-missing -y \
./openzfs-lib*_${OPENZFS_VERSION}*.deb \
./openzfs-py*_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-dkms_${OPENZFS_VERSION}*.deb \
./openzfs-zfsutils_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-zed_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-test_${OPENZFS_VERSION}*.deb \
./openzfs-zfs-${BOOT_TOOL}_${OPENZFS_VERSION}*.deb

# Clean Up
rm -rf "${TMP_DIR}/zfs-${OPENZFS_VERSION}"    # !! use a fixed sting in rm -rf!
exit 0

The script builds 2.2.2 with initramfs in default mode. But you can provide the version to build and the build tool (either initramfs or dracut).

The script was tested sucessfully on Ubuntu 23.10 running a personalized dracut based boot process using UKI. (Which shouldn't matter for you, initramfs is just not tested.)

I tried your script.
Not sure what's wrong, but the install part is buggy.

Attached the build log. Last ~ 10 lines of the log are most relevant.

build_fl140_20231202.log

@rincebrain
Copy link
Contributor

apt-get needs full paths, not relative.

@luckylinux
Copy link

apt-get needs full paths, not relative.

With my script it also works with relative paths:

root@UbuntuWorkstation02:/usr/src/zfs# cd selected-packages/2.2.2
root@UbuntuWorkstation02:/usr/src/zfs/selected-packages/2.2.2# sudo apt-get install --fix-missing ./*.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'openzfs-libnvpair3' instead of './openzfs-libnvpair3_2.2.2-1_amd64.deb'
Note, selecting 'openzfs-libpam-zfs' instead of './openzfs-libpam-zfs_2.2.2-1_amd64.deb'
Note, selecting 'openzfs-libuutil3' instead of './openzfs-libuutil3_2.2.2-1_amd64.deb'
Note, selecting 'openzfs-libzfs4' instead of './openzfs-libzfs4_2.2.2-1_amd64.deb'
Note, selecting 'openzfs-libzpool5' instead of './openzfs-libzpool5_2.2.2-1_amd64.deb'
Note, selecting 'openzfs-zfs-dkms' instead of './openzfs-zfs-dkms_2.2.2-1_all.deb'
Note, selecting 'openzfs-zfs-initramfs' instead of './openzfs-zfs-initramfs_2.2.2-1_all.deb'
Note, selecting 'openzfs-zfsutils' instead of './openzfs-zfsutils_2.2.2-1_amd64.deb'
Note, selecting 'openzfs-zfs-zed' instead of './openzfs-zfs-zed_2.2.2-1_amd64.deb'
openzfs-libnvpair3 is already the newest version (2.2.2-1).
openzfs-libpam-zfs is already the newest version (2.2.2-1).
openzfs-libuutil3 is already the newest version (2.2.2-1).
openzfs-libzfs4 is already the newest version (2.2.2-1).
openzfs-libzpool5 is already the newest version (2.2.2-1).
openzfs-zfs-dkms is already the newest version (2.2.2-1).
openzfs-zfs-initramfs is already the newest version (2.2.2-1).
openzfs-zfsutils is already the newest version (2.2.2-1).
openzfs-zfs-zed is already the newest version (2.2.2-1).
0 upgraded, 0 newly installed, 0 to remove and 78 not upgraded.

(it was already installed - re-ran the command to prove my point)

@AllKind
Copy link
Contributor

AllKind commented Dec 2, 2023

The file pattern for apt-get is perfectly fine.
The problem is the script is in the wrong directory when trying the install. That is why pathname expansion does not work and apt-get gets a list of invalid file names.

vboxadmin@Ubuntu-Jammy:~/Downloads$ pushd /tmp/zfs-2.2.2/
/tmp/zfs-2.2.2 ~/Downloads
vboxadmin@Ubuntu-Jammy:/tmp/zfs-2.2.2$ cd zfs-2.2.2/
vboxadmin@Ubuntu-Jammy:/tmp/zfs-2.2.2/zfs-2.2.2$ popd
~/Downloads

so instead of popd, a cd "${TMP_DIR}/zfs-${OPENZFS_VERSION}" should work.
The popd should be moved after the install and before the cleanup.

@FL140
Tried your script on Ubuntu 22.04 (jammy).
dh-dkms does not exist yet, so the build dependencies never get installed.
https://packages.ubuntu.com/search?keywords=dh-dkms

I'm not sure what the consequences, are regarding the package build, if you try to build it without the dh-dkms package.
More of a documentation issue in the Wiki....

Also:
install -d -m 0770 -o root -g root "${TMP_DIR}/zfs-${OPENZFS_VERSION}"

results in a permission denied error, when trying to change the user/group.
But you don't need to change the user/group to root. So just drop that....

@FL140
Copy link
Author

FL140 commented Dec 4, 2023

I can also test yours. Only question is does it build 2.2.2 when checked out from git with the tag? It built 2.2.99 for me, that's why I fell back on the tar tarball which is working (if you download the correct one).

You can pass the version you want to build in as the first parameter, it uses 2.2.2 as default see typeset -r OPENZFS_VERSION=${1:-2.2.2}

I went the git clone path since the tar wasn't working at the time and in addition with the git clone approach it is possible to apply additional commits.

@FL140
Copy link
Author

FL140 commented Dec 4, 2023

The file pattern for apt-get is perfectly fine. The problem is the script is in the wrong directory when trying the install. That is why pathname expansion does not work and apt-get gets a list of invalid file names.

vboxadmin@Ubuntu-Jammy:~/Downloads$ pushd /tmp/zfs-2.2.2/
/tmp/zfs-2.2.2 ~/Downloads
vboxadmin@Ubuntu-Jammy:/tmp/zfs-2.2.2$ cd zfs-2.2.2/
vboxadmin@Ubuntu-Jammy:/tmp/zfs-2.2.2/zfs-2.2.2$ popd
~/Downloads

so instead of popd, a cd "${TMP_DIR}/zfs-${OPENZFS_VERSION}" should work. The popd should be moved after the install and before the cleanup.

Well the last minute changes you know ;-), I had the popd exactly before the cleanup, but I moved it with the idea to also clean up the build directory earlier and make an option to keep the deb files. But it was verly late that day... Anyways will have look again over it.

@FL140 Tried your script on Ubuntu 22.04 (jammy). dh-dkms does not exist yet, so the build dependencies never get installed. https://packages.ubuntu.com/search?keywords=dh-dkms

I'm not sure what the consequences, are regarding the package build, if you try to build it without the dh-dkms package. More of a documentation issue in the Wiki....

hmmm, IDK how we handle that on older releases on 23.10 it's there, this will need a bit of investigation if someone needs it. I will also test it on Debian today.

Also: install -d -m 0770 -o root -g root "${TMP_DIR}/zfs-${OPENZFS_VERSION}"

results in a permission denied error, when trying to change the user/group. But you don't need to change the user/group to root. So just drop that....

Well if the script is called as root no, otherwise yes. I had it there to prevent normal users entering the directory. But you are right, it's better to run the build process as normal user and sudo install later.

@behlendorf
Copy link
Contributor

The recently tagged 2.3.0-rc1 release included a couple of fixed. It'd be very helpful if anyone who had issues could try again so we can work through any potential removing issues. We'll backport these for 2.2.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants