balena-io-library / resin-rpi-raspbian

Apache License 2.0
74 stars 27 forks source link

"Unknown error executing apt-key" on Apple Silicon #109

Open jrc opened 3 years ago

jrc commented 3 years ago

Steps to reproduce:

On a Apple Silicon machine:

  1. Create a Dockerfile that contains the following:
FROM balenalib/rpi-raspbian
RUN apt-get update -y
  1. Build it:

docker build .

Expected: No errors

Actual: Fails due to

#5 2.888 E: The repository 'http://archive.raspberrypi.org/debian buster InRelease' is not signed.
#5 2.888 W: GPG error: http://archive.raspbian.org/raspbian buster InRelease: Unknown error executing apt-key
#5 2.888 E: The repository 'http://archive.raspbian.org/raspbian buster InRelease' is not signed.
------
executor failed running [/bin/sh -c apt-get update -y]: exit code: 100

Configurations:

balenalib/raspberry-pi on Intel WORKS balenalib/raspberry-pi on Apple Silicon FAILS balenalib/raspberrypi3 on Apple Silicon WORKS

On Apple Silicon, latest Big Sur and Docker are used:

Docker version 20.10.5, build 55c4c88
% sw_vers
ProductName:    macOS
ProductVersion: 11.2.3
BuildVersion:   20D91

Additional debugging:

% docker run -ti --platform linux/arm/v6 balenalib/rpi-raspbian:latest
root@627909b18b76:/# apt-get update -y
Get:1 http://archive.raspberrypi.org/debian buster InRelease [32.9 kB]
Get:2 http://archive.raspbian.org/raspbian buster InRelease [15.0 kB]   
Err:1 http://archive.raspberrypi.org/debian buster InRelease
  Unknown error executing apt-key
Err:2 http://archive.raspbian.org/raspbian buster InRelease
  Unknown error executing apt-key
Reading package lists... Done
W: GPG error: http://archive.raspberrypi.org/debian buster InRelease: Unknown error executing apt-key
E: The repository 'http://archive.raspberrypi.org/debian buster InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.raspbian.org/raspbian buster InRelease: Unknown error executing apt-key
E: The repository 'http://archive.raspbian.org/raspbian buster InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root@627909b18b76:/# apt-key exportall
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction
jrc commented 3 years ago

Update: still happening with

% docker -v
Docker version 20.10.6, build 370c289
% sw_vers
ProductName:    macOS
ProductVersion: 11.4
BuildVersion:   20F71
jrc commented 3 years ago

Workaround: build using local mode, see https://forums.balena.io/t/unknown-error-executing-apt-key-on-apple-silicon/322093

jrc commented 2 years ago

Update (after a year): This is still an issue.

Also, the above workaround of using local mode is unbearably slow with RPi Zero devices, so it's not really an option.

% docker -v
Docker version 20.10.17, build 100c701
% sw_vers
ProductName:    macOS
ProductVersion: 12.4
BuildVersion:   21F79
jrc commented 2 years ago

Relating https://github.com/docker/for-mac/issues/5251#issuecomment-784992867