Score:1

Can I run a kernel newer than 5.15 on Ubuntu 22.04 on a Raspberry Pi 4b?

bv flag

I've got a Raspberry Pi 4b 4GB running Ubuntu 22.04 server (kernel 5.15) that I run ROS2 Humble on for robotics (which necessitates 22.04). I recently bought a Raspberry Pi Camera Module 3 to use as a camera for my robot, however it does not function correctly on this OS. I validatd this hardware combination by running Raspbian, where the camera worked perfectly.

In this GitHub issue I tried to work out how to make it work, and was told that the kernel I'm running does not contain the necessary drivers for the Sony IMX758 sensor. I was advised that a newer kernel version might solve my problems and have the drivers built in.

Thus far I have been copying changes from raspberrypi/linux over to the Ubuntu provided linux-raspi kernel on the branch applied/ubuntu/jammy-updates 5.15.0-1035.38 (patches applied). This has only partially worked, and not ended up enabling the camera.

Can I run a kernel newer than 5.15 with ubuntu 22.04 (jammy)? I notice that there's a 6.2.X kernel in the Ubuntu rpi-kernel repo tagged with mantic (23.10) and lunar (23.04). If so, does it matter whether I get the newer kernel from raspberrypi/linux (which has 6.1y branch, that I think I would have to recompile, or Ubuntu's linux-raspi kernel, and would either choice be better?

AFAIK the kernel goes under any distro-specific customization, so in theory could I simply compile 6.1y from raspberrypi/linux and apply the .deb patches to Ubuntu?

If anyone can advise on next steps it would be wonderful. There are error logs in my linked GitHub issue and more diagnostics.

guiverc avatar
cn flag
Why don't you just use https://packages.ubuntu.com/jammy-updates/linux-generic-hwe-22.04 as Ubuntu 22.04 LTS is a LTS release, thus kernel stack options exist (ie. kernels from 22.10, 23.04, 23.10 & 24.04 will become available) https://wiki.ubuntu.com/Kernel/LTSEnablementStack for details (or see answer below), with the *default* kernel stack choice set by your install media. Also note there are *distro-specific* customizations (ubuntu-sauce) to kernels too !
Atticus avatar
bv flag
@guiverc I used apt to install the package you linked to first (the generic hwe kernel), however it did not work for me, as even after I reboot I still boot into 5.15.0-1035-raspi. See my response to the below answer by Artur Melind for more details. If you have any ideas on how to troubleshoot or what approach I should take if compiling my own kernel is required, it would be appreciated.
Atticus avatar
bv flag
The response I referenced was deleted, so here it is repasted: This didn't work for me on the raspberry pi. I believe I need kernels ending in raspi not generic. I found this related mailing list The install process worked but the kernel didn't install. It went to /boot/ but not /boot/firmware I don't have room to attach terminal snips in this comment due to char limit :( so i've linked it https://github.com/raspberrypi/libcamera-apps/files/12432295/hwe_kernel_rpi_not_work.txt
Artur Meinild avatar
vn flag
@guiverc I was wrong to assume the HWE kernel line works on Raspberry Pi - it doesn't, so that's why I deleted my answer. I think the only solution here is to compile your own kernel. I'm not sure what would be good sources to get started with this.
Artur Meinild avatar
vn flag
Jeff Geerling has a number of guides and videos about compiling kernel for various odd hardware for the Pi - maybe it can help. https://github.com/geerlingguy
Score:1
bv flag

I was able to update my kernel to 6.2.0-1004-raspi by installing the package linux-image-6.2.0-1004-raspi using apt. This updated my kernel with precompiled images.

I was able to access this package by adding Ubuntu lunar sources to /etc/apt/sources-list. I added the following lines:

# adding this to get the new 6.2.x kernel from lunar
deb http://ports.ubuntu.com/ubuntu-ports lunar main restricted
deb http://ports.ubuntu.com/ubuntu-ports lunar-updates main restricted
deb http://ports.ubuntu.com/ubuntu-ports lunar universe
deb http://ports.ubuntu.com/ubuntu-ports lunar-updates universe
deb http://ports.ubuntu.com/ubuntu-ports lunar multiverse
deb http://ports.ubuntu.com/ubuntu-ports lunar-updates multiverse
deb http://ports.ubuntu.com/ubuntu-ports lunar-backports main restricted 
universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports lunar-security main restricted
deb http://ports.ubuntu.com/ubuntu-ports lunar-security universe
deb http://ports.ubuntu.com/ubuntu-ports lunar-security multiverse

I then simply did sudo apt update and sudo apt install linux-image-6.2.0-1004-raspi, and rebooted when the installation was done.

atticus@rospi:~  
$ uname -a
Linux rospi 6.2.0-1004-raspi #5-Ubuntu SMP PREEMPT Mon Apr  3 11:15:14 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

The updated kernel did not solve the problem I set out to fix, as my Raspberry Pi Camera Module 3 still does not work on this Ubuntu install, despite the correct drivers being present, but I will create a new post regarding that.

atticus@rospi:~  
$ libcamera-hello 
Preview window unavailable
[0:13:33.922153143] [5185]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+19-960d0c1e
[0:13:33.961853643] [5186] ERROR V4L2 v4l2_device.cpp:93 'imx708': Failed to open V4L2 device '': No such file or directory
[0:13:33.961984865] [5186] ERROR RPI vc4.cpp:209 Failed to register camera imx708: -22
ERROR: *** no cameras available ***
Artur Meinild avatar
vn flag
It can be a little dangerous to mix in sources for newer Ubuntu releases into 22.04.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.