How do Kernel upgrades work in DietPi

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
Schievel
Posts: 5
Joined: Thu Sep 16, 2021 6:52 pm

How do Kernel upgrades work in DietPi

Post by Schievel »

Hi,

I have an issue with the kernel Linux DietPi 4.9.241-arm64 on my Odroid HC4 with Dietpi. This relatively old kernel seems to have problems with btrfs, where the btrfs driver in the kernel causes some exceptions. The syslog reads
Unable to handle kernel NULL pointer dereference at virtual address 00000044

Anyway, according to some sources on the internet this is resolved in newer kernel versions, there I thought I could just upgrade the kernel on my machine an pish pash posh all fine. I thought.

So I did a apt install linux-image-arm64-odroid-c4 and apt install linux-headers-arm64-odroid-c4 real quick. This caused the system to refuse to boot.
After having a look at the SD cards boot partition and not understanding a thing, I made a new SD card (but kept the old), deleted all the contents of the boot partition of the old SD card an copied everything from the new SD cards boot partition to the old SD card.
Now the system boots again. Fine. But I still have no new kernel.

So instead I thought maybe I should upgrade to bulleye (C4/ HC4 image still has buster) and this will give me the new kernel. Turns out it doesnt. After doing everything from here https://dietpi.com/blog/?p=811, rebooting, uname -a is:
Linux DietPi 4.9.241-arm64 #1 SMP PREEMPT Tue Jan 5 23:38:40 CET 2021 aarch64 GNU/Linux

So I wonder, how do you upgrade kernels?
User avatar
Joulinar
Posts: 5996
Joined: Sat Nov 16, 2019 12:49 am

Re: How do Kernel upgrades work in DietPi

Post by Joulinar »

Basically DietPi is not doing any own kernel development. We use the kernel give by the underlying base image. In case of Odroid we use image from Maveric. I guess there is no newer version available for this image. @MichaIng I guess you are more close to Maveric. Maybe you know.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Schievel
Posts: 5
Joined: Thu Sep 16, 2021 6:52 pm

Re: How do Kernel upgrades work in DietPi

Post by Schievel »

Oh. Now I understand what some people meant with "underlying base image". I thought that is the debian basis you use for dietpi, but rather it is the image from another developer.
So you cant use that kernel even though it says arm64-odroid-c4 in the name? I just thought apt is doing something wrong with that weird bootloader of yours.

Anyway. Just for the folks googling that error "Unable to handle kernel NULL pointer dereference at virtual address 00000044" and that error pops up when they mount their btrfs partition and use it a bit: I did a btrfs check --repair /dev/md0 (or whatever your device is called, BE CAREFUL WITH BTRFS, THIS IS A COMMAND OF LAST RESORT!) and this resulted in the error only coming when I use the disk under heavy load for a while.
Still not good, but maybe better it helps someone.
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: How do Kernel upgrades work in DietPi

Post by MichaIng »

For all SBCs in general the kernel version is not tied to the Debian version. This is only true for x86_64 where Debian's own kernel is used. So you say the latest kernel upgrade on Odroid C4 makes your system unbootable? The bootloader is not upgraded with it, so it needs to be either the kernel image itself or the device tree (included). You btw do not need to install the kernel headers, as long as you do not install WireGuard or build other kernel modules.
Schievel wrote: Thu Sep 16, 2021 10:56 pm So you cant use that kernel even though it says arm64-odroid-c4 in the name? I just thought apt is doing something wrong with that weird bootloader of yours.
What do you mean by this? APT is doing everything right as this is the intended correct kernel package. Also you are the first who reports boot issues with it and this version is available since half a year, so it could be simply a filesystem error caused by the file writes or so.

I checked the image, and the device trees have not changed and also the kernel version did not change. It was a rebuild/repack only, but I don't remember the exact reason anymore. This however makes me think that you boot issues are indeed not directly related by the kernel upgrade but indirectly due to some some filesystem corruption or so.
Schievel
Posts: 5
Joined: Thu Sep 16, 2021 6:52 pm

Re: How do Kernel upgrades work in DietPi

Post by Schievel »

Alright, so this means the Kernel linux-image-arm64-odroid-c4 should just work fine and the problem is in /boot or the bootloader i guess.

When I have some spare time I will make an image of that sd card, then play around with it.
What is the name of this bootloader, so I can find and read some documentation? When apt installs that kernel, it does everything for me, or how do I choose which kernel is bootet?
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: How do Kernel upgrades work in DietPi

Post by MichaIng »

It's U-Boot:

Code: Select all

dpkg -l u-boot
But that generally works, it did before the kernel upgrade, didn't it?

Do you have a screen or serial cable to see related error messages at boot?
Schievel
Posts: 5
Joined: Thu Sep 16, 2021 6:52 pm

Re: How do Kernel upgrades work in DietPi

Post by Schievel »

I tried my monitor with hdmi, but the screen staid blank.

Anyway, I will first make an image of the card, then upgrade the kernel and then I could post the contents of /boot here. I think there is something going on with the kernel image, initrd or something.
We’ll see.

A serial cable? In 2021? Do you think I am a nerd? Well. Then you’re right. But I still don’t have that cable.
Schievel
Posts: 5
Joined: Thu Sep 16, 2021 6:52 pm

Re: How do Kernel upgrades work in DietPi

Post by Schievel »

Ok, I think I fucked up.

So, the kernel image thats originally installed is linux-image-arm64-odroid-c4, while the package I tried to install was linux-image-5.13.7-arm64.
I just wrote the wrong name in my initial post, and this led to your confusion. I should write forum posts when tired.

So theres no chance the package linux-image-arm64-odroid (without the c4, but this is kernel 5.13.14) is going to run is there?

Thanks for looking into this. I really appreciate it.
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: How do Kernel upgrades work in DietPi

Post by MichaIng »

No the bootloader as well as its configuration (boot.ini) require the linux-image-arm64-odroid-c4 kernel. If you use Debians kernel, you'd need to install Debian's U-Boot package as well (and flash it) and create a matching boot.cmd => boot.scr.
Post Reply