3

I can boot a vanilla pi-4 with kernel8.img (Feb 15, 2023) to release 5.15.84-v8+ ... the pi-4 runs admirably.

# ls -ltr /boot/*.img
-rwxr-xr-x 1 root root 8194604 Feb 15 18:02 /boot/kernel8.img

# uname -r
5.15.84-v8+

But when I install linux-headers-generic, I get the message that version 5.10.162-1 already installed...

# apt install linux-headers-generic
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'linux-headers-arm64' instead of 'linux-headers-generic'
linux-headers-arm64 is already the newest version (5.10.162-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

eg.

$ apt list --installed "linux-headers-5.1*.*-"{common,arm64}
Listing... Done
linux-headers-5.10.0-21-arm64/stable-security,now 5.10.162-1 arm64 [installed,automatic]
linux-headers-5.10.0-21-common/stable-security,stable-security,now 5.10.162-1 all [installed,automatic]

Even more terrible: linux-headers-5.15.84-v8+-arm64 is missing from the repo.

How/where can I force apt to download the newest stable linux-headers-5.15.84-v8+-arm64 headers? (as per the actual boot kernel)

Note: I'm trying to build fresh dkms drivers for zfs, and zfs's build needs the most current headers.

1

2 Answers 2

3

I had the same issue, you can fix it by using

 sudo apt install raspberrypi-kernel-headers

instead of the generic headers.
That fixed the issue for me and v4l2loopback at least.

I found the answer at the bottom of this page.

1

test case: build current stable zfs divers for pi4.

Record current kernel release:

$ ls -lt /boot/kernel8.img
-rwxr-xr-x 1 root root 8194604 Feb 16 09:40 /boot/kernel8.img
$ uname -r
5.15.84-v8+

Upgrade to the most current packages:

$ sudo apt update
$ sudo apt upgrade

Prep linux for a build:

$ sudo apt install -y build-essential autoconf automake libtool gawk alien fakeroot dkms libblkid-dev uuid-dev libudev-dev libssl-dev zlib1g-dev libaio-dev libattr1-dev libelf-dev python3 python3-dev python3-setuptools python3-cffi libffi-dev python3-packaging git libcurl4-openssl-dev

At this point you already have headers for 5.10.0-21, but sadly these are of not much use for building modules for the 5.15.84-v8+ kernel! :-( ... eg. ...

# apt list --installed "linux-headers*"
Listing... Done
linux-headers-5.10.0-21-arm64/stable-security,now 5.10.162-1 arm64 [installed,automatic]
linux-headers-5.10.0-21-common/stable-security,stable-security,now 5.10.162-1 all [installed,automatic]
linux-headers-arm64/stable-security,now 5.10.162-1 arm64 [installed]

Instead, you must apt install the additional raspberrypi-kernel-headers package required to build on "Raspberry Pi OS" (aka debian11 on pi4/arm/64)

$ sudo apt install raspberrypi-kernel-headers

Download and build the package containing the driver:

$ git clone https://github.com/openzfs/zfs
$ cd zfs
$ git checkout master
$ sh autogen.sh
$ ./configure
$ make -s -j$(nproc)
$ make -s -j$(nproc) deb

Install the required packages and test:

$ sudo apt install -y $PWD/{zfs,zfs-dkms,libzfs5,libnvpair3,libuutil3}_2.1.99-1734_arm64.deb $PWD/kmod-zfs-`uname -r`_2.1.99-1734_arm64.deb
$ sudo zpool import -a

Enable zfs on boot:

$ sudo systemctl enable --now zfs-import-scan.service zfs-mount zfs-import.target zfs-zed zfs.target zfs-import-cache.service

Reboot and check zfs now works OK! (And finds all existing filesystems... if you have any)

$ df -PhT -t zfs
Filesystem           Type      Size  Used Avail Use% Mounted on
zfs_test             zfs       136G  107G   29G  80% /zfs_test
zfs_vault            zfs       2.9T  2.7T  192G  94% /zfs_vault

Warning: Do not run rpi-update, as this appears will install beta/unstable kernel-6.0.xx (and fresh firmware) and you will stuck in beta tester land... ;-)

But if you do... DougieLawson: "If you update the kernel with rpi-update you'd need to run rpi-source to get the matching kernel source tree and headers."

eg. If you run rpi-update you will get something like:

# modprobe zfs
modprobe: FATAL: Module zfs not found in directory /lib/modules/6.xx.xx-v8+

Note the 6.0.xx in /lib/modules/6.0.xx in the above.

See also:

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.