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

Raphael Hertzog hertzog at debian.org
Mon Jan 15 11:42:01 UTC 2018


On Sat, 13 Jan 2018, Michael Stapelberg wrote:
> The only change that seems in any way related to me is
> https://anonscm.debian.org/cgit/pkg-raspi/raspi3-firmware.git/commit/?id=c977f0210ab5c577b9d5296e4e4391225a7f85ca

This change is not the cause of the regression. The package fails at
initial installation, not on upgrade. I have added "set -x" and I get
this:

# dpkg --configure raspi3-firmware
Setting up raspi3-firmware (1.20171201-2) ...
+ ischroot
+ basename /usr/lib/raspi3-firmware/bootcode.bin
+ file=bootcode.bin
+ cp /usr/lib/raspi3-firmware/bootcode.bin /boot/firmware/bootcode.bin
cp: cannot create regular file '/boot/firmware/bootcode.bin': No such file or directory
dpkg: error processing package raspi3-firmware (--configure):
 installed raspi3-firmware package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 raspi3-firmware

I wonder how it worked before. Maybe the package shipped /boot/firmware or
another package supplied that directory and it now fails because no
package is creating it.

In any case, you should probably not attempt to copy the files there if the
directory is not existing.

Something like this:

--- /tmp/postinst	2018-01-15 11:35:43.223477268 +0000
+++ /var/lib/dpkg/info/raspi3-firmware.postinst	2018-01-15 11:40:31.818918341 +0000
@@ -13,19 +13,23 @@
       fi
     fi

-    for file in /usr/lib/raspi3-firmware/*
-    do
-      file=$( basename "$file" )
-      cp "/usr/lib/raspi3-firmware/$file" "/boot/firmware/$file"
-      # sync might fail when running under qemu, which, as of version 2.7,
-      # has not implemented the syncfs syscall.
-      sync -f "/boot/firmware/$file" || true
-    done
+    if [ -d /boot/firmware ]; then
+	for file in /usr/lib/raspi3-firmware/*
+	do
+	  file=$( basename "$file" )
+	  cp "/usr/lib/raspi3-firmware/$file" "/boot/firmware/$file"
+	  # sync might fail when running under qemu, which, as of version 2.7,
+	  # has not implemented the syncfs syscall.
+	  sync -f "/boot/firmware/$file" || true
+	done

-    # Manually trigger the kernel postinst hook when raspi3-firmware is first
-    # installed (or upgraded), as the kernel package might already be installed
-    # (or not upgraded) and hence the hook would not get triggered otherwise.
-    DEB_MAINT_PARAMS="configure" /etc/kernel/postinst.d/raspi3-firmware
+	# Manually trigger the kernel postinst hook when raspi3-firmware is first
+	# installed (or upgraded), as the kernel package might already be installed
+	# (or not upgraded) and hence the hook would not get triggered otherwise.
+	DEB_MAINT_PARAMS="configure" /etc/kernel/postinst.d/raspi3-firmware
+    else
+	echo "Warning: not copying firmwares as /boot/firmware does not exist." >&2
+    fi
     ;;
 esac

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/



More information about the Pkg-raspi-maintainers mailing list