Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RISC-V 64-bit container builds #63

Merged
merged 1 commit into from
Mar 19, 2023
Merged

Add RISC-V 64-bit container builds #63

merged 1 commit into from
Mar 19, 2023

Conversation

MichaIng
Copy link
Contributor

@MichaIng MichaIng commented Mar 5, 2023

Thank you for your contribution to the Pi-hole Community!

Please read the comments below to help us consider your Pull Request.

We are all volunteers and completing the process outlined will help us review your commits quicker.

Please make sure you

  1. Base your code and PRs against the repositories developmental branch.
  2. Sign Off all commits as we enforce the DCO for all contributions
  3. Sign all your commits as they must have verified signatures
  4. File a pull request for any change that requires changes to our documentation at our documentation repo

What does this PR aim to accomplish?:

Adding RISC-V 64-bit container builds.

How does this PR accomplish the above?:

  • Added riscv64 Dockerfile
  • Added riscv64 target to FTL builds and base image workflows.
  • Removed doubled git package from aarch64 Dockerfile
  • Decide whether it makes sense to use a Debian Buster container base image, as RISC-V is currently only support on Debian ports Sid/unstable.
    EDIT: Using Debian Sid base container now, since libc6-dev:riscv64 depends on recent versions of glibc packages anyway, which forcefully upgrades a Buster system to Sid in relevant parts anyway. On case builds for older glibc are needed, flags would need to be passed.
  • Tests/builds fail since GitHub secrets are no available for actions from forks.
    EDIT: Tested the steps manually on a Sid VM with Add RISC-V 64-bit support and builds FTL#1536 and the build goes through and produces an executable FTL which can be started and shows CLI via qemu-riscv64-static. Adjusted binary tests in Add RISC-V 64-bit support and builds FTL#1536 to match the results. Test on physical RISC-V system outstanding.

Companion PRs:

Link documentation PRs if any are needed to support this PR:


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

@DL6ER
Copy link
Member

DL6ER commented Mar 5, 2023

Have you tested some of the stand-alone features of FTL on your hardware to see if it actually runs when built by this container? I'm thinking about some easy things:

  • pihole-FTL sqlite3
  • pihole-FTL lua
  • sudo pihole-FTL dhcp-discover
  • pihole-FTL dnsmasq-test

Others that that: I've tried building your docker container locally but it failed with:

Hit:1 http://deb.debian.org/debian sid InRelease
Ign:2 https://deb.debian.org/debian-ports sid InRelease
Ign:2 https://deb.debian.org/debian-ports sid InRelease
Ign:2 https://deb.debian.org/debian-ports sid InRelease
Err:2 https://deb.debian.org/debian-ports sid InRelease
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 146.75.122.132 443]
Reading package lists...
W: https://deb.debian.org/debian-ports/dists/sid/InRelease: No system certificates available. Try installing ca-certificates.
W: https://deb.debian.org/debian-ports/dists/sid/InRelease: No system certificates available. Try installing ca-certificates.
W: https://deb.debian.org/debian-ports/dists/sid/InRelease: No system certificates available. Try installing ca-certificates.
W: https://deb.debian.org/debian-ports/dists/sid/InRelease: No system certificates available. Try installing ca-certificates.
W: Failed to fetch https://deb.debian.org/debian-ports/dists/sid/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 146.75.122.132 443]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libcap-dev:riscv64
E: Unable to locate package libgmp-dev:riscv64
E: Unable to locate package libc6-dev:riscv64

The hint works, when moving ca-certificates up to where debian-ports-archive-keyring is installed, it works fine.


edit Part of the comment removed, I see you force-pushed a new version which fixed what I've seen.

I'm running these test on an x86_64 machine with Ubuntu 22.04.2 LTS and docker version 20.10.14, build a224086. The base image (debian:sid) pulled in my experiments in bad0dd70f005 (4 days ago).

ftl-build/riscv64/Dockerfile Outdated Show resolved Hide resolved
ftl-build/riscv64/Dockerfile Outdated Show resolved Hide resolved
@MichaIng
Copy link
Contributor Author

MichaIng commented Mar 5, 2023

The part solved with initially missing ca-certificates.

Have you tested some of the stand-alone features of FTL on your hardware to see if it actually runs when built by this container?

So far only some quick tests with qemu-riscv64-static on the machine where I tested the built (Debian Bookworm VM with Sid repo added). I uploaded the binary already for testing on the (remote) StarFive VisionFive 2.

@MichaIng
Copy link
Contributor Author

MichaIng commented Mar 5, 2023

Tested, works, here a debug token to have a closer look: https://tricorder.pi-hole.net/kcm5p3sW/

Here the binary if someone else wants to test/look: https://dietpi.com/downloads/binaries/pihole-FTL-riscv64-linux-gnu
I used there installer from here, passed the unsupported distro override and hacked https://dietpi.com/downloads/binaries/ as FTL binary base URL inside.

Doubles partly with debug log, but for completeness:

root@DietPi:~# pihole-FTL sqlite3
Pi-hole FTL v5.21-2-g04488d11
SQLite version 3.40.0 2022-11-16 12:10:08
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .quit
root@DietPi:~# pihole-FTL lua
Pi-hole FTL v5.21-2-g04488d11
Lua 5.4.4  Copyright (C) 1994-2022 Lua.org, PUC-Rio
> ^C
root@DietPi:~# pihole-FTL dhcp-discover
Scanning all your interfaces for DHCP servers
Timeout: 10 seconds

WARN: Could not sendto() in send_dhcp_discover() (/root/FTL/src/dhcp-discover.c:233): Network is unreachable
* Received 548 bytes from eth0:192.168.178.1
  Offered IP address: 192.168.178.22
  Server IP address: 192.168.178.1
  Relay-agent IP address: N/A
  BOOTP server: (empty)
  BOOTP file: (empty)
  DHCP options:
   Message type: DHCPOFFER (2)
   server-identifier: 192.168.178.1
   lease-time: 86400 ( 1d )
   renewal-time: 43200 ( 12h )
   rebinding-time: 75600 ( 21h )
   netmask: 255.255.255.0
   router: 192.168.178.1
   dns-server: 192.168.178.2
   domain-name: "fritz.box"
   broadcast: 192.168.178.255
   ntp-server: 192.168.178.1
   Port Control Protocol (PCP) server: 192.168.178.1

^C
root@DietPi:~# pihole-FTL dnsmasq-test
dnsmasq: syntax check OK.

@MichaIng MichaIng marked this pull request as ready for review March 5, 2023 18:46
Copy link
Member

@DL6ER DL6ER left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debug log looks fine. Excellent job, thanks!

@dschaper
Copy link
Member

dschaper commented Mar 5, 2023

@MichaIng Do you have IPv6 disabled (via sysctl.conf or grub) on that test setup?

@MichaIng
Copy link
Contributor Author

MichaIng commented Mar 5, 2023

The kernel does not support it at all:

root@DietPi:~# modinfo ipv6
modinfo: ERROR: Module ipv6 not found.

This is the kernel provided by StarFive, which lacks quick some features. I'll try doing an own build next week.

@PromoFaux
Copy link
Member

@MichaIng rebase on latest master and force push please - I've tweaked the actions

@MichaIng
Copy link
Contributor Author

MichaIng commented Mar 6, 2023

Generally buildx supports the linux/riscv64 target: docker/buildx#652

Would make sense if it required Totally makes sense that it requires a Debian ports Sid base container here as well: https://hub.docker.com/r/riscv64/debian/

Signed-off-by: MichaIng <[email protected]>
Co-authored-by: DL6ER <[email protected]>
@DL6ER DL6ER merged commit bf0a7bb into pi-hole:master Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants