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

2018-01-19 Thread Raphael Hertzog
Hello Michael,

On Thu, 18 Jan 2018, Michael Stapelberg wrote:
> Given that the package’s only purpose is to populate /boot/firmware, may I
> ask why it’s being installed in your builds at all? I’d like to understand
> the use-case before adding code to deal with it.

The package name contains "firmware" so it's automatically installed by
live-build in the chroot. This is an hardware-enablement feature of
live-build.

See "--firmware-chroot true" in:
https://manpages.debian.org/stretch/live-build/lb_config.1.html

And in general, even if only for automated testing purposes, packages
should be installable without any special pre-requisites.

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/



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

2018-01-18 Thread Michael Stapelberg
Thanks for the additional details.

Given that the package’s only purpose is to populate /boot/firmware, may I
ask why it’s being installed in your builds at all? I’d like to understand
the use-case before adding code to deal with it.

On Mon, Jan 15, 2018 at 12:42 PM, Raphael Hertzog 
wrote:

> 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 +
> +++ /var/lib/dpkg/info/raspi3-firmware.postinst 2018-01-15
> 11:40:31.818918341 +
> @@ -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/
>



-- 
Best regards,
Michael


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

2018-01-15 Thread Raphael Hertzog
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 +
+++ /var/lib/dpkg/info/raspi3-firmware.postinst 2018-01-15 11:40:31.818918341 
+
@@ -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/



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

2018-01-13 Thread Michael Stapelberg
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

Have a look at the log at
https://anonscm.debian.org/cgit/pkg-raspi/raspi3-firmware.git/

I only have bandwidth to support the Debian raspi3 image, and I wasn’t even
aware of any other usages of this package. I’ll have to rely on external
contributions to fix this issue. Thanks.

On Sat, Jan 13, 2018 at 10:34 AM, Raphaël Hertzog 
wrote:

> Package: raspi3-firmware
> Version: 1.20171201-2
> Severity: serious
> User: de...@kali.org
> Usertags: origin-kali
>
> My dailay builds of Kali armhf live images are now failing with this
> version of
> raspi3-firmware with this error:
>
> Setting up raspi3-firmware (1.20171201-2) ...
> cp: cannot create regular file '/boot/firmware/bootcode.bin': No such file
> or directory
> dpkg: error processing package raspi3-firmware (--configure):
>
> I did not check the code but it looks like it assumes that /boot/firmware/
> does exist
> while it doesn't (at least not in the context of the chroot where the live
> image is being built).
>
> This was working fine a few days ago with the previous version that was in
> testing
> (1.20171006-1, Kali is based on Debian Testing).
>
> Cheers,
>
> -- System Information:
> Debian Release: buster/sid
>   APT prefers oldoldstable
>   APT policy: (500, 'oldoldstable'), (500, 'unstable'), (500, 'testing'),
> (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
>
> Kernel: Linux 4.14.0-1-amd64 (SMP w/4 CPU cores)
> Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8),
> LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
>
> ___
> Pkg-raspi-maintainers mailing list
> pkg-raspi-maintain...@lists.alioth.debian.org
> https://lists.alioth.debian.org/mailman/listinfo/pkg-raspi-maintainers
>



-- 
Best regards,
Michael