antichris / ledobe

Build Ledger Live components in an isolated Docker environment with persistence between sessions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot build on Raspberry PI4 (Raspbian)

slux83 opened this issue · comments

Hi,

I'm trying to follow the README instructions and when I perform bin/build or the docker instructions, in both cases I get the following issues

pi@raspberrypi:~/projects/ledobe $ ./bin/build 
Sending build context to Docker daemon  24.06kB
Step 1/46 : FROM ubuntu:20.04 AS pre-dl
 ---> 29275250a9ab
Step 2/46 : RUN set -x &&  apt-get update &&  apt-get install -y --no-install-suggests --no-install-recommends     ca-certificates=20210119~20.04.1     wget=1.20.3-1ubuntu1
 ---> Running in 59499bff64bf
+ apt-get update
Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [101 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
  At least one invalid signature was encountered.
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
Err:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
  At least one invalid signature was encountered.
Err:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
  At least one invalid signature was encountered.
Reading package lists...
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-security InRelease' is not signed.
The command '/bin/sh -c set -x &&  apt-get update &&  apt-get install -y --no-install-suggests --no-install-recommends     ca-certificates=20210119~20.04.1     wget=1.20.3-1ubuntu1' returned a non-zero code: 100

Interesting.

I don't have access to a 'berry at the moment, but based on what you posted — are you connected through some kind of proxy?

Because AFAICT there's something interfering with the retrieval of http://ports.ubuntu.com/ubuntu-ports/dists/focal*/InRelease URLs. Try running

wget -qO - http://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease|gpg --verify -

if you get

gpg: no valid OpenPGP data found.
gpg: the signature could not be verified.
Please remember that the signature file (.sig or .asc)
should be the first file given on the command line.
you can be certain this is the case.

What you should be seeing instead is

gpg: Signature made Thu Apr 23 20:34:17 2020 EEST
gpg:                using RSA key 3B4FE6ACC0B21F32
gpg: Can't check signature: No public key
gpg: Signature made Thu Apr 23 20:34:17 2020 EEST
gpg:                using RSA key 871920D1991BC93C
gpg: Can't check signature: No public key

or even

gpg: Signature made Thu Apr 23 20:34:17 2020 EEST
gpg:                using RSA key 3B4FE6ACC0B21F32
gpg: Good signature from "Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 790B C727 7767 219C 42C8  6F93 3B4F E6AC C0B2 1F32
gpg: Signature made Thu Apr 23 20:34:17 2020 EEST
gpg:                using RSA key 871920D1991BC93C
gpg: Good signature from "Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: F6EC B376 2474 EDA9 D21B  7022 8719 20D1 991B C93C

if you have Ubuntu signing keys imported into your GPG database.

Once you are confident that there are no networking issues and your device can successfully fetch the real, signed Ubuntu release files, the issue might be in the Docker image that you have tagged as ubuntu:20.04. To resolve that, you could try updating to the latest:

docker pull ubuntu:20.04

and then test an Ubuntu build that updates APT package lists:

printf 'FROM ubuntu:20.04\nRUN apt-get update'|docker build -
The output should end in a success message (the hash value will be different for you):
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM ubuntu:20.04
 ---> 9873176a8ff5
Step 2/2 : RUN apt-get update
 ---> Running in beb8daefacf9
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [930 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [779 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [368 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [27.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1367 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1051 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [416 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [32.0 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [6315 B]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [2668 B]
Fetched 18.4 MB in 4s (4248 kB/s)
Reading package lists...
Removing intermediate container beb8daefacf9
 ---> 6ffab11e769d
Successfully built 6ffab11e769d

Hi, many thanks for the quick reply! I'm doing some testing on the 'berry4 and this is what I see. On the host (no docker) everything seems ok. No networking issues:

pi@raspberrypi:~ $ wget -qO - http://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease|gpg --verify -
gpg: Signature made Thu 23 Apr 2020 07:34:17 PM CEST
gpg:                using RSA key 3B4FE6ACC0B21F32
gpg: Can't check signature: No public key
gpg: Signature made Thu 23 Apr 2020 07:34:17 PM CEST
gpg:                using RSA key 871920D1991BC93C
gpg: Can't check signature: No public key

However, when I run the docker test that you pointed out, I see the issue again. So it's definitely an issue on Docker.

pi@raspberrypi:~ $ printf 'FROM ubuntu:20.04\nRUN apt-get update'|docker build -
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM ubuntu:20.04
 ---> 29275250a9ab
Step 2/2 : RUN apt-get update
 ---> Running in 21e40c3091ab
Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
  At least one invalid signature was encountered.
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [101 kB]
Err:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
  At least one invalid signature was encountered.
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
Err:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
  At least one invalid signature was encountered.
Reading package lists...
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-security InRelease' is not signed.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100

In the meantime, I'll try to investigate how to workaround the issue.

Hi again, it seems to be related to this tianon/docker-brew-ubuntu-core#183

I'm trying to understand where I should put the --security-opt seccomp:unconfined but it's a docker run argument and not a docker build. Sorry I'm not very expert on Docker myself

I'm trying to understand where I should put the --security-opt seccomp:unconfined

That would be somewhere between docker build and the context directory path (docker in our case), the following two are equivalent:

docker build --security-opt seccomp:unconfined -t ledobe docker
docker build -t ledobe --security-opt seccomp:unconfined docker

But I sense another problem you may be about to bump into. Are you running a 32 or 64 bit Raspbian?

I think the Raspbian (32bit, the stock one with PI4) that I'm using does not support that option

Error response from daemon: The daemon on this platform does not support setting security options on build

I guess there's no other way for now

For the record:

pi@raspberrypi:~/projects/ledobe $ docker version
Client: Docker Engine - Community
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        f0df350
 Built:             Wed Jun  2 11:57:27 2021
 OS/Arch:           linux/arm
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:55:25 2021
  OS/Arch:          linux/arm
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Just as I suspected.

The official Raspberry Pi Imager only offers to install a 32-bit Raspberry Pi OS out-of-the-box, which forces your ARM64v8 capable 4B device to operate at a reduced capacity as an ARM32v7 one. The issue that you referenced (as well as other related issues, including the bug report on Ubuntu Launchpad) also concerns ARM32v7 architecture, but this project at its current incarnation only supports (and has been tested on) ARM64v8 hardware.

To work around this and install 64-bit Raspberry Pi OS at this point you'd have to manually download an image from the official Raspberry Pi download server at https://downloads.raspberrypi.org/raspios_arm64/images/ and select it as "Use custom" in the Imager. There's a reddit thread and a forum post about the 64-bit Raspberry Pi OS release.

If upgrading to 64-bit OS seems like too much work, you could give a try to what moby/moby#40734 (comment) suggested and, if successful, wade into the uncharted waters of adapting Ledobe for building on 32-bit armhf architecture. I wouldn't bet on amazing (or any, for that matter) success though, since LedgerHQ team themselves only do amd64 builds at the moment.

Hi, I made some progress. I decided to install a serious Linux distro and I have now Manjaro up and running! :)

I tried again and the process bin/build but I get the following error

Reading package lists...
+ DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-suggests --no-install-recommends cmake=3.16.3-1ubuntu1 g++=4:9.3.0-1ubuntu2 git=1:2.25.1-1ubuntu3.1 make=4.2.1-1.2 openjdk-8-jre-headless=8u292-b10-0ubuntu1~20.04 pkg-config=0.29.1-0ubuntu4 python-is-python3=3.8.2-4 libqt5websockets5-dev=5.12.8-0ubuntu1 libudev-dev=245.4-4ubuntu3.6 libusb-1.0-0-dev=2:1.0.23-2build1 qtbase5-dev=5.12.8+dfsg-0ubuntu1 bash-completion=1:2.10-1ubuntu1 gosu=1.10-1ubuntu0.20.04.1 openssh-client=1:8.2p1-4ubuntu0.2
Reading package lists...
Building dependency tree...
Reading state information...
E: Version '245.4-4ubuntu3.6' for 'libudev-dev' was not found
The command '/bin/sh -c set -x &&  apt-get update &&  DEBIAN_FRONTEND="noninteractive"     TZ="Etc/UTC"     apt-get install -y --no-install-suggests --no-install-recommends     cmake=3.16.3-1ubuntu1     g++=4:9.3.0-1ubuntu2     git=1:2.25.1-1ubuntu3.1     make=4.2.1-1.2     openjdk-8-jre-headless=8u292-b10-0ubuntu1~20.04     pkg-config=0.29.1-0ubuntu4     python-is-python3=3.8.2-4     libqt5websockets5-dev=5.12.8-0ubuntu1     libudev-dev=245.4-4ubuntu3.6     libusb-1.0-0-dev=2:1.0.23-2build1     qtbase5-dev=5.12.8+dfsg-0ubuntu1     bash-completion=1:2.10-1ubuntu1     gosu=1.10-1ubuntu0.20.04.1     openssh-client=1:8.2p1-4ubuntu0.2 &&  rm -rf /var/lib/apt/lists/* &&  git config -f /etc/skel/.gitconfig     user.name 'Ledger DoBE' &&  git config -f /etc/skel/.gitconfig     user.email 'ledobe@example.com' &&  ssh-keyscan     github.com     >> /etc/ssh/ssh_known_hosts &&  :' returned a non-zero code: 100

Here's the full log: docker_build.txt

Any suggestion?

Hi again,

with a small patch I managed to create the docker image

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9ff96eb..86afd18 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -123,7 +123,7 @@ RUN set -x \
     python-is-python3=3.8.2-4 \
 ##  Ledger Live build dependecies.
     libqt5websockets5-dev=5.12.8-0ubuntu1 \
-    libudev-dev=245.4-4ubuntu3.6 \
+    libudev-dev=245.4-4ubuntu3.7 \
     libusb-1.0-0-dev=2:1.0.23-2build1 \
     qtbase5-dev=5.12.8+dfsg-0ubuntu1 \
 ##  Convenience utils specific to this Docker environment.

I will now follow the rest of the documentation to run the compilation!

Everything worked during the compilation, now I'm trying to start the ledger live app but I get some linking issues:

07:11:19 ledobe@0f0e2290d677:/build/desktop/dist
$ ./ledger-live-desktop-2.26.1-linux-arm64.AppImage 
./ledger-live-desktop-2.26.1-linux-arm64.AppImage: error while loading shared libraries: libz.so: cannot open shared object file: No such file or directory

I hope this is the right executable to launch

I hope this is the right executable to launch

It is.

That error indicates that somehow you've managed to get this far without zlib, but the time has finally come to install it.

I've released 0.1.1 which addresses the Docker build issue that can be addressed by this project. With that this can now be closed.

I also looked into updating to building the very latest Ledger Live Desktop, but ISTM LedgerHQ have broken even more stuff than they had before. Unless you can successfully work around all their new glitches to get a reliable build flow, I think it more prudent to put a pin in that for now and check back later.

Runing raspbian @Raspberry pi4:

Same issue here:

root@rp04:~/rabbitmq/3.9-rc/ubuntu# docker build . --security-opt seccomp:unconfined
Sending build context to Docker daemon  18.43kB
Error response from daemon: The daemon on this platform does not support setting security options on build
root@rp04:~/rabbitmq/3.9-rc/ubuntu# 

Without the flag "--security-opt seccomp:unconfined":

root@rp04:~/rabbitmq/3.9-rc/ubuntu# docker build . 
Sending build context to Docker daemon  17.92kB
Step 1/25 : FROM ubuntu:20.04
 ---> 29275250a9ab
Step 2/25 : RUN set -eux; 	apt-get update; 	apt-get install -y --no-install-recommends 		gosu 	; 	rm -rf /var/lib/apt/lists/*; 	gosu nobody true
 ---> Running in 7a138a309867
+ apt-get update
Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [101 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
  At least one invalid signature was encountered.
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
Err:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
  At least one invalid signature was encountered.
Err:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
  At least one invalid signature was encountered.
Reading package lists...
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-security InRelease' is not signed.
The command '/bin/sh -c set -eux; 	apt-get update; 	apt-get install -y --no-install-recommends 		gosu 	; 	rm -rf /var/lib/apt/lists/*; 	gosu nobody true' returned a non-zero code: 100

Can I help in some way?

Can I help in some way?

Maybe. Take a look at #1 (comment), and if the sea still seems ankle-deep to you, head over to moby/moby#40734 and see what can you help with. Godspeed.