[Pkg-raspi-maintainers] Bug#1049902: bookworm-pu: package raspi-firmware/20220830+ds-1+deb12u1

Gunnar Wolf gwolf at debian.org
Wed Aug 16 17:12:08 BST 2023


Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian.org at packages.debian.org
Usertags: pu
X-Debbugs-Cc: raspi-firmware at packages.debian.org
Control: affects -1 + src:raspi-firmware

[ Reason ]
raspi-firmware was built assuming it would be installed only in Raspberry
systems. However, now that firmware-nonfree is a proper section of Debian, and
there is firmware autodetection, it gets pulled in several AMD64 systems as
well.

When /boot/firmware is not mounted (as is the case in AMD64), postinst
fails. This yields a failure on kernel upgrades.

[ Impact ]
Many users have reported issues when upgrading the kernel.

[ Tests ]
I have not yet tested this particular version (but intend to do so soon and
report -- I want to get this reported to you first, though!), but the debdiff is
trivial, and is backported identically to the fix I sent to unstable (and is now
in testing) several weeks ago.

[ Risks ]
The code is very simple.

The only risk I can think of is that the bug might still impact users of
non-Raspberry ARM systems. However, the likelihood of having it installed is
minor (due to the available hardware being different). Besides, fixing this
(i.e. via detectng the Raspberry model from entries in /sys) would break other
use cases, such as VM-based image building.

[ Checklist ]
  [X] *all* changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in (old)stable
  [X] the issue is verified as fixed in unstable

[ Changes ]
Postinst will now check whether the architecture is ARM*, and exit otherwise
without doing the firmware install dance.

[ Other info ]
A more proper fix would be to create a separate package with the wireless
Broadcom firmware. I have requested for the kernel team (maintainers of
firmware-brcm80211) to do so, but have got no positive response.

-- 

-------------- next part --------------
diff -Nru raspi-firmware-1.20220830+ds/debian/changelog raspi-firmware-20220830+ds/debian/changelog
--- raspi-firmware-1.20220830+ds/debian/changelog	2022-10-03 09:11:55.000000000 -0500
+++ raspi-firmware-20220830+ds/debian/changelog	2023-08-16 09:51:39.000000000 -0600
@@ -1,3 +1,10 @@
+raspi-firmware (20220830+ds-1+deb12u1) bookworm; urgency=medium
+
+  * Skip running postinst if installing on a system that's not arch:arm*
+    (Closes: #1040896, #1040485, #1042070, #1040669, #1049448)
+
+ -- Gunnar Wolf <gwolf at debian.org>  Wed, 16 Aug 2023 09:51:39 -0600
+
 raspi-firmware (1.20220830+ds-1) unstable; urgency=medium
 
   [ Gunnar Wolf ]
diff -Nru raspi-firmware-1.20220830+ds/debian/kernel/postinst.d/z50-raspi-firmware raspi-firmware-20220830+ds/debian/kernel/postinst.d/z50-raspi-firmware
--- raspi-firmware-1.20220830+ds/debian/kernel/postinst.d/z50-raspi-firmware	2022-10-03 09:11:55.000000000 -0500
+++ raspi-firmware-20220830+ds/debian/kernel/postinst.d/z50-raspi-firmware	2023-08-16 09:51:39.000000000 -0600
@@ -27,11 +27,25 @@
   grep -q 'Raspberry Pi \(Compute Module \)*4' /sys/firmware/devicetree/base/model 2>/dev/null
 }
 
+is_arm_system() {
+  # Check to see if the host is running an arm-based system
+  # (i.e. whether the raspi-firmware package is useful)
+  DPKG_ARCH=$(dpkg --print-architecture)
+  case "$DPKG_ARCH" in
+    arm64|armel|armhf)
+      return 0;;
+    *)
+      return 1;;
+  esac
+}
 
 if ischroot ; then
   true # chroot detected - skip mount point check
 elif [ -e /usr/bin/systemd-detect-virt ] && systemd-detect-virt -q ; then
   true # virtualization detected - skip mount point check
+elif ! is_arm_system ; then
+  # Not running on an arm-based system, skip postinst.
+  exit 0
 elif ! mountpoint -q /boot/firmware ; then
   echo "raspi-firmware: missing /boot/firmware, did you forget to mount it?" >&2
   exit 1
diff -Nru raspi-firmware-1.20220830+ds/debian/raspi-firmware.postinst raspi-firmware-20220830+ds/debian/raspi-firmware.postinst
--- raspi-firmware-1.20220830+ds/debian/raspi-firmware.postinst	2022-10-03 09:11:55.000000000 -0500
+++ raspi-firmware-20220830+ds/debian/raspi-firmware.postinst	2023-08-16 09:51:39.000000000 -0600
@@ -3,6 +3,18 @@
 
 set -e
 
+is_arm_system() {
+  # Check to see if the host is running an arm-based system
+  # (i.e. whether the raspi-firmware package is useful)
+  DPKG_ARCH=$(dpkg --print-architecture)
+  case "$DPKG_ARCH" in
+    arm64|armel|armhf)
+      return 0;;
+    *)
+      return 1;;
+  esac
+}
+
 case "$1" in
   configure)
 
@@ -10,6 +22,9 @@
       true # chroot detected - skip mount point check
     elif test -e /usr/bin/systemd-detect-virt && systemd-detect-virt -q ; then
       true # virtualization detected - skip mount point check
+    elif ! is_arm_system ; then
+      # Not running on an arm-based system, skip the postinst
+      exit 0
     elif ! mountpoint -q /boot/firmware; then
       echo "Error: missing /boot/firmware, did you forget to mount it?" >&2
       exit 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-raspi-maintainers/attachments/20230816/94fd3db4/attachment.sig>


More information about the Pkg-raspi-maintainers mailing list