Hi,

Quoting Helmut Grohne (2019-08-21 10:07:32)
> What we see here is that apt fails to install gcc-9-base:armhf, because armhf
> is not a known architecture to dpkg. Since we're using the chrootless mode,
> we're using the outer system's dpkg directly and that happens to be an amd64
> one. dpkg checks ./target/var/lib/dpkg/arch, but that is not created due to
> the condition in mmdebstrap line 1005.  $options->{foreignarchs} turns out to
> be empty and thus creation is skipped. This condition is wrong for the case
> at hand. The outcome should be positive whenever the mode is chrootless and
> the native architecture of the outer system doesn't match the architecture of
> the chroot. Unconditionally creating /var/lib/dpkg/arch makes this particular
> problem go away. We could craft a complex condition here, but I think that it
> would be best to simply remove the condition, because the presence of the
> arch file does not hurt. What do you think?

I opted for creating a complex condition. The reason is, that mmdebstrap tries
to remain compatible with what debootstrap outputs except where there is a
strong enough reason not to do so. And debootstrap never creates
/var/lib/dpkg/arch because debootstrap cannot do multiarch. ;)

Due to the large testsuite, having a complex condition should be alright. I
added a new testcase which failed before the attached patch and which succeeds
now.

Thanks!

cheers, josch

--- a/mmdebstrap
+++ b/mmdebstrap
@@ -1023,7 +1023,13 @@ sub setup {
        close $fh;
     }
 
-    if (scalar @{$options->{foreignarchs}} > 0) {
+    # we create /var/lib/dpkg/arch inside the chroot either if there is more
+    # than the native architecture in the chroot or if chrootless mode is
+    # used to create a chroot of a different architecture than the native
+    # architecture outside the chroot.
+    chomp (my $hostarch = `dpkg --print-architecture`);
+    if (scalar @{$options->{foreignarchs}} > 0 or (
+           $options->{mode} eq 'chrootless' and $hostarch ne 
$options->{nativearch})) {
        open my $fh, '>', "$options->{root}/var/lib/dpkg/arch" or error "cannot 
open /var/lib/dp
kg/arch: $!";
        print $fh "$options->{nativearch}\n";
        foreach my $arch (@{$options->{foreignarchs}}) {

Attachment: signature.asc
Description: signature

Reply via email to