[Pkg-raspi-maintainers] Bug#887062: raspi3-firmware: postinst fails, makes bad assumption about existence of /boot/firmware/

Matthias Luescher lueschem at gmail.com
Fri Jan 19 09:57:50 UTC 2018


I also came across that issue when building images using my tool called edi
using the edi-pi project configuration:
https://github.com/lueschem/edi-pi

I suggest the following fix (it also covers the case where a container is
taken instead of a chroot):

>From 73d8a0c4a6cbe082ae31f81dc6af7031b5007c54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20L=C3=BCscher?= <lueschem at gmail.com>
Date: Sun, 14 Jan 2018 17:27:48 +0100
Subject: [PATCH 1/5] Do not check mount point if virtualization gets
detected.

---
 debian/kernel/postinst.d/raspi3-firmware | 12 +++++++-----
 debian/raspi3-firmware.postinst          | 14 +++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/debian/kernel/postinst.d/raspi3-firmware
b/debian/kernel/postinst.d/raspi3-firmware
index fe89560..deacec9 100755
--- a/debian/kernel/postinst.d/raspi3-firmware
+++ b/debian/kernel/postinst.d/raspi3-firmware
@@ -31,11 +31,13 @@ case "$1" in
     ;;
 esac

-if ! ischroot; then
-  if ! mountpoint -q /boot/firmware; then
-    echo "raspi3-firmware: missing /boot/firmware, did you forget to mount
it?" >&2
-    exit 1
-  fi
+if ischroot ; then
+  : chroot detected - skip mount point check
+elif test -e /usr/bin/systemd-detect-virt && systemd-detect-virt -q ; then
+  : virtualization detected - skip mount point check
+elif ! mountpoint -q /boot/firmware; then
+  echo "raspi3-firmware: missing /boot/firmware, did you forget to mount
it?" >&2
+  exit 1
 fi

 latest_kernel=$(ls -1 /boot/vmlinuz-* | grep -v '\.dpkg-bak$' | sort -V -r
| head -1)
diff --git a/debian/raspi3-firmware.postinst
b/debian/raspi3-firmware.postinst
index 236b389..01bdcf8 100644
--- a/debian/raspi3-firmware.postinst
+++ b/debian/raspi3-firmware.postinst
@@ -6,11 +6,15 @@ set -e
 case "$1" in
   configure)

-    if ! ischroot; then
-      if ! mountpoint -q /boot/firmware; then
-        echo "Error: missing /boot/firmware, did you forget to mount it?"
>&2
-        exit 1
-      fi
+    if ischroot ; then
+      # chroot detected - skip mount point check
+      mkdir -p /boot/firmware
+    elif test -e /usr/bin/systemd-detect-virt && systemd-detect-virt -q ;
then
+      # virtualization detected - skip mount point check
+      mkdir -p /boot/firmware
+    elif ! mountpoint -q /boot/firmware; then
+      echo "Error: missing /boot/firmware, did you forget to mount it?" >&2
+      exit 1
     fi

     for file in /usr/lib/raspi3-firmware/*
-- 
2.7.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-raspi-maintainers/attachments/20180119/4ce7a732/attachment.html>


More information about the Pkg-raspi-maintainers mailing list