[FFe] flash-kernel displays wrong "selected" DTB on various Pi models

Bug #2038087 reported by Juerg Haefliger
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
flash-kernel (Ubuntu)
Fix Released
Undecided
Dave Jones
Jammy
Fix Released
Medium
Dave Jones

Bug Description

[ Impact ]

flash-kernel displays a "selected" DTB at the top of its output. On a Pi this isn't actually that relevant as it goes on to copy every DTB associated with the kernel anyway, but this is still confusing for users, especially when they see a completely different board model than the one they expected (e.g. at present on the Pi 400 or Pi 5, the output will indicate that the rpi-4-b dtb is being used).

[ Test Plan ]

* Boot a jammy image on an affected model of Pi (400, 5, CM3, CM3+, Zero 2W)
* Run "sudo flash-kernel" and confirm it outputs "Using DTB: bcm2711-rpi-4-b.dtb" at the top of its messages
* Enable the -proposed pocket and "sudo apt update"
* "sudo apt install flash-kernel" to update flash-kernel to the proposed version
* Run "sudo flash-kernel" and confirm it outputs the correct DTB for the selected model of Pi.

[ Regression Potential ]

Low; the existing flash-kernel already copies all DTBs found and the proposed one will too (all Pi related entries use "Method: pi", the method isn't changing in its behaviour, the only db entries that are changing are Pi related). Thus the worst-case scenario is that flash-kernel continues to output the "wrong" DTB at the top of its output, which is no worse than the present situation.

[ Original Description ]
flash-kernel probably shouldn't even be dealing with the DTBs on Pi but it's picking the wrong one for some machine models. For example on a Raspberry Pi 400 Rev 1.0 it uses bcm2711-rpi-4-b.dtb. Same one Compute Module 3 and 3+.

It's probably because in /usr/share/flash-kernel/db/all.db the catch-all

Machine: Raspberry Pi *

is listed before these above mentioned models (and others as well).

Revision history for this message
Heinrich Schuchardt (xypron) wrote (last edit ):

The problem is reproducible:

Create file /etc/flash-kernel/machine with content

   Raspberry Pi 400 Rev 1.0

on any arm64 system and run flash-kernel:

$ sudo flash-kernel $(uname -r)
Using DTB: bcm2711-rpi-4-b.dtb
Installing /lib/firmware/6.2.0-1013-raspi/device-tree/broadcom/bcm2711-rpi-4-b.dtb into /boot/dtbs/6.2.0-1013-raspi/./bcm2711-rpi-4-b.dtb
Taking backup of bcm2711-rpi-4-b.dtb.
Installing new bcm2711-rpi-4-b.dtb.
flash-kernel: installing version 6.2.0-1013-raspi

The following change is enough to fix the issue:
--- db/all.db 2023-06-22 14:18:53.000000000 +0000
+++ /usr/share/flash-kernel/db/all.db 2023-10-02 11:46:14.211402418 +0000
@@ -1823,7 +1805,7 @@
 Machine: Raspberry Pi 4 Model B Rev 1.2
 Machine: Raspberry Pi 4 Model B Rev 1.4
 Machine: Raspberry Pi 4 Model B Rev 1.5
-Machine: Raspberry Pi *
+Machine: Raspberry Pi 4 *
 Kernel-Flavors: raspi raspi-nolpae
 Method: pi
 DTB-Id: bcm2711-rpi-4-b.dtb

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in flash-kernel (Ubuntu):
status: New → Confirmed
Revision history for this message
Dave Jones (waveform) wrote :

You are correct that the "wrong" DTB is picked in the case of flash-kernel not recognizing the specific model in question. However, this doesn't matter provided the "Method" of the selected entry is "pi" (which it is, as they're currently the only entry that uses this method).

The "pi" method specifically copies *all* DTBs (and overlays) found to the boot partition, deliberately, to permit boot media to be moved between Pi models. However, the way flash-kernel works it still reports the "selected" DTB at the top of the output (and then goes on to copy all the found DTBs anyway).

 Still, I should add an entry for the Pi 5, and move the "Raspberry Pi *" catch-all down to that (and adjust the other catch-alls for various board revisions).

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

Hello Dave,

when using GRUB to boot via EFI the devicetree command in grub.cfg will use the device-tree in /boot/dtb-$(uname -r). It is important that this device-tree matches the actual machine.

Best regards

Heinrich

Dave Jones (waveform)
Changed in flash-kernel (Ubuntu):
assignee: nobody → Dave Jones (waveform)
Dave Jones (waveform)
summary: - flash-kernel installs wrong DTB on Pi
+ [FFe] flash-kernel displays wrong "selected" DTB on various Pi models
Dave Jones (waveform)
description: updated
Revision history for this message
Dave Jones (waveform) wrote :

@xypron Sure, that matters if you're using GRUB via EFI, but none of the Pi images do. I'll patch this to fix it because it does look sloppy on our part, but this is basically a cosmetic fix -- it doesn't change which DTBs are copied because in the case of the Raspberry Pi images all DTBs are always copied.

It also doesn't affect any non-Pi boards because none of them match "Raspberry Pi *" (at least I'd be rather surprised if they do!).

Dave Jones (waveform)
Changed in flash-kernel (Ubuntu):
milestone: none → ubuntu-23.10
Revision history for this message
Juerg Haefliger (juergh) wrote :

Can we not just leave 'DTB-Id' empty and then the whole copying of the single/running DTB is skipped?

Revision history for this message
Dave Jones (waveform) wrote :

@juergh That would be the "proper" way to fix this, but the last time I tried that it broke several other places in flash-kernel. It might be easier now, but I don't fancy that invasive a change in an FFe. I ought to look into it for the next cycle, though (really I ought to look into completely overhauling the rather hacky "pi" method and stop it spewing pages of output into the terminal every time it runs, and speed it up further for that matter).

Revision history for this message
Graham Inggs (ginggs) wrote :

FFe granted

Changed in flash-kernel (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package flash-kernel - 3.107ubuntu2

---------------
flash-kernel (3.107ubuntu2) mantic; urgency=medium

  * Use generic-revision catch-alls for each model rather than relying on a
    single Pi catch-all to avoid a confusing selection of "the one DTB" for a
    given board (even though all other DTBs will still be copied anyway)
    (LP: #2038087)
    - Add missing Pi Zero 2W entry
    - Add missing Pi 5B entry

 -- Dave Jones <email address hidden> Mon, 02 Oct 2023 12:59:44 +0100

Changed in flash-kernel (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Dave Jones (waveform) wrote :

Turns out we'll need this fix (minus the 5B entries) in Jammy as well. The cause of this is why I didn't notice LP: #2078525 until jammy users started upgrading to noble. The fix there will also be required when this is backported so they should be combined for jammy at least.

Changed in flash-kernel (Ubuntu Jammy):
status: New → Incomplete
status: Incomplete → Confirmed
assignee: nobody → Dave Jones (waveform)
importance: Undecided → Medium
Revision history for this message
Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
http://iso.qa.ubuntu.com/qatracker/reports/bugs/2038087

tags: added: iso-testing
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote : Please test proposed package

Hello Juerg, or anyone else affected,

Accepted flash-kernel into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/flash-kernel/3.104ubuntu21 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in flash-kernel (Ubuntu Jammy):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Dave Jones (waveform) wrote :

Verified on a Pi Zero 2W and 400 running the jammy arm64 server for Pi image. Additional verification on the Zero 2W performed for LP: #2078525 (also fixed in this upload).

description: updated
tags: added: verification-done-jammy
removed: verification-needed-jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package flash-kernel - 3.104ubuntu21

---------------
flash-kernel (3.104ubuntu21) jammy; urgency=medium

  * Use generic-revision catch-alls for each model rather than relying on a
    single Pi catch-all to avoid a confusing selection of "the one DTB" for a
    given board (even though all other DTBs will still be copied anyway)
    (LP: #2038087)
    - Add missing Pi Zero 2W entry
  * Add dtb-probe script to handle missing bcm2710-rpi-zero-2-w.dtb in some of
    the 5.15 series kernels (LP: #2078525)

 -- Dave Jones <email address hidden> Tue, 10 Sep 2024 16:32:47 +0100

Changed in flash-kernel (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for flash-kernel has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.